Repository navigation
[precompile] Lead the risky-drop report with the guards that can change a shape - #194542
bobrenjc93 wants to merge 4 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/194542
Note: Links to docs will display an error until the docs builds have been completed. ❌ 13 New Failures, 1 Unrelated FailureAs of commit b28761f with merge base 1b4e490 ( 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. |
…ge a shape A capture of a large sharded model reported 652 accepted risky drops. Four of them mattered -- one SEQUENCE_LENGTH and three CONSTANT_MATCHes on a default argument the traced graph had specialised on -- and finding them took a hand-written filter over the summary, weeks after the artifact was first built. The other 648 are CLOSURE_MATCH, CLASS_MATCH, ID_MATCH and friends on function and class identities: slots to audit against a deployment, but none of them can change what shape the graph computes. The warning made that hard on purpose without meaning to. It flattened every drop into one list, cut it at 8 in guard-type order, and admitted in a comment that the cut said nothing about severity. At 33 drops -- Qwen2, the largest model measured when it was written -- that is survivable. At 652 the entire visible window is CLOSURE_MATCH. Group by guard type and cap per type instead, with the shape-bearing types first and labelled as the ones that can make a served call run a graph traced for a different shape without missing a guard. On that same 652 the first clause now names all four, because a type with one member can no longer be crowded out by a type with 392. Both copies of the paragraph -- save() and artifact() -- had already drifted apart, so they now share one helper. The ordering is by guard TYPE, and the report now says so rather than promising more. Type is as far as this can go: the question a reader has is whether the guarded VALUE can differ at serve time, and on the model above all four candidates this surfaced turned out to be reached through a class or function definition -- __mro__ walks to __defaults__ and __code__ -- so they were compile-time constants that no batch could change. Ranking them properly needs the structured source rather than the name, so instead the report names that tell, which is what a reader needs to dismiss one in a second rather than a round trip. This changes reporting only. Whether an unrebuildable shape-bearing guard should be droppable at all under require_no_risky_drops=False is a separate question: the policy path exempts those types and this path does not, and closing that gap means refusing artifacts that build today, which wants evidence about how often it fires before it is worth doing. Test Plan: ``` python test/test_precompile.py python test/dynamo/test_package.py ``` One new test reproduces the distribution that hid the lead -- 392 CLOSURE_MATCH, 81 ID_MATCH, three shape-bearing -- and asserts each shape-bearing name survives truncation and is named ahead of the bulk. Authored with an AI assistant. ghstack-source-id: dea4c64 Pull-Request: #194542
|
@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
1 similar comment
|
@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Stack from ghstack (oldest at bottom):
A capture of a large sharded model reported 652 accepted risky drops. Four of
them mattered -- one SEQUENCE_LENGTH and three CONSTANT_MATCHes on a default
argument the traced graph had specialised on -- and finding them took a
hand-written filter over the summary, weeks after the artifact was first built.
The other 648 are CLOSURE_MATCH, CLASS_MATCH, ID_MATCH and friends on function
and class identities: slots to audit against a deployment, but none of them can
change what shape the graph computes.
The warning made that hard on purpose without meaning to. It flattened every
drop into one list, cut it at 8 in guard-type order, and admitted in a comment
that the cut said nothing about severity. At 33 drops -- Qwen2, the largest
model measured when it was written -- that is survivable. At 652 the entire
visible window is CLOSURE_MATCH.
Group by guard type and cap per type instead, with the shape-bearing types
first and labelled as the ones that can make a served call run a graph traced
for a different shape without missing a guard. On that same 652 the first
clause now names all four, because a type with one member can no longer be
crowded out by a type with 392.
Both copies of the paragraph -- save() and artifact() -- had already drifted
apart, so they now share one helper.
The ordering is by guard TYPE, and the report now says so rather than
promising more. Type is as far as this can go: the question a reader has is
whether the guarded VALUE can differ at serve time, and on the model above all
four candidates this surfaced turned out to be reached through a class or
function definition -- mro walks to defaults and code -- so they
were compile-time constants that no batch could change. Ranking them properly
needs the structured source rather than the name, so instead the report names
that tell, which is what a reader needs to dismiss one in a second rather than
a round trip.
This changes reporting only. Whether an unrebuildable shape-bearing guard
should be droppable at all under require_no_risky_drops=False is a separate
question: the policy path exempts those types and this path does not, and
closing that gap means refusing artifacts that build today, which wants
evidence about how often it fires before it is worth doing.
Test Plan:
One new test reproduces the distribution that hid the lead -- 392
CLOSURE_MATCH, 81 ID_MATCH, three shape-bearing -- and asserts each
shape-bearing name survives truncation and is named ahead of the bulk.
Authored with an AI assistant.
Differential Revision: D117281204