The Wire · Showcase
DYNAMO FIXES ITERATOR CORRUPTION AND FAKE INT ARITHMETIC
By RepoJournal · Filed · About PyTorch
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
- → Review Dynamo deque/reverse iterator behavior if your graphs use collections.deque pytorch/pytorch [plan]
- → Test custom hash functions with id() arithmetic against latest Dynamo pytorch/pytorch [plan]
- → Monitor torchtitan RoPE unification for YaRN context-length extension parity [ref:9] pytorch/torchtitan [monitor]
References
- [1] [dynamo] Model deque iterators with mutation-during-iteration detection (#189052) pytorch/pytorch
- [2] [dynamo] Support integer arithmetic on a sourceless id()/hash() FakeIdVariable (#189053) pytorch/pytorch
- [3] Update third_party/kineto submodule to d1b7cab (#189542) pytorch/pytorch
- [4] [inductor] Replace ExternKernel/ComputedBuffer plumbing tuples with dataclasses + Protocol (#189258) pytorch/pytorch
- [5] Unify CosSinRoPE and ComplexRoPE YaRN computation (#3787) pytorch/torchtitan