Skip to content

Commit ce92183

Browse files
ssjiaSS-JIA
authored andcommitted
[ExecuTorch][ez] Propagate ops_to_not_decompose to config exception list
When a partitioner declares ops in `ops_to_not_decompose()`, the framework preserves them from decomposition during `_gen_edge_manager_for_partitioners` and passes them to `EdgeProgramManager.__init__` as `core_aten_ops_exception_list`. However, `EdgeProgramManager` does not store this list, so when `transform()` is called later (e.g. with `I64toI32` passes), its `EXIREdgeDialectVerifier` creates a fresh verifier without the exception list. This causes a `SpecViolationError` for any preserved op that is not in the core ATen opset. This was discovered while adding `torch.ops.aten.pixel_shuffle.default` to the Vulkan backend's `ops_not_to_decompose` list. The op was correctly preserved from decomposition, but the subsequent `transform()` call in `to_edge_transform_and_lower` rejected it with: "Operator torch._ops.aten.pixel_shuffle.default is not in Core ATen opset". The fix merges `ops_to_not_decompose` into `config._core_aten_ops_exception_list` before creating the `EdgeProgramManager`. Since the config object is propagated through `transform()` and its verifier, the exception list is now available at every verification point. This eliminates the need for callers to manually set `_core_aten_ops_exception_list` for ops that their partitioner already declares as not-to-decompose. Differential Revision: [D93024955](https://our.internmc.facebook.com/intern/diff/D93024955/) ghstack-source-id: 340487662 Pull Request resolved: #17404
1 parent ff76165 commit ce92183

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

exir/program/_program.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,11 +1252,21 @@ def _gen_edge_manager_for_partitioners(
12521252
preserve_ops=ops_set_to_not_decompose_by_program.get(name, []),
12531253
)
12541254

1255+
# Merge ops_to_not_decompose into config so that downstream calls (e.g.
1256+
# EdgeProgramManager.transform()) carry the exception list through their
1257+
# verifiers automatically.
1258+
all_ops_not_to_decompose = list(
1259+
set().union(*ops_set_to_not_decompose_by_program.values())
1260+
)
1261+
config._core_aten_ops_exception_list = list(
1262+
set(config._core_aten_ops_exception_list) | set(all_ops_not_to_decompose)
1263+
)
1264+
12551265
edge_manager = EdgeProgramManager(
12561266
edge_programs,
12571267
constant_methods,
12581268
config,
1259-
list(set().union(*ops_set_to_not_decompose_by_program.values())),
1269+
all_ops_not_to_decompose,
12601270
)
12611271

12621272
if generate_etrecord:

0 commit comments

Comments
 (0)