Skip to content

[precompile] Let a served frame's user globals win over the artifact's own - #194950

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

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

Conversation

@bobrenjc93

@bobrenjc93 bobrenjc93 commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

The multi-graph driver bound every frame to globals() -- the artifact module's
live dict -- and seeded the user's module globals into it with setdefault. The
rendered backend source is exec'd into that same module and brings its own
module-level names with it, so any collision resolved in the artifact's favour.
A frame reading a user global of that name got the artifact's value, while its
guards had been written against the user's, and every variant missed.

Seeding a copy instead separates the two. The rendered kernels keep resolving
through the real module dict via their own globals, so nothing moves out
from under them, and the artifact's own bindings -- backend ids, import aliases,
resume dispatchers -- are applied after the seed and still win. Among several
user modules the first frame's still wins, which is the flattening this one
namespace has always done.

Test Plan:

python test/test_precompile.py

test_precompile_user_global_wins_over_the_artifacts_own captures an entry
reading a module-level global whose name the artifact also binds. It fails on
the unfixed driver with "no captured variant matches this call".

Authored with the assistance of an AI coding agent.

[ghstack-poisoned]
@bobrenjc93 bobrenjc93 added ciflow/trunk Trigger trunk jobs on your pull request topic: not user facing topic category labels Aug 26, 2026
@pytorch-bot

pytorch-bot Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 22 New Failures

As of commit 0809c95 with merge base 1b4e490 (image):

NEW FAILURES - The following jobs have failed:

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

This was referenced Aug 25, 2026
This was referenced Aug 26, 2026
[ghstack-poisoned]
@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/1072/head branch November 11, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant