[NativeRT] Make VariadicOpConverter and FuseListUnpackConverter for cpu nodes only (#159519)

Summary:
VariadicOpConverter and FuseListUnpackConverter would introduce ops that only have CPU kernels.

Currently, the graph passes are ran if static_dispatch is enabled.

As we plan to enable static_dispatch by default, this diff add the additional check for the graph pass to only work on the node that has all the inputs/outputs on CPU.

Test Plan:
CI

Rollback Plan:

Differential Revision: D79295640

Pull Request resolved: https://github.com/pytorch/pytorch/pull/159519
Approved by: https://github.com/dolpm, https://github.com/henryoier
This commit is contained in:
Sherlock Huang
2025-07-31 18:17:21 +00:00
committed by PyTorch MergeBot
parent 8a233d6000
commit c1722db0f7
4 changed files with 104 additions and 0 deletions

View File

@ -599,6 +599,7 @@ libtorch_nativert_sources = [
"torch/nativert/graph/GraphSignature.cpp",
"torch/nativert/graph/Serialization.cpp",
"torch/nativert/graph/TensorMeta.cpp",
"torch/nativert/graph/GraphUtils.cpp",
"torch/nativert/executor/DelegateExecutor.cpp",
"torch/nativert/executor/Placement.cpp",
"torch/nativert/executor/ExecutionPlanner.cpp",