PyTorch fix harmonizes RReLU random behavior in Inductor compilation
A one-line fix ensures compiled RReLU matches eager mode output exactly.
PyTorch's graph compiler, Inductor, sometimes falls back to eager execution for operations involving randomness. For RReLU (Randomized Leaky ReLU), this fallback wasn't preserving the exact random number generator (RNG) state used during eager mode, leading to slight output differences between eager and compiled execution. This was particularly problematic for users relying on reproducibility across runs.
The fix, submitted in PR #184136, moves the functional RReLU decomposition into the random decomposition table. This ensures that when Inductor encounters a RReLU during compilation, it uses the same random decomposition that preserves eager RNG behavior. Additionally, the PR adds focused CPU coverage tests to verify both output and noise parity between eager and compiled modes. The change is small but critical for anyone using RReLU in production pipelines that require deterministic compiled execution.
- Moves functional RReLU decomposition to the random decomposition table in PyTorch Inductor.
- Ensures fallback_random preserves eager RNG behavior, fixing inconsistency between eager and compiled modes.
- Adds CPU-specific tests for output and noise parity, closing issue #147255.
Why It Matters
This fix ensures reproducible and consistent behavior for RReLU users switching between eager and compiled PyTorch modes.