Repository navigation
[aot_autograd] compile_to_python training support - #195885
bobrenjc93 wants to merge 1 commit into
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/195885
Note: Links to docs will display an error until the docs builds have been completed. ❌ 3 New Failures, 7 Cancelled Jobs, 15 PendingAs of commit eba5ed7 with merge base 3d3d3f4 ( 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. |
|
@pytorchbot label "release notes: aot autograd" |
Stack from ghstack (oldest at bottom):
compile_to_python / to_standalone_python can now emit the training (backward)
path, not just inference, on top of the undefined-tangent backward
specialization two commits below: a training artifact composes the forward,
the base backward and one backward variant per tangent mask observed at
capture, and serves the variant for the mask a backward call presents.
Differentiability of a generated graph is decided by scanning call nodes'
operator names (to_standalone_python._graph_differentiates), not by
substring-matching graph names.
Standalone artifacts. compile_to_python training artifacts import AOTAutograd
only through standalone_runtime: source_emit redirects every re-exported object
there by identity, and the surface holds the runtime helpers, the metadata
types, the whole closed set of descriptor classes, FunctionalTensor (the
raw_type baked into output metadata) and SymIntEqByExpr (baked MetadataKey
entries); BackwardState is bound into the forward only when the graph has
backward state, and the surface test matches every private torch path an
artifact could reach internals through. The direct compile_to_python path
captures under aot_autograd_prune_unused_outputs, matching the flag the emitted
glue bakes on, so the exact retrace is available and a declined retrace warns
instead of silently falling back to structural pruning; the standalone mask
compiler follows the live runtime's fallback policy and always serves mask 0.
standalone_compile marks user-visible outputs under keep_output_stride as
compile_fx does; module renaming converts ast byte offsets to str offsets; the
module names shared with torch._precompile are constants; the passthrough
backward consumes its argument list; a corrupt cache bundle does not discard
the good ones in a merge.
Suggested review order: to_standalone_python.py (the training composer),
standalone_runtime.py and source_emit.py (the stable import surface),
torch/_inductor/standalone_compile.py (user-visible output marking), then
torch/compiler/_cache.py.
Test Plan:
New tests: a training artifact loading in a fresh subprocess, the
stable-surface import assertion for training artifacts across private paths,
non-ASCII module renaming, passthrough argument release, and cache-merge
tolerance.
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