The Wire · Showcase
TORCH.COMPILE GAINS PYTHON COMPARISON OPERATORS, TESTS GO DEVICE-AGNOSTIC ACROSS THREE REPOS
By RepoJournal · Filed · About PyTorch
Dynamo now handles Python's richcompare protocol, closing a critical gap in torch.compile's operator support while the ecosystem pivots hard toward device-generic testing.
The biggest move overnight: PyTorch core shipped richcompare support [1] by implementing CPython's full do_richcompare dispatch on VariableTracker, meaning torch.compile can now handle all comparison operators the way Python does. This fixes a class of compile failures that hit when models use comparison chains or custom __eq__ implementations.
In parallel, the test infrastructure is reshaping around device generics. TestFP8Matmul [2] got device-agnostic by replacing 37 hardcoded cuda references with a device parameter, and test_modes.py [3] ditched GPU_TYPE constants for torch.accelerator APIs. This matters: out-of-tree accelerators can now run quantization and dynamo tests without forking test files. ExecutorTorch's NXP backend [6] is already moving in lockstep with Neutron MLIR flow tests for tensor ops.
Two infrastructure cleanups landed: dead THNN/UCC/TH CMake references [4] got removed, and graph partition buffer signatures [5] now preserve globals correctly. The ao repo [7] added a defensive check to skip PT2E inductor registration when mkldnn isn't available, preventing silent failures on CPU builds.
Action items
- → Update your torch.compile tests if they mock comparison operators; richcompare dispatch may change behavior [ref:3] pytorch/pytorch [plan]
- → Audit custom test decorators; device-generic migration is rolling out and hardcoded device checks will collide [ref:4][ref:6] pytorch/pytorch [plan]
- → Check your CPU quantization pipelines; ao's mkldnn guard prevents bad registrations [ref:1] pytorch/ao [monitor]
References
- [1] [dynamo] mimic tp_richcompare handling (#182759) pytorch/pytorch
- [2] [Test] Make TestFP8Matmul device-generic for out-of-tree accelerators (#184771) pytorch/pytorch
- [3] [TEST]Make test_modes.py device-generic: Replace GPU_TYPE constant with torch.accelerator API (#179893) pytorch/pytorch
- [4] Remove dead THNN/UCC/TH references from CMakeLists (#185062) pytorch/pytorch
- [5] Fix graph partition removed buffer signatures (#184004) pytorch/pytorch
- [6] NXP backend: Enable Add Tensor with new Neutron flow ↗ pytorch/executorch
- [7] [CPU] skip registration of PT2E inductor passes if mkldnn not available ↗ pytorch/ao
FAQ
- What changed in PyTorch on May 25, 2026?
- Dynamo now handles Python's richcompare protocol, closing a critical gap in torch.compile's operator support while the ecosystem pivots hard toward device-generic testing.
- What should PyTorch teams do about it?
- Update your torch.compile tests if they mock comparison operators; richcompare dispatch may change behavior [ref:3] • Audit custom test decorators; device-generic migration is rolling out and hardcoded device checks will collide [ref:4][ref:6] • Check your CPU quantization pipelines; ao's mkldnn guard prevents bad registrations [ref:1]
- Which PyTorch repositories shipped on May 25, 2026?
- pytorch/pytorch, pytorch/executorch, pytorch/ao