Repository navigation
[aot_autograd] Name the forward output when a kept tangent slot arrives as None - #194488
Closed
bobrenjc93 wants to merge 2 commits into
Closed
bobrenjc93 wants to merge 2 commits into
bobrenjc93 wants to merge 2 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/194488
Note: Links to docs will display an error until the docs builds have been completed. ❌ 20 New FailuresAs of commit e71b5ff with merge base 1b4e490 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Aug 23, 2026
Closed
Closed
This was referenced Aug 23, 2026
Closed
Contributor
Author
|
@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This was referenced Aug 23, 2026
This was referenced Aug 28, 2026
Contributor
Author
|
@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
1 similar comment
Contributor
Author
|
@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack (oldest at bottom):
When the compiled backward is handed a None for a tangent slot it requires,
the first thing to notice is inductor, several frames below AOTAutograd:
That names a codegen'd variable, and the members of a grouped assert are
whichever graph inputs the first scheduler node to read them happens to read
(inductor/scheduler.py feeds codegen_deferred_input_asserts from
node.read_writes.reads), so the tuple is neither positional nor complete. It
cannot be mapped back to a user output by hand, and it does not say which of
the two members was the None.
Raise from process_runtime_tangent instead, for kept slots only, naming the
output behind the slot:
followed by the three cases in which autograd hands back a None at all -- a
non-differentiable dtype, ctx.mark_non_differentiable, or a non-Tensor in that
slot -- and which of them this slot is, chosen by the recorded dtype. The
taxonomy is exhaustive against _process_backward_mode_ad in custom_function.cpp,
so the message can state that reaching it is a bug in AOTAutograd or the backend
rather than something the model asked for.
The dtype has to be captured in make_runtime_safe(), alongside
traced_tangent_metas: it is the last point at which the fake traced_tangents
still exist, and it is gone by the time the prologue is codegen'd. Everything
else is already available where all_surviving is built, so it is baked into the
prologue as one constant and costs an argument load per tangent, measured at
0.5ns.
Only kept slots raise. A None for a slot the backward dropped is legitimate and
still passes through untouched, as does the recursive call
process_runtime_tangent makes for subclass attributes.
This is a diagnostic, not a fix. It exists because the two causes found so far
-- an output aliasing another returned slot, fixed in the commit below, and a
non-differentiable dtype, which is structurally unreachable since
all_surviving keeps outputs on requires_grad_for_backward and an integer output
can never have it -- do not explain every report, and the current error gives a
reporter nothing to send back.
Test Plan:
Three tests: the end-to-end message, driving a None back into the
intermediate-base slot by patching out the dedup from the commit below; the
non-differentiable-dtype arm, driven directly since it cannot be reached end to
end; and a negative test that six legitimately-None dropped slots still pass
through silently.
Authored with an AI assistant.
Differential Revision: D117125058