Repository navigation
[precompile] The capture session, the public capture entry point, and guard-state pickling - #195924
Closed
bobrenjc93 wants to merge 58 commits into
Closed
bobrenjc93 wants to merge 58 commits into
bobrenjc93 wants to merge 58 commits into
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/195924
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Sep 3, 2026
Closed
Closed
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
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):
This is where multi-graph capture becomes usable end to end. It lands the
PrecompileSessionthat drives a capture, the publicprecompile.captureentry point built on it, and the session save path (
save/snapshot_artifact) that writes the(python_code, cache)artifact. Theguard-state pickling fix below is what lets a round-tripping capture serialize
its guards at all.
The guard-drop policy re-serializes a loaded guard state, and that second
pass exposed pickler defects the one-shot path never hit. The pickle now keeps
a guard's own subject out of value pruning (a TENSOR_MATCH carries its subject
in its create_fn partial, and when the source root round-trips by alias that
copy is a different object from the one the source walk reaches), shares equal
user_stack objects so the memo folds them, re-reduces a _Missing sentinel
compactly, carries a tensor's guard-traversed Python attributes in the pickle
STATE slot (after the tensor is memoized, so a self-referential attribute
terminates) and a wrapper subclass's requires_grad, keeps a retained-grad
non-leaf's .grad, and makes the bound-method reducer a fixed point over its own
output through _reduces_to_missing, which mirrors every rule under which
reducer_override substitutes _Missing. Dimension markings register in the
guard tree where they are read, so serialization no longer prunes them.
Precompile's own served-artifact handles reduce to _Missing rather than
losing the frame to an unpicklable condition variable.
test_opaque_obj_v2's reducer_override check now unpacks the (func, args) head
explicitly and asserts the full pickle round-trips.
Test Plan:
Authored with an AI assistant.
[no ci]