The Wire · Showcase
PYTORCH FIXES CRITICAL MPS MATH BUG WHILE TAMING CI GHOSTS
By RepoJournal · Filed · About PyTorch
PyTorch's Metal backend shipped an accurate erfc function that eliminates 100% relative error on upper tail computations, fixing a cascade of broken numerics in GELU and special functions.
The Metal Performance Shaders backend had a silent catastrophe: `c10::metal::erfc` was computing `1.0 - erf(x)`, which saturates to zero once erf hits fp32 limits around x=3.9, poisoning everything downstream [1]. That means GELU activations, gamma function completements, and `torch.special.erfc` all inherited the flush. This fix splits out a dedicated Metal implementation that holds accuracy across the entire range. In parallel, PyTorch axed a stale Dynamo skip decorator on max_pool1d tests [2] now that the CPU pooling suite no longer triggers LLVM OOM failures, restoring regression coverage that had been dormant. On the CI side, the team hardened crcr-test to handle deleted push dispatches without false L1 probe failures [3]. GitHub sends a null SHA when branches or tags get deleted during PR cleanup; the old code tried checking out ref `0000...`, which crashed. The fix adds a dedicated `push-deleted` job that validates deletion semantics and skips checkout entirely. Routine inductor work continues: fbcode xfails for numerical property mismatches [4] and XPU maxpool backward fallback tuning [5].
Action items
- → Test MPS GELU and special function numerics on your M-series hardware after this lands pytorch/pytorch [plan]
- → Monitor L1 CI for clean push-deleted handling across next 5 tag cleanup cycles pytorch/crcr-test [monitor]
References
- [1] Add an accurate Metal erfc for MPS (eager + inductor) (#189291) pytorch/pytorch
- [2] Remove stale Dynamo skip for max_pool1d pooling test (#186531) pytorch/pytorch
- [3] Handle deleted push dispatches (ciflow tag cleanup) ↗ pytorch/crcr-test
- [4] [inductor] IS_FBCODE xfails for opinfo numeric-property tests (#189640) pytorch/pytorch
- [5] [xpu][inductor] fix the fallback behavior of maxpool backward for performance (#187940) pytorch/pytorch