Repository navigation
[precompile] Prepare an installed artifact at load, and let install consume it - #194394
Closed
bobrenjc93 wants to merge 2 commits into
Closed
bobrenjc93 wants to merge 2 commits into
bobrenjc93 wants to merge 2 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/194394
Note: Links to docs will display an error until the docs builds have been completed. ❌ 12 New Failures, 1 Unrelated FailureAs of commit 8166667 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. |
This was referenced Aug 21, 2026
Closed
Closed
This was referenced Aug 22, 2026
Closed
This was referenced Aug 28, 2026
Contributor
Author
|
@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
1 similar comment
Contributor
Author
|
@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Contributor
Author
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):
An installed artifact defers its mutation to the first served call, which is
right -- the mutation should be attributable to a point in the caller's control
flow, not to the act of loading. Every way an artifact can be wrong for the host
it landed on was deferred with it, so the failure arrived several batches into a
training loop with a traceback whose top frame was
_ensure.The commit that first addressed this ran the pure half at load and threw the
result away, which paid for it twice and left backend deserialization -- the
dominant cost for inductor, and the failure
install()'s own rollback commentanticipates -- still on the first call.
Split it properly.
CompilePackage.prepare()deserializes the backends andbuilds the guard trees;
install()consumes what it left rather than redoingit. Nothing prepare does touches the interpreter: a guard manager reads its
example values from the state it was pickled with and only STORES the runtime
scope, so bindings install() adds afterwards to that same dict are still seen at
check time.
The prebuilt managers are keyed by the code object
install()itself resolves,not by the one prepare resolved.
_lookup_coderesolves a frame by name andinstall binds globals as it goes, so the two could in principle disagree; keying
on install's answer means a disagreement falls back to building rather than
serving a stale tree.
_servegrows an optional prepared package. An artifact emitted before thatstill serves -- its frozen driver takes one argument, and the signature is
checked -- it simply rebuilds what prepare already built.
Measured on an 8-block graph-breaking model: 3 guard trees built at load and
ZERO at the first call, against 3 and 3 before; first call 0.0045s to 0.0030s.
Deletes
validate_cache_entryand_InstalledArtifact._validate.Test Plan:
test_aot_compile.py has 3 pre-existing failures in this environment
(test_aot_compile_with_aoti*,
fatal error: cuda.h).The new test counts guard-tree builds either side of the first call and asserts
the second count is zero, which is the only thing that distinguishes this from
the throwaway version it replaces.
Authored with an AI assistant.
Differential Revision: D116962606