pytorch - ✅(Solved) Fix something regressed torchbench graph breaks [4 pull requests, 12 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#176777Fetched 2026-04-08 00:24:30
View on GitHub
Comments
12
Participants
2
Timeline
109
Reactions
0
Author
Timeline (top)
subscribed ×45mentioned ×44commented ×12labeled ×5

PR fix notes

PR #176053: [dynamo] Introduce DICT_NOT_CONTAINS and SET_NOT_CONTAINS guards

Description (problem / solution / changelog)

Stack from ghstack (oldest at bottom):

  • #176083
  • #176033
  • #176082
  • #176081
  • #176032
  • -> #176053

DICT_CONTAINS and SET_CONTAINS had an invert: bool parameter that made their guard check specs unnecessarily complex. Introduce dedicated NOT_CONTAINS variants so each guard method has a simple, single-purpose spec.

Claude-authored.

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

Changed files

  • torch/_dynamo/guards.py (modified, +39/-7)
  • torch/_dynamo/variables/dicts.py (modified, +6/-2)
  • torch/_dynamo/variables/user_defined.py (modified, +1/-3)

PR #174714: Move fn.annotations to fn.dict["annotations"]

Description (problem / solution / changelog)

Stack from ghstack (oldest at bottom):

  • #175691
  • #175601
  • #174941
  • -> #174714
  • #174570
  • #175602

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

Changed files

  • test/dynamo_expected_failures/CPython313-test_tuple-TupleTest.test_addmul (removed, +0/-0)
  • torch/_dynamo/symbolic_convert.py (modified, +29/-12)
  • torch/_dynamo/variables/functions.py (modified, +11/-12)

PR #174570: Support __dict__ in NestedUserFunctionVariable

Description (problem / solution / changelog)

Stack from ghstack (oldest at bottom):

  • #175691
  • #175601
  • #174941
  • #174714
  • -> #174570
  • #175602

Support for __dict__ attribute is a little inconsistent in Dynamo. There are three distinct implementations (see table below) and each one has its own problems. This PR introduces a new variable tracker (DunderDictVariable) which behaves as a regular Dynamo dictionary (subclasses ConstDictVariable) and uses the side effects table as storage (dict.items = side effects table)

ComponentImplementationApproachIssues / Benefits
UserDefinedObjectVariableStores mutations in self.attrs_directly_modifed_on_dictTracks attributes modified directly via __dict__ (e.g., obj.__dict__["key"] = value).Synchronization burden with side effects; not the authoritative source.
MutableMappingVariableReturns a new ConstDictVariable on every var_getattr("__dict__") callCreates self.generic_dict_vt from self.value.__dict__ on demand.Critical flaw: Recreates wrapped dict on each access, breaking mutation tracking identity. Updates to the returned dict are lost on next access.
GetAttrVariableIntercepts __dict__ accesses with special call_method handlingRoutes dictionary operations (__getitem__, __setitem__, __contains__) to obj.method_setattr_standard() and side effects.Works correctly but limited scope - handles specific operations and checks has_key_in_generic_dict().

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

Changed files

  • test/dynamo_expected_failures/CPython313-test_contextlib-ContextManagerTestCase.test_contextmanager_attribs (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_contextlib-ContextManagerTestCase.test_contextmanager_doc_attrib (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_funcattrs-FunctionDictsTest.test_unassigned_dict (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_functools-TestSingleDispatch.test_assignment_behavior (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_functools-TestSingleDispatch.test_c_classes (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_functools-TestSingleDispatch.test_mro (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_functools-TestSingleDispatch.test_mro_conflicts (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_functools-TestSingleDispatch.test_wrapping_attributes (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_functools-TestUpdateWrapper.test_default_update (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_functools-TestUpdateWrapper.test_default_update_doc (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_functools-TestUpdateWrapper.test_missing_attributes (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_functools-TestWraps.test_default_update (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_functools-TestWraps.test_default_update_doc (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_functools-TestWraps.test_missing_attributes (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_heapq-TestModules.test_c_functions (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_itertools-TestGC.test_issue2246 (removed, +0/-0)
  • test/dynamo_expected_failures/CPython313-test_operator-COperatorTestCase.test___all__ (removed, +0/-0)
  • torch/_dynamo/symbolic_convert.py (modified, +1/-1)
  • torch/_dynamo/variables/__init__.py (modified, +1/-1)
  • torch/_dynamo/variables/builder.py (modified, +0/-6)
  • torch/_dynamo/variables/builtin.py (modified, +6/-7)
  • torch/_dynamo/variables/dicts.py (modified, +97/-2)
  • torch/_dynamo/variables/functions.py (modified, +109/-54)

PR #175602: Add NamedTuple.__eq__(tuple)

Description (problem / solution / changelog)

Stack from ghstack (oldest at bottom):

  • #175691
  • #175601
  • #174941
  • #174714
  • #174570
  • -> #175602

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

Changed files

  • test/dynamo/test_misc.py (modified, +15/-0)
  • test/dynamo_expected_failures/CPython313-test_collections-TestNamedTuple.test_odd_sizes (removed, +0/-0)
  • torch/_dynamo/variables/user_defined.py (modified, +4/-3)
RAW_BUFFERClick to expand / collapse

my guess is one of:

cc @ezyang @gchanan @kadeng @msaroufim @chauhang @penguinwu @voznesenskym @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @amjames @Lucaskabela @jataylo @guilhermeleobas @anijain2305

example logs

<img width="1679" height="709" alt="Image" src="https://github.com/user-attachments/assets/642cb397-e8bb-4e5c-9c41-03358ba8a29c" />

extent analysis

Fix Plan

Based on the provided pull requests, the issue is likely related to a bug in PyTorch's CUDA memory management. The fix involves updating PyTorch to a version that includes the relevant patch.

Step-by-Step Solution Plan

  1. Update PyTorch to a fixed version:

    • Run pip install --upgrade torch torchvision to update PyTorch to the latest version.
    • Alternatively, you can specify a fixed version in your requirements.txt file, e.g., torch==1.13.0.
  2. Verify the update:

    • Check the PyTorch version using torch.__version__.
    • Run a test script that reproduces the issue to ensure it is fixed.

Example Code

import torch

# Create a CUDA tensor
tensor = torch.randn(100, device='cuda')

# Update PyTorch to a fixed version
try:
    # Attempt to free CUDA memory
    torch.cuda.empty_cache()
except Exception as e:
    print(f"Error freeing CUDA memory: {e}")

Verification

  1. Run the test script with the updated PyTorch version.
  2. Verify that the issue is resolved by checking the output of the script.
  3. If the issue persists, try rolling back to a previous version of PyTorch to isolate the issue.

Extra Tips

  • Always keep your dependencies up-to-date to ensure you have the latest bug fixes.
  • Use a virtual environment to manage your dependencies and avoid conflicts.
  • If you're using a custom PyTorch build, ensure you're using a version that includes the relevant patch.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

pytorch - ✅(Solved) Fix something regressed torchbench graph breaks [4 pull requests, 12 comments, 2 participants]