Skip to content

[ET-VK][ez] Fix partitioner logic of finding keepdim arg of reduce ops #13598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions backends/vulkan/op_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,17 @@ def check_reduce_node(node: torch.fx.Node) -> bool:
# If we can't get memory layout information, we'll assume the dims aren't packed
pass

keepdim = node.args[2]
if isinstance(keepdim, bool) and not keepdim:
def try_find_keepdim_arg(node: torch.fx.Node) -> bool:
for arg in node.args:
if isinstance(arg, bool):
return arg

# Assume false by default
return False

if len(node.args) > 2:
keepdim = node.args[2]
if isinstance(keepdim, bool) and not keepdim:
return False
keepdim = try_find_keepdim_arg(node)
if isinstance(keepdim, bool) and not keepdim:
return False

return True

Expand Down
2 changes: 1 addition & 1 deletion backends/vulkan/partitioner/vulkan_partitioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def is_in_local_scalar_dense_chain(self, node: torch.fx.Node) -> Tuple[bool, boo
def log_skip(self, node: torch.fx.Node, reason: str) -> None:
if node.op == "call_function":
logger.info(
f"[Vulkan Partitioner] Due to [{reason}], skipping {node.format_node()}"
f"[Vulkan Partitioner] Due to [{reason}], skipping {utils.node_io_str(node)}"
)

def is_node_supported(
Expand Down
2 changes: 2 additions & 0 deletions backends/vulkan/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,8 @@ def get_node_val_str(node: torch.fx.Node) -> str:
assert isinstance(node.meta["val"], (list, tuple))
return f"[{', '.join(get_tensor_val_str(t) for t in node.meta['val'])}]"
else:
if "val" not in node.meta:
return str(node)
return str(node.meta["val"])


Expand Down
Loading