Repository navigation
[no-ci] [dynamo] Record on the package which frame hit the recompile limit - #198092
Closed
bobrenjc93 wants to merge 4 commits into
Closed
bobrenjc93 wants to merge 4 commits into
bobrenjc93 wants to merge 4 commits into
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/198092
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 7 New Failures, 1 Cancelled Job, 3 Unclassified FailuresAs of commit c36b9fc with merge base 618de55 ( NEW FAILURES - The following jobs have failed:
UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
CANCELLED JOB - The following job was cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Sep 22, 2026
Closed
Closed
Closed
Closed
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
Contributor
Author
|
Abandoning this stack for now; it may be reopened later. |
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):
Problem. When a frame compiled into a
CompilePackagehitsrecompile_limit(or the accumulated cap),_compilelogs a warning, marks the frame run-only and returns, and the package never learns that anything happened. The variants captured so far are kept, so nothing on the entry is bypassed, and there is no field a caller can read to tell "this frame's capture is complete" from "this frame stopped capturing at the limit and the inputs past it will never be covered". A caller assembling an artifact from an explicit capture therefore cannot flag the gap, and a production job has notlparseartifact naming the frame either.Fix.
CompilePackagegains a runtime-only_truncated_framesset with atruncated_framesproperty (returned as a frozenset), acurrent_entryproperty exposing the entry thatcode_contextset, andmark_current_entry_truncated(), which records the current entry's code asco_name (filename:firstlineno). In_compile, right whereexceeds_recompile_limitfires and after the existing warning, the package (when one is set and inside itscode_context) is marked, and adynamo_cache_truncatedstructured-trace artifact is emitted with the limit type and the function's location sotlparseshows it. The test pins that the set is empty after the first variant, names exactly the frame after the second dtype, and that the entry keeps its one guarded code and is not bypassed.Summary. The record is deliberately not a bypass: the variants captured before the limit are valid, must stay installable, and for a cache a miss simply recompiles, so the entry's guarded codes and
bypassedflag are untouched and the new state lives beside them. It is also deliberately not serialized: it describes this capture session rather than the artifact, so it must not change whatinstall()serves, which is why it sits on the package and not on_DynamoCodeCacheEntry. The key is the code object's name plus file and first line rather than the bare name, so two frames that share aco_namestay two entries; the_summarizehelper intorch/_dynamo/precompile_package.pyalready takes atruncatedset in exactly this shape, and this commit supplies its producer. The set is a lower bound, because theRUN_ONLYstrategy that_compileinstalls for the limit is recursive: frames called beneath the truncated one also stop capturing, but they never re-enter Dynamo to report it, so only the frame that hit the limit is named. An alternative was to derive truncation from the entries the way commit 11 derives uncovered frames, but nothing on an entry distinguishes "stopped at the limit" from "every variant seen is covered", so the compile path has to record it at the one point that knows. Carved out of #195913.The frame that hit the limit is named, its captured variant stays
With
TORCH_TRACEset, the same run writes onedynamo_cache_truncatedartifact:Pinned by
test_truncated_frames_names_the_frame_that_hit_the_recompile_limitintest/dynamo/test_package.py. A third call after the limit runs the frame run-only and leaves the set unchanged, which is the lower-bound behaviour described above.Test Plan:
The new test fails on the parent (no
truncated_framesattribute) and passes here.Authored with an AI assistant.
Co-Authored-By: Claude Fable 5.1 [email protected]
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @chauhang @amjames @jataylo @azahed98