Skip to content

[dynamo] Reset a bypassed cache entry on load instead of growing it - #196756

Closed
bobrenjc93 wants to merge 8 commits into
gh/bobrenjc93/1160/basefrom
gh/bobrenjc93/1160/head
Closed

bobrenjc93 wants to merge 8 commits into
gh/bobrenjc93/1160/basefrom
gh/bobrenjc93/1160/head

Conversation

@bobrenjc93

@bobrenjc93 bobrenjc93 commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Follow-up to #196505, from its review. A resume frame whose backend artifact
is missing when the package is saved is written with bypassed=True by
PrecompileCacheEntry.from_cache_entry, and install() skips it, so the
next process traces that frame fresh:

def fn(x):
    y = x.sin()
    torch._dynamo.graph_break()          # a resume frame with its own backend
    return x.sin() + y

torch.compile(fn)(x)
del PrecompileContext._backend_artifacts_by_key[resume_backend_id]
save()                                   # resume entry written bypassed
# next process
torch.compile(fn)(x)                     # resume frame traced fresh
save()

That fresh compile appended its guarded code to the stale one the reload had
deserialized, cleared the flag, and re-registered a backend id next to the
missing one still listed first. The next save found the missing id again,
re-poisoned the entry and wrote the bigger one back over the same path, so the
entry never became installable and never stopped growing:

base:    guarded_codes 1 -> 1  backend_ids 1 -> 7   (33 KB -> 34 KB over six cycles)
#196505: guarded_codes 1 -> 7  backend_ids 1 -> 7   (33 KB -> 64 KB)

(Byte sizes from the reviewer's environment; the counts reproduce exactly.)

The backend-id half predates #196505 (OutputGraph registers the id whether
or not the entry is bypassed); the guarded-code half is new there, since
add_guarded_code now appends and clears the flag on such an entry.

CompilePackage.initialize now loads a bypassed entry without its guarded
codes and backend ids: the package's own map gets a dataclasses.replace copy,
and the caller's entry is untouched, since a store may hand out the object it
holds (InMemoryDynamoStore does); the containers the fresh compile writes to
(import_sources, function_names) are detached in the copy as well, since
dataclasses.replace is shallow. install() skips such an entry entirely,
so nothing on it was installable, every variant of that code object included
(from_cache_entry flags the whole entry on the first missing artifact); the
fresh compile's record is the whole entry and the next save writes an
installable one, so the third process hits without compiling anything. The reset lives on the load side rather than in the save-time writer
because for an entry already on disk in the stale state the writer cannot tell
the missing id from the fresh compile's id listed beside it, so a writer-side
clear would discard the fresh code too and converge one save later. The
better endpoint, not taken here, is a per-guarded-code prune at write time
(drop only the guarded codes whose bytecode names the missing backend), which
would keep a multi-variant entry installable and never write the stale bytes;
tracked in #196773.
The entry docstring says what the writer and the loader each do.

Two test cleanups from the same review: ConfigThatCannotPickle says why it
raises AttributeError specifically (the one exception the bypass mapped before
#196470 widened it), and the earlier-variant test pins that only the bypassed
inputs compiled after the reload. It counts counters["frames"]["total"]
rather than the FRAME_COUNTER bracket the file's other caching_precompile
tests use: reset() zeroes FRAME_COUNTER and installing a precompiled entry
consumes a compile id, so a + 1 there holds only by cancellation.

Test Plan:

python test/dynamo/test_package.py
python test/dynamo/test_package.py -k test_a_poisoned_entry_is_reset_on_load_instead_of_growing -k test_bypassed_guards_keep_the_frames_earlier_variant

The new test runs the cycle above through PrecompileContext and
DynamoCache: after the second save the resume entry has one guarded code and
one backend id and is not bypassed (on the previous commit it has two of each
and is bypassed again), and a third load serves both frames with
counters["frames"]["total"] unchanged under fail_on_recompile. It also
builds a CompilePackage from a loaded entry and checks the entry it was
given still holds its guarded code while the package's cache_entry() does
not.

Authored with an AI assistant.

🤖 Generated with Claude Code

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @chauhang @amjames @jataylo @azahed98

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ You can merge normally! (1 Unrelated Failure), 1 Unclassified Failure

As of commit 0baa088 with merge base 0929b23 (image):

GREEN LIGHT - PR approved to be merged without human review:

  • Correctness
    • install() hits continue at package.py:1320 for a bypassed entry, before the backend_ids loop (1323) and the guarded_codes-empty skip_code path (1338), so emptying both in the loaded copy changes nothing the installer observes
    • Reassigning self._codes[key] inside items() only replaces values, so insertion order holds and validate()'s next(iter(self._codes)) check at package.py:1235 still passes when the root entry is the bypassed one
    • save_cache_entry (package.py:1469-1474) raises on an unresolvable backend id, so dropping the stale missing id makes that path strictly less likely to fail
  • Preservation
    • dataclasses.replace keeps bypassed, has_compile_id, python_code and code_source, and detaches the two containers a fresh compile mutates via add_import_source (package.py:1208) and _add_function (1100), so a store-owned entry like InMemoryDynamoStore.read's (1561) is not damaged
    • Discarding every variant is bounded by from_cache_entry flagging the whole entry on the first missing artifact (package.py:903-904); the docstring at 565-575 states it and TODO(#196773) tracks the narrower write-time prune
  • Testing
    • test_a_poisoned_entry_is_reset_on_load_instead_of_growing (test/dynamo/test_package.py:955-1010) drives the full delete-artifact/save/reload cycle and pins one guarded code plus one backend id, not two of each
    • It also pins the copy semantics at :992-998 (caller's entry keeps its guarded code; import_sources and function_names are not shared) and a no-compile third load under fail_on_recompile
  • Scope
    • Two files: a 17-line block in CompilePackage.initialize plus a docstring, and test-only additions; no public API, CI, or release plumbing touched

reason: clean
Reviewed commit: 0baa088

Inference job

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:

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

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 Sep 11, 2026
@bobrenjc93

Copy link
Copy Markdown
Contributor Author

@claude

@claude

claude Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Claude finished @bobrenjc93's task in 20m 52s —— View job


PR Review: #196756

Two findings worth addressing before merge (one real correctness edge, one unreadable comment); the core fix and the new regression test look sound to me.

Full review

Summary

CompilePackage.initialize now clears a loaded bypassed entry's guarded_codes and backend_ids so the reload/save cycle stops re-poisoning and growing the entry. The fix matches the diagnosis, and the new test pins both halves (one guarded code + one backend id, and a no-compile third load). Two issues: the clear mutates a caller-owned object in place, which is destructive for InMemoryDynamoStore, and the new comment at package.py:1032-1038 is not parseable.

Code Quality

  • torch/_dynamo/package.py:1030-1040 — the clear mutates the _DynamoCacheEntry the caller still holds. DynamoStore.load_package (line 1512) and DiskDynamoCache.load_and_install_package (line 1654) pass the entry straight from read(). DiskDynamoStore.read unpickles fresh each call (line 1606) so the disk path is fine, but InMemoryDynamoStore.read returns self.packages[path] itself (line 1544) with no copy, so initialize destructively empties the stored entry: a second load_package on the same key, or any later inspection of that stored entry, sees emptied lists. InMemoryDynamoStore currently has no in-tree users, so this is latent rather than live — but it's a load-time API silently consuming its input. Prefer clearing on the package's own copies rather than the incoming entry: build self._codes first (as the diff already does), then iterate self._codes.values() and replace the affected entries with dataclasses.replace(code, guarded_codes=[], backend_ids=[]) so the caller's entry is untouched. That also removes the second pass over dynamo.codes, which currently re-walks a list the loop above just consumed.

  • torch/_dynamo/package.py:1032-1034 — the comment does not parse: "and the fresh compile install() leaves the frame to would otherwise append its guarded code..." The relative clause is missing its object (the frame install() leaves to be traced fresh). Suggested rewrite, keeping the same content:

    # Nothing on a bypassed entry is installable. install() leaves the
    # frame to be traced fresh, and that compile would otherwise append
    # its guarded code to the stale ones and re-register the backend id
    # the save found missing, so every reload/save cycle re-poisoned the
    # entry and grew it. Start clean: the fresh compile's record is the
    # whole entry, and the next save writes an installable one.
    

    Fix this →

Testing

  • test/dynamo/test_package.py:971 and :980 — the resume frame is identified with "resume" in name. torch/_dynamo/resume_execution.py:61 exports TORCH_DYNAMO_RESUME_IN_PREFIX; use name.startswith(TORCH_DYNAMO_RESUME_IN_PREFIX) so the test can't accidentally match a user function whose qualname happens to contain "resume" (fn here is fine, but the helper is written as if it were general, and it's asserted to select exactly one entry via tuple unpacking).

  • test/dynamo/test_package.py:975-985 — the assertions run through DynamoCache.load(fn) on disk, which is the only path immune to the aliasing above. Worth also asserting the input entry is unchanged after a load (i.e. that initialize didn't consume it), which is what pins the first finding.

Backward Compatibility

  • Not a break for on-disk entries written by older versions: the flag is already persisted and older readers just ignored it, so a mixed-version reader sees the pre-PR growth behavior rather than a failure.
  • One semantic consequence worth stating in the docstring: from_cache_entry (package.py:873-893) sets bypassed on the whole code entry as soon as one backend_id is missing, then breaks. Combined with this PR, a single missing artifact now permanently discards every compiled variant of that code object rather than merely skipping them for one load. That is the right call given install() already continues past the entry (line 1300-1303) so none of them were usable anyway — but the docstring at package.py:557-564 says "drops such an entry's stale guarded codes" without noting that this can be more than one variant's worth. One clause there would save the next reader the trace through from_cache_entry.

Recommendation

Request Changes

The comment at package.py:1032-1034 is unreadable as written and the in-place mutation of a caller-owned entry should be avoided while the code is being touched anyway. Neither is deep; the underlying fix and its test are correct.

· branch `gh/bobrenjc93/1160/head`

@bobrenjc93 bobrenjc93 added the topic: not user facing topic category label Sep 11, 2026
bobrenjc93 added a commit that referenced this pull request Sep 11, 2026
Follow-up to #196505, from its review. A resume frame whose backend artifact
is missing when the package is saved is written with `bypassed=True` by
`PrecompileCacheEntry.from_cache_entry`, and `install()` skips it, so the
next process traces that frame fresh:

```python
def fn(x):
    y = x.sin()
    torch._dynamo.graph_break()          # a resume frame with its own backend
    return x.sin() + y

torch.compile(fn)(x)
del PrecompileContext._backend_artifacts_by_key[resume_backend_id]
save()                                   # resume entry written bypassed
# next process
torch.compile(fn)(x)                     # resume frame traced fresh
save()
```

That fresh compile appended its guarded code to the stale one the reload had
deserialized, cleared the flag, and re-registered a backend id next to the
missing one still listed first. The next save found the missing id again,
re-poisoned the entry and wrote the bigger one back over the same path, so the
entry never became installable and never stopped growing:

```
base:    guarded_codes 1 -> 1  backend_ids 1 -> 7   (33 KB -> 34 KB over six cycles)
#196505: guarded_codes 1 -> 7  backend_ids 1 -> 7   (33 KB -> 64 KB)
```

(Byte sizes from the reviewer's environment; the counts reproduce exactly.)

The backend-id half predates #196505 (`OutputGraph` registers the id whether
or not the entry is bypassed); the guarded-code half is new there, since
`add_guarded_code` now appends and clears the flag on such an entry.

`CompilePackage.initialize` now drops a loaded bypassed entry's guarded codes
and backend ids. `install()` skips such an entry entirely, so nothing on it was
installable; the fresh compile's record is the whole entry and the next save
writes an installable one, so the third process hits without compiling
anything. The reset lives on the load side rather than in the save-time writer
because for an entry already on disk in the stale state the writer cannot tell
the missing id from the fresh compile's id listed beside it, so a writer-side
clear would discard the fresh code too and converge one save later. The
better endpoint, not taken here, is a per-guarded-code prune at write time
(drop only the guarded codes whose bytecode names the missing backend), which
would keep a multi-variant entry installable and never write the stale bytes.
The entry docstring says what the writer and the loader each do.

Two test cleanups from the same review: `ConfigThatCannotPickle` says why it
raises AttributeError specifically (the one exception the bypass mapped before
#196470 widened it), and the earlier-variant test pins that only the bypassed
inputs compiled after the reload. It counts `counters["frames"]["total"]`
rather than the `FRAME_COUNTER` bracket the file's other caching_precompile
tests use: `reset()` zeroes `FRAME_COUNTER` and installing a precompiled entry
consumes a compile id, so a `+ 1` there holds only by cancellation.

Test Plan:

```
python test/dynamo/test_package.py
python test/dynamo/test_package.py -k test_a_poisoned_entry_is_reset_on_load_instead_of_growing -k test_bypassed_guards_keep_the_frames_earlier_variant
```

The new test runs the cycle above through `PrecompileContext` and
`DynamoCache`: after the second save the resume entry has one guarded code and
one backend id and is not bypassed (on the previous commit it has two of each
and is bypassed again), and a third load serves both frames with
`counters["frames"]["total"]` unchanged under `fail_on_recompile`.

Authored with an AI assistant.

ghstack-source-id: cb4fb06
Pull-Request: #196756
…, docstring, test asserts the input entry is untouched

[ghstack-poisoned]
@bobrenjc93

Copy link
Copy Markdown
Contributor Author

@claude

bobrenjc93 added a commit that referenced this pull request Sep 11, 2026
Follow-up to #196505, from its review. A resume frame whose backend artifact
is missing when the package is saved is written with `bypassed=True` by
`PrecompileCacheEntry.from_cache_entry`, and `install()` skips it, so the
next process traces that frame fresh:

```python
def fn(x):
    y = x.sin()
    torch._dynamo.graph_break()          # a resume frame with its own backend
    return x.sin() + y

torch.compile(fn)(x)
del PrecompileContext._backend_artifacts_by_key[resume_backend_id]
save()                                   # resume entry written bypassed
# next process
torch.compile(fn)(x)                     # resume frame traced fresh
save()
```

That fresh compile appended its guarded code to the stale one the reload had
deserialized, cleared the flag, and re-registered a backend id next to the
missing one still listed first. The next save found the missing id again,
re-poisoned the entry and wrote the bigger one back over the same path, so the
entry never became installable and never stopped growing:

```
base:    guarded_codes 1 -> 1  backend_ids 1 -> 7   (33 KB -> 34 KB over six cycles)
#196505: guarded_codes 1 -> 7  backend_ids 1 -> 7   (33 KB -> 64 KB)
```

(Byte sizes from the reviewer's environment; the counts reproduce exactly.)

The backend-id half predates #196505 (`OutputGraph` registers the id whether
or not the entry is bypassed); the guarded-code half is new there, since
`add_guarded_code` now appends and clears the flag on such an entry.

`CompilePackage.initialize` now loads a bypassed entry without its guarded
codes and backend ids: the package's own map gets a `dataclasses.replace` copy,
and the caller's entry is untouched, since a store may hand out the object it
holds (`InMemoryDynamoStore` does). `install()` skips such an entry entirely,
so nothing on it was installable, every variant of that code object included
(`from_cache_entry` flags the whole entry on the first missing artifact); the
fresh compile's record is the whole entry and the next save writes an
installable one, so the third process hits without compiling anything. The reset lives on the load side rather than in the save-time writer
because for an entry already on disk in the stale state the writer cannot tell
the missing id from the fresh compile's id listed beside it, so a writer-side
clear would discard the fresh code too and converge one save later. The
better endpoint, not taken here, is a per-guarded-code prune at write time
(drop only the guarded codes whose bytecode names the missing backend), which
would keep a multi-variant entry installable and never write the stale bytes.
The entry docstring says what the writer and the loader each do.

Two test cleanups from the same review: `ConfigThatCannotPickle` says why it
raises AttributeError specifically (the one exception the bypass mapped before
#196470 widened it), and the earlier-variant test pins that only the bypassed
inputs compiled after the reload. It counts `counters["frames"]["total"]`
rather than the `FRAME_COUNTER` bracket the file's other caching_precompile
tests use: `reset()` zeroes `FRAME_COUNTER` and installing a precompiled entry
consumes a compile id, so a `+ 1` there holds only by cancellation.

Test Plan:

```
python test/dynamo/test_package.py
python test/dynamo/test_package.py -k test_a_poisoned_entry_is_reset_on_load_instead_of_growing -k test_bypassed_guards_keep_the_frames_earlier_variant
```

The new test runs the cycle above through `PrecompileContext` and
`DynamoCache`: after the second save the resume entry has one guarded code and
one backend id and is not bypassed (on the previous commit it has two of each
and is bypassed again), and a third load serves both frames with
`counters["frames"]["total"]` unchanged under `fail_on_recompile`. It also
builds a `CompilePackage` from a loaded entry and checks the entry it was
given still holds its guarded code while the package's `cache_entry()` does
not.

Authored with an AI assistant.

ghstack-source-id: 51ea561
Pull-Request: #196756
@claude

claude Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Claude finished @bobrenjc93's task in 20m 35s —— View job


Re-reviewed after the two fold commits: both findings from the previous round are addressed, and the one thing left is that dataclasses.replace is a shallow copy, so the "caller's entry is untouched" contract the new comment states isn't fully delivered.

Full review

PR Review: #196756

Summary

CompilePackage.initialize now installs a dataclasses.replace copy of a loaded bypassed _DynamoCodeCacheEntry with guarded_codes and backend_ids emptied, so the reload/save cycle stops re-poisoning and growing the entry. The previous round's two findings are folded (package.py:1039 copies instead of clearing; the comment at 1033-1038 and the docstring at 557-565 now parse and state both halves of the contract; test_package.py:992 pins that the input entry keeps its guarded code). One finding remains, on the depth of that copy.

I verified separately that the reassign-during-items()-iteration is safe and order-preserving (so validate()'s "main entry is first" check at package.py:1219 and the main, *codes unpack at 1027 still hold even when the root entry is the bypassed one), and that install()'s continue at 1301-1304 returns before the skip_code path at 1322, so an emptied guarded_codes is never observed by the installer.

Code Quality

  • torch/_dynamo/package.py:1039-1041 — the comment above this claims the copy exists so that "the caller's entry may be a store's own object (InMemoryDynamoStore hands out what it holds)" is not damaged, but dataclasses.replace is shallow: the new entry still shares the same function_names list and import_sources dict objects with the caller's entry (_DynamoCodeCacheEntry fields at 570/572). That sharing is reachable on exactly the path this PR creates. install() installs a bypassed entry's globals (1273-1297) before the continue at 1301, so the resume function is in globals and the frame is traced fresh against the deserialized code object — which is the dict key — so code_context (1109) sets _current_entry to the copy, and add_import_source (1192) then writes into the shared import_sources dict. Any alias that fresh trace needs (symbolic_convert.py:2431) therefore lands on the store's entry.

    Impact is small — import_sources is a union that install() just re-imports, and DiskDynamoStore.read (1599) unpickles fresh so the default DynamoCache path is unaffected — but it's the one store the comment names that is affected, and the fix is one line: extend the replace to function_names=list(code.function_names), import_sources=dict(code.import_sources). If you'd rather not deepen the copy, narrow the comment to say which fields are detached, since as written it reads as a whole-object guarantee. Either way the assertion at test/dynamo/test_package.py:992 should cover whichever fields the contract claims, not just guarded_codes — right now nothing pins the shared ones.

    Fix this →

  • torch/_dynamo/package.py:557-565 — the docstring and the PR description both name the better endpoint (a per-guarded-code prune at write time, dropping only the guarded codes whose bytecode names the missing backend) but nothing in-tree points at it. Since the load-side reset permanently discards the bytes for every variant of that code object as soon as one artifact is missing — installability is unchanged, since install() already skipped them all, but the good variants were previously still on disk and recoverable by a smarter reader — leave a TODO with an issue number here so the narrower fix isn't lost.

Recommendation

Approve

The diagnosis, the fix, and the regression test are correct, and the earlier findings are folded. The remaining item is a one-line copy-depth (or comment-scope) correction plus the matching assertion; worth doing before merge but it doesn't put the change at risk.

· branch `gh/bobrenjc93/1160/head`

@bobrenjc93
bobrenjc93 requested a review from aorenste September 12, 2026 03:10
@bobrenjc93
bobrenjc93 marked this pull request as ready for review September 12, 2026 03:11
@bobrenjc93

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 2 checks: Check mergeability of ghstack PR / ghstack-mergeability-check, inductor / unit-test / inductor-cpu-test / test (inductor_aoti_fallback, 2, 2, mt-l-x86iamx-8-64, unstable)

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

pytorchmergebot pushed a commit that referenced this pull request Sep 12, 2026
…y, pin the dict-served case (#196764)

Follow-up to the reviews of #196473 and #196474.

`_reduce_bound_method` read `func.__name__` before its `try`. `getattr` with a
default swallows only AttributeError, and `__func__` is an arbitrary callable
by the reducer's own premise, so a proxy that raises anything else escaped the
reducer while the receiver-side probe two lines down was already guarded:

```python
class ProxyFunc:
    def __getattr__(self, name):
        raise RuntimeError(f"proxy has no {name}")

pickler._reduce_bound_method(types.MethodType(ProxyFunc(), Plain()))
# before: RuntimeError: proxy has no __name__
# now:    (_unpickle_bound_method, (ProxyFunc(), Plain()))
```

The read moves inside the `try`, after the `__getattr__` gate (which takes the
pair without probing `func` at all), where `explicit` is already built for the
`except` to return.

The `__dict__` half of the per-instance condition had no test: `SlottedByName`
has no instance dict, so the slot test lands on the `getattr_static` half, and
ablating the `__dict__` clause left the suite green while the shape it exists
for broke at load:

```python
obj = Plain()
obj.global_add = types.MethodType(global_add, obj)
# with the clause:    loads back as MethodType(global_add, Plain)
# without the clause: AttributeError: 'Plain' object has no attribute 'global_add'
```

Pinned now, and the comment says which receivers reach that clause: one that
HAS an instance dict, which a pure-slots receiver does not (a slotted subclass
of a non-slotted base has both, and either clause gives the same answer), and a
class defining `__getattr__` (every nn.Module) takes the pair before it either
way.

Two tests from #196474 were not pinning what they said. The shared-closure-cell
test used a `<locals>` pair, whose branch returns before the `guard_tree_values`
gate, so the dict it built was inert and the test passed on the parent; it now
uses two module-level `functools.wraps` wrappers sharing one cell, which only
the gate carries. The module-method test's comment described the `<locals>`
rebuild bug from the commit that fixed it; the comment is gone and the test
asserts the rebuilt function's `__name__` is `forward`, which is a record of
what the rebuild carries rather than a regression guard (the name path is
pinned by `test_rebuilt_locals_function_keeps_its_name`), so the comment now
points at the call as the assertion that catches the placeholder.

Type nits from the same reviews: `object` instead of `Any` for the resolution
walk and both rebuilt scopes; the bound-method reducer returns its real shape,
`tuple[Callable[..., Any], tuple[Any, ...]] | None`; the state tuple stays
`Any`, since its elements are assigned to typed function slots and the checker
rejects `object` there.

One #196474 comment is not a code change here: at that commit the by-value
payload carried every closure cell and default unconditionally, so a `wraps`
wrapper capturing a lock no guard read failed the dump. #196476, two commits
above it, prunes each cell and default through the same `guard_tree_values`
test, and that is where the prune lives in this stack.

Test Plan:

```
python test/dynamo/test_guard_serialization.py
python test/dynamo/test_guard_serialization.py -k bound_method -k shared_closure_cell
python test/dynamo/test_aot_compile.py -k Pickler
```

The proxy test fails on the previous commit with the RuntimeError above. Its
second case pins the ORDERING rather than the `try`: the receiver is a proxy
whose class defines `__getattr__`, so the gate takes the pair and the name is
never asked for, which the fixture records; moving the read back above the gate
fails that assertion while the rest of the test stays green. The
monkeypatched-method test fails against the `__dict__` clause ablated. The
shared-cell test fails when the fqn-mismatched pair is not in
`guard_tree_values` (both prune to `_Missing`), which the old `<locals>` pair
could not show.

Authored with an AI assistant.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull Request resolved: #196764
Approved by: https://github.com/pytorchgreenlight
ghstack dependencies: #196683, #196684, #196685, #196686, #196687, #196688, #196691, #196692, #196693, #196756
@github-actions
github-actions Bot deleted the gh/bobrenjc93/1160/head branch November 19, 2026 01:43
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 Merged module: dynamo topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants