Skip to content

[compiled_autograd] Specialize the compiled-autograd backward on undefined tangent masks - #195884

Closed
bobrenjc93 wants to merge 1 commit into
gh/bobrenjc93/1111/basefrom
gh/bobrenjc93/1111/head
Closed

bobrenjc93 wants to merge 1 commit into
gh/bobrenjc93/1111/basefrom
gh/bobrenjc93/1111/head

Conversation

@bobrenjc93

@bobrenjc93 bobrenjc93 commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Compiled autograd traces the AOTAutograd backward through its own graph, so the
undefined-tangent specialization the previous commit adds to the live runtime
has to be mirrored there: the compiled-autograd backward observes the mask of
defined tangents at runtime, retraces the AOTAutograd backward for that mask
through graph_compile.retrace_backward_handling_errors under the same
per-TracingContext lock the runtime path uses (it re-runs the joint trace under
the shared fake mode), and falls back to structural pruning or the zero-tangent
base backward under the same policy. The grad-output prototype getattr node is
emitted only when pruning is on, so the flag-off compiled-autograd graph is
byte-for-byte unchanged (the goldens assert this).

Test Plan:

python test/inductor/test_compiled_autograd.py -k TestCompiledAutograd
python test/functorch/test_aotdispatch.py -k compiled_autograd
python test/dynamo/test_backward_higher_order_ops.py

Authored with an AI assistant.

Co-Authored-By: Claude Fable 5.1 [email protected]

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo @azahed98 @xmfan @aditvenk

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/195884

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures, 4 Cancelled Jobs, 18 Pending

As of commit d3c59ba with merge base 3d3d3f4 (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOBS - The following jobs were cancelled. Please retry:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@bobrenjc93

Copy link
Copy Markdown
Contributor Author

@pytorchbot label "release notes: dynamo"

@bobrenjc93

Copy link
Copy Markdown
Contributor Author

Closing in favor of the canonical stack #195353-#195362 (now also #195911-#195929). Note for future readers: this change has no counterpart there yet; the code remains in this PR's history if it is wanted later.

@bobrenjc93 bobrenjc93 closed this Sep 3, 2026
@github-actions
github-actions Bot deleted the gh/bobrenjc93/1111/head branch November 15, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant