Repository navigation
[inductor] Make cudagraph partitioning aware of invoke_subgraph bodies - #194633
desertfire wants to merge 5 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/194633
Note: Links to docs will display an error until the docs builds have been completed. ⏳ 12 Pending, 1 Unrelated FailureAs of commit c6a2031 with merge base d535485 ( BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
The graph-partition scheduler treated InvokeSubgraph as one outer GPU node, so capture restrictions and profitability information in the lowered body were invisible. Region outputs also forced partition boundaries and inflated the minimum-partition-size count, while repeated scheduler passes rescanned the same body. Apply the existing CUDA Graph safety checks recursively to region bodies and nested control-flow subgraphs under each region's Inductor configuration. Cache the result per region and keep the InvokeSubgraph node and its MultiOutput nodes on the same side of a partition boundary. Unannotated regions remain in their enclosing partition, and profitability counts the fused kernels emitted by the body rather than the wrapper and its outputs. Thread graph-local partition state through lowering without adding false-valued optional arguments to ordinary FX cache keys. This change was authored with the assistance of an AI coding agent. ghstack-source-id: ad19d41 Pull-Request: #194633
|
@claude review this pr |

Stack from ghstack (oldest at bottom):
The graph-partition scheduler treated InvokeSubgraph as one outer GPU node, so
capture restrictions and profitability information in the lowered body were
invisible. Region outputs also forced partition boundaries and inflated the
minimum-partition-size count, while repeated scheduler passes rescanned the same
body.
Apply the existing CUDA Graph safety checks recursively to region bodies and
nested control-flow subgraphs under each region's Inductor configuration. Cache
the result per region and keep the InvokeSubgraph node and its MultiOutput nodes
on the same side of a partition boundary. Unannotated regions remain in their
enclosing partition, and profitability counts the fused kernels emitted by the
body rather than the wrapper and its outputs.
Thread graph-local partition state through lowering without adding false-valued
optional arguments to ordinary FX cache keys.
Test Plan:
This change was authored with the assistance of an AI coding agent.