Skip to content

Commit ea9fd12

Browse files
pytorchbotssjia
authored andcommitted
[ET-VK] Support alias_copy in partitioner by removing it as a redundant op (#18461)
This PR was created by the merge bot to help merge the original PR into the main branch. ghstack PR number: #18408 by @SS-JIA ^ Please use this as the source of truth for the PR details, comments, and reviews ghstack PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/501/base ghstack PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/501/head Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/500/orig Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/501/orig Differential Revision: [D97757921](https://our.internmc.facebook.com/intern/diff/D97757921/) @diff-train-skip-merge Co-authored-by: ssjia <ssjia@devvm26340.ftw0.facebook.com>
1 parent 1bd74b3 commit ea9fd12

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

backends/vulkan/_passes/remove_redundant_ops.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class RemoveRedundantOpsTransform(ExportPass):
2828
exir_ops.edge.aten.clone.default,
2929
torch.ops.aten.alias.default,
3030
exir_ops.edge.aten.alias.default,
31+
torch.ops.aten.alias_copy.default,
32+
exir_ops.edge.aten.alias_copy.default,
3133
exir_ops.edge.aten.lift_fresh_copy.default,
3234
exir_ops.edge.dim_order_ops._to_dim_order_copy.default,
3335
exir_ops.edge.dim_order_ops._clone_dim_order.default,

backends/vulkan/op_registry.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,20 @@ def register_clone_dim_order():
11251125
)
11261126

11271127

1128+
# alias_copy is a no-op identity operation (same as clone/alias). It is removed
1129+
# by RemoveRedundantOpsTransform during preprocess, so the C++ runtime never sees
1130+
# it. Registering it here ensures the partitioner delegates it to Vulkan rather
1131+
# than creating partition boundaries that break the graph.
1132+
@update_features(exir_ops.edge.aten.alias_copy.default)
1133+
def register_alias_copy():
1134+
return OpFeatures(
1135+
inputs_storage=utils.ANY_STORAGE,
1136+
inputs_dtypes=utils.FP_INT_BOOL_T,
1137+
supports_resize=True,
1138+
supports_highdim=True,
1139+
)
1140+
1141+
11281142
# =============================================================================
11291143
# Gather.cpp
11301144
# =============================================================================

0 commit comments

Comments
 (0)