[Inductor] Align floating-point sum reduction signed-zero semantics with eager (#193660)
Sole Author: Patrick Ribbsaeter (@patrickswedish) · Immutable Commit SHA: 8c9ce49e2ab10131282f0d90b6f6a57c8ab912ed
TorchInductor Triton kernel codegen fix initializing floating-point sum reduction accumulators with IEEE-754 negative zero (-0.0) so compiled GPU reductions match PyTorch eager semantics on all-negative-zero inputs.
![[Inductor] Align floating-point sum reduction signed-zero semantics with eager (#193660)](/_next/image?url=%2Fimages%2Fcase-studies%2Fpytorch-triton-signed-zero-semantics.jpg&w=3840&q=75)
PR #193660
100% CI GREEN · INDUCTOR
8c9ce49
Immutable Git SHA
Python
Cuda / Gpu
Inductor Check Green
CI & Test Matrix
01 · Engineering problem
The failure mode
TorchInductor's Triton code generator initialized sum reductions with +0.0 instead of -0.0, violating IEEE-754 signed-zero semantics when reducing all -0.0 tensors.
02 · Technical response
What changed
- 01Updated TorchInductor Triton reduction identity emission to preserve IEEE-754 -0.0 semantics.
- 02Added Inductor numerical parity tests verifying bit-exact signbit preservation against eager PyTorch.
03 · Verified outcome
Evidence-backed result
- ✓Passed PyTorch CI checks on commit 8c9ce49e2ab10131282f0d90b6f6a57c8ab912ed.
04 · Cryptographic Git record
Immutable source evidence
Independent open-source engineering authored solely by Patrick Ribbsaeter (@patrickswedish). Company and project names identify the public repository context only under nominative fair use. No employment, client, vendor, or partnership relationship is implied unless explicitly stated.