Repository navigation
[inductor] Preserve directional cudagraph decisions in AOTAutograd cache - #194632
desertfire wants to merge 5 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/194632
Note: Links to docs will display an error until the docs builds have been completed. ⏳ 12 Pending, 1 Unrelated FailureAs of commit bc453ed 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. |
|
@claude review this pr |
|
Claude finished @desertfire's task in 17m 54s —— View job Reviewed — the fix addresses a real bug, but the test only covers the cache-key half and none of the Full reviewPR Review: #194632SummaryThreads the TestingThe new test does not test the bug the PR is about. I traced the failure mode to confirm it is real: on a hit, The existing sibling test shows the shape a real regression test should take (
Without step 3 the No test for the Test is missing the config decorators every sibling cache test carries. Lines 1102-1106 and 1173-1177 each apply: @torch._functorch.config.patch("enable_autograd_cache", True)
@torch._inductor.config.patch("fx_graph_cache", True)
@torch._inductor.config.patch("fx_graph_remote_cache", False)
@torch._dynamo.config.patch("specialize_float", True)The new test at line 1148 has none. Code QualityThree names for one value. The same bwd override is now spelled three ways:
The last two hold the identical value and both live in the same TypedDict. Emit Undocumented field is the one that needs the comment. At compile_fx.py:969-972, the explanatory comment sits above Dead branch in the new override logic. Stale assertion. output_code.py:880-881 still asserts RecommendationRequest Changes The core diagnosis is correct and both fixes look right to me. Blocking on tests: the primary behavior this PR fixes (cache-hit backward cudagraph decision) and the secondary one (partition post-compile routing under mismatched |
|
@claude review this pr again |
|
Claude finished @desertfire's task in 34m 14s —— View job Re-reviewed at commit Full reviewPR Review: #194632SummaryThreads a backward-only cudagraph opt-out ( Status of previous review feedbackAll four blocking items from the earlier round are resolved:
Code QualityDead assertion for a state the type forbids. output_code.py:885-889: if cudagraphs_post_compile_override is not None:
if cudagraphs_post_compile_override:
raise AssertionError("cudagraphs_post_compile_override only supports False")
graph_cudagraphs = BoxedBool(False)The field is typed The cleaner shape is a plain The
TestingUnnecessary cudagraph-tree reset. test/inductor/test_cudagraph_trees.py:1203 calls
PerformanceEvery FX-graph and AOTAutograd cache key changes, including for graphs with no override. That is avoidable: RecommendationApprove (with the dead assertion and the redundant The bug diagnosis and the fix are right, and the coverage gap from the previous round is closed: |
|
@claude review this pr again |
|
Claude finished @desertfire's task in 24m 48s —— View job Re-reviewed at Full reviewPR Review: #194632SummaryThreads a backward-only cudagraph opt-out into the AOTAutograd cache key and into the serialized Status of previous review feedbackBoth items called out last round are fixed: the I re-verified the serialization argument the fix rests on, and it holds on all four paths: Code QualityThe type was widened from That matters because The cleanest resolution is the one from last round: a plain Two Testing
The test also sits in the wrong class. Backward CompatibilityWorth confirming the This is pre-existing — the cold-path override at compile_fx.py:2947-2949 is on the base branch — so it is not something this PR introduced, and I would not block on it. Flagging it because this PR is what extends the behavior to warm loads, and because the test quietly depends on the workaround. Lower confidence than the other findings; you know this manager's generation logic better than I do. RecommendationApprove, with the type widening worth resolving first. The diagnosis and the fix are correct, the serialization argument checks out on every load path, and the |
|
@claude review again |
|
Claude finished @desertfire's task in 22m 58s —— View job Re-reviewed at Full reviewPR Review: #194632SummaryThreads a backward-only cudagraph opt-out ( Status of previous review feedbackAll items from the last round are resolved:
I also want to correct something from my last review: I flagged the CorrectnessI re-verified the serialization argument on all four paths and it holds:
The Code QualityMinor: the FX-graph-cache half of the key is redundant. When the override applies, Minor: the TestingBoth tests look right to me.
One pre-existing item worth a sanity check, not a blocker. RecommendationApprove Every blocking item from the prior rounds is resolved, the cache-key churn is now avoided, and I verified the serialization + |
Stack from ghstack (oldest at bottom):
AOTAutograd cache loading reconstructs FX compiler state from a forward-derived
shared BoxedBool. With override_cudagraphs(bwd=False), a cold backward compile
used a separate disabled decision, but that directional choice was absent from
the AOTAutograd key and the serialized backward artifact. A warm load could
therefore reuse the forward's enabled decision for the backward.
Propagate the existing cudagraphs_bwd_override through the FX graph and
AOTAutograd cache inputs, and consult the serialized value during post_compile.
Include the override only when it is non-None so graphs without one retain their
existing cache keys. The copy in create_fx_config distinguishes AOTAutograd
entries; runtime behavior comes from the value serialized with the compiled
graph.
Test Plan:
This change was authored with the assistance of an AI coding agent.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo @azahed98