Skip to content

[guards] Attribute an unpicklable guard value by identity, not by type name - #194388

Closed
bobrenjc93 wants to merge 3 commits into
gh/bobrenjc93/1025/basefrom
gh/bobrenjc93/1025/head
Closed

bobrenjc93 wants to merge 3 commits into
gh/bobrenjc93/1025/basefrom
gh/bobrenjc93/1025/head

Conversation

@bobrenjc93

@bobrenjc93 bobrenjc93 commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

_offending_value_path regexed the type name out of the pickle error and then
searched the guard state's scopes for a value of that type. It does not have to
guess: reducer_override is handed the object it is reducing, so recording
that gives the exact value and the search becomes an identity match.

Guessing was wrong in a way that matters. With two values of the same type in
scope it reported whichever it found first:

heuristic:  reached via: local_scope['cfg'].a_decoy
exact:      reached via: local_scope['cfg'].b

and b is the one that failed. On a large model the whole value of this
diagnostic is that it saves bisecting by hand, so pointing at the wrong
attribute is worse than pointing at nothing.

Deletes the type-name extraction: the re.search, the rsplit('.', 1)
that existed only because CPython qualifies the name for anything outside
builtins, and the early-out for an error whose text did not match the pattern --
which also means a __reduce__ that raises something other than "cannot
pickle 'X' object" now gets a path too, where before it got nothing.

Test Plan:

python test/test_precompile.py
python test/dynamo/test_package.py
python test/dynamo/test_guard_serialization.py

The existing unit test grows a same-typed decoy in front of the real value, so
it pins identity-matching rather than type-matching.

Authored with an AI assistant.

Differential Revision: D116962600

[ghstack-poisoned]
@pytorch-bot pytorch-bot Bot added ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests module: dynamo labels Aug 21, 2026
@pytorch-bot

pytorch-bot Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 236 New Failures, 3 Cancelled Jobs, 3 Unrelated Failures, 1 Unclassified Failure

As of commit e6fa83b with merge base 1b4e490 (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:

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

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

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

This was referenced Aug 21, 2026
This was referenced Aug 22, 2026
[ghstack-poisoned]
[ghstack-poisoned]
@bobrenjc93

Copy link
Copy Markdown
Contributor Author

@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

1 similar comment
@bobrenjc93

Copy link
Copy Markdown
Contributor Author

@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@bobrenjc93

Copy link
Copy Markdown
Contributor Author

Superseded by the canonical precompile stack #195353-#195362; this change lives in #195362 (with the guard-drop policy half in #195360). Closing to consolidate review there. The branch is kept on GitHub.

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

Labels

ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests ciflow/trunk Trigger trunk jobs on your pull request module: dynamo topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant