Skip to content

[precompile] Give an installed entry back the defaults its code object lost - #194949

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

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

Conversation

@bobrenjc93

@bobrenjc93 bobrenjc93 commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

An installed artifact rebuilds its entry from that entry's code object, and a
code object carries neither default arguments nor closure cell values. The
standalone driver takes both back from _ENTRY_BINDING, which capture records for
exactly this reason; the installing driver built a bare FunctionType and dropped
them. A defaulted parameter is then simply absent at the served call, so the
guard written against it has nothing to bind and every variant misses.

The defaults fill in the standalone driver's own dispatch was anchored at
len(args), but defaults aligns with the LAST len(defaults) parameters. For
def f(a, b=1, c=2) called as f(x, y), that bound c to b's default. Anchored at
the tail instead.

_rebuild_cell goes with it: the sibling call site already uses types.CellType,
which is public, so the throwaway-closure trick and its "Python exposes no
public cell constructor" comment were both stale and unreached.

Test Plan:

python test/test_precompile.py

test_precompile_installed_entry_keeps_its_defaults asserts the capture lands in
the installed serving mode and then calls the artifact without the defaulted
argument. 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/194949

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

❌ 15 New Failures, 1 Unclassified Failure

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

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:

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/1071/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