PyTorch hardens loop index inversion in Inductor compiler
New patch tightens index inversion proof for safer code generation.
PyTorch's latest commit (trunk/36c45ce) hardens the loop index inversion logic within its Inductor compiler. The change tightens the existing proof to ensure that generated inverse functions only map to contiguous source ranges inside the actual loop domain, preventing out-of-bounds or incorrect access patterns. This is critical for performance optimization passes that rely on loop inversion to reorder iterations. The patch also preserves the scheduler scoring path when normalized shared-memory scoring fails to handle the rewritten access.
Regression tests cover specific edge cases: missing chunks in the iteration space, non-divisible nested modular floors, out-of-range finite domains, and constant offsets that the reconstruction formula cannot model. Authored by Codex and approved by drisspg, this update adds essential safety guards to PyTorch's just-in-time compilation pipeline. For developers deploying large-scale models, this means fewer crashes and more predictable behavior during optimized execution.
- Tightens index inversion proof to restrict generated inverses to contiguous source ranges within actual loop domain
- Adds regression tests for missing chunks, non-divisible nested modular floors, out-of-range finite domains, and constant offsets
- Maintains scheduler scoring path when normalized shared-memory scoring misses rewritten access
Why It Matters
Strengthens PyTorch's Inductor compiler, enabling more reliable code generation for complex AI models.