RepoJournal
PyTorch

@pytorch

PyTorch and the broader machine-learning ecosystem

Pick a date

The Wire · Showcase

DYNAMO FIXES ITERATOR CORRUPTION AND FAKE INT ARITHMETIC

By RepoJournal · Filed · About PyTorch

Guilherme Leobas Ryan Zhang Bob Ren Huy Do norx1991 sdmyzlp pianpwk
7 people shipped this

Dynamo's deque iteration was silently failing to detect mutations and reversing into the wrong iterator type, while custom hash functions using id() arithmetic crashed the compiler.

The Dynamo team shipped two critical fixes that unlock use cases currently broken in graph capture. First, deque iteration now properly mirrors CPython's _collectionsmodule.c behavior by carrying state to detect mutation during iteration, and reversed(deque) now returns the correct deque_reverse_iterator instead of falling through to list_iterator [1]. Second, a custom __hash__ that does integer arithmetic on id(self) (e.g., `int(id(self) & 0x7fffffff)`) no longer crashes with spurious type errors by teaching FakeIdVariable to support bitwise operations on sourceless compile-time-only fake integers [2]. On the Inductor side, the team replaced loose plumbing tuples with typed dataclasses and Protocols, so shapes are now documented at definition and checked by the type checker rather than reconstructed by hand at each call site [4]. Kineto submodule got four commits addressing leaking file descriptors, CPU-to-GPU flow link correctness, and async profiler coverage [3], while the team stripped inert arc tokens from CI workflow checks following the determinator refactor .

Action items

References

  1. [1] [dynamo] Model deque iterators with mutation-during-iteration detection (#189052) pytorch/pytorch
  2. [2] [dynamo] Support integer arithmetic on a sourceless id()/hash() FakeIdVariable (#189053) pytorch/pytorch
  3. [3] Update third_party/kineto submodule to d1b7cab (#189542) pytorch/pytorch
  4. [4] [inductor] Replace ExternKernel/ComputedBuffer plumbing tuples with dataclasses + Protocol (#189258) pytorch/pytorch
  5. [5] Unify CosSinRoPE and ComplexRoPE YaRN computation (#3787) pytorch/torchtitan

More from @pytorch

Daily updates, in your inbox

Follow PyTorch

PyTorch and the broader machine-learning ecosystem We'll email you a link to confirm first.

Free. Confirm via email. Unsubscribe in one click.

— or follow the whole beat:

Elsewhere on the wire