Skip to content

[guards] Register the dimension markings where they are read, and delete the allowlist - #194387

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

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

Conversation

@bobrenjc93

@bobrenjc93 bobrenjc93 commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

The dimension-marking guard reads five attributes off the example tensor -- plus
two more that are gated on _dynamo_unbacked_indices -- with hasattr/getattr
rather than through a Source. Nothing else registers those values in the guard
tree, and value pruning drops whatever the tree does not reach, so the
serialized state lost them and the rebuilt guard compared against nothing: a
mark_unbacked artifact refused the very tensor it was captured on.

That was papered over with _TENSOR_ATTRIBUTES_TENSOR_MATCH_READS, a
frozenset naming the attributes so the tensor carrier would keep them anyway.
It was a second list that had to stay in sync with the first, and it was
ALREADY out of sync when it landed -- five names where the builder reads seven,
which is worse than none: carrying the gate without its dependents activates a
guard whose expected value is now None.

Register at the read site instead. One local read_marking routes both loops,
so a sixth or eighth name cannot be added to dim_marking_attrs without
becoming carriable, and the allowlist is deleted. It is also more precise than
the list was: it carries exactly the markings this guard will consume, rather
than every name on a list whether the guard reads it or not.

Registration is conditional on the value being present. mark_unbacked sets
the gate but leaves at least one dependent as None on every path, and
registering None would put id(None) in the tree, which value pruning matches
by identity.

Test Plan:

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

The existing test is parametrized over the five marking shapes --
mark_unbacked bare, with bounds, and with a shape_id; mark_static;
mark_dynamic -- and all five fail without the registration. Each one serves
the SAME marked tensor it captured, which is the only thing that tests this:
every other marking test in these suites marks one tensor and then serves a
fresh unmarked one, and passes with the bug fully present.

Authored with an AI assistant.

Differential Revision: D116962607

[ghstack-poisoned]
@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/194387

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

❌ 24 New Failures, 1 Unrelated Failure

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

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@pytorch-bot pytorch-bot Bot added ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests module: dynamo labels Aug 21, 2026
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/1024/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