Skip to content

[precompile] Say what an installed artifact actually does when a guard misses - #194450

Closed
bobrenjc93 wants to merge 2 commits into
gh/bobrenjc93/1037/basefrom
gh/bobrenjc93/1037/head
Closed

bobrenjc93 wants to merge 2 commits into
gh/bobrenjc93/1037/basefrom
gh/bobrenjc93/1037/head

Conversation

@bobrenjc93

@bobrenjc93 bobrenjc93 commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

An installed artifact answers a guard miss by COMPILING a fresh graph, not by
refusing. That is deliberate and necessary -- a frame reachable only through the
frame evaluator has no other way to run, and a large model has plenty of them --
but it was invisible in three ways at once.

The artifact's own generated banner said the opposite. It was emitted for both
serving modes and described only the standalone one: "Nothing is installed onto
your code objects and no frame evaluator is involved" and "a call no captured
variant covers RAISES rather than compiling a new one". Both false for
SERVING_MODE="installed", on that artifact's own front page. It is now split per
mode and the installed text says what installed does.

Nothing was logged. And because serving wires the package through
torch._dynamo.optimize(..., isolate_recompiles=True), the artifact has a private
cache identity, so TORCH_LOGS=recompiles prints nothing either. A user watching
an artifact quietly serve less of itself on every batch saw exactly what a
healthy one looks like. There is now a warning at the single choke point every
serve-time compile passes through.

And there was nothing to measure. serve_time_compiles() on the loaded object
returns the count, which is the number to gate a job on: zero means the artifact
covered every call it saw. This matters more than it sounds for the change below
it in the stack -- protecting TYPE_MATCH turns a silent wrong answer into a
guard miss, and in installed mode a guard miss is a silent RECOMPILE returning
the right answer. Strictly safer and completely invisible without this.

Test Plan:

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

The new test asserts all three: the banner no longer makes the standalone claim,
serving a covered call leaves the count at zero, and serving an uncovered one
raises it.

Authored with an AI assistant.

Differential Revision: D117073081

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Aug 22, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 14 New Failures, 1 Unrelated Failure

As of commit b43d795 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 22, 2026
This was referenced Aug 22, 2026
@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.

This was referenced Aug 23, 2026
[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/1037/head branch November 11, 2026 01:45
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