Raising: dead lanes must not scatter at all - #2993
Conversation
|
Pushed a required companion fix: the single-point scatter→ |
| SmallVector<int64_t> idxMaskDims; | ||
| for (int64_t k = 0, e = (int64_t)gridShape.size(); k < e; ++k) | ||
| idxMaskDims.push_back(k); | ||
| Value idxMask = stablehlo::BroadcastInDimOp::create( | ||
| builder, loc, idxMaskTy, broadcastedMask, idxMaskDims); |
There was a problem hiding this comment.
i think this can just be a reshape (since there should be a single additional trailing 1 element dim)
Squash of pb/dead-lane-scatter @ 7912307 onto union2 (3 commits: the dead-lane scatter form, the tridiagonal golden, and ScatterMaskedIndexSimplify ahead of the single-point DUS rewrite).
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD
Squash of pb/dead-lane-scatter @ 7912307 onto union2 (3 commits: the dead-lane scatter form, the tridiagonal golden, and ScatterMaskedIndexSimplify ahead of the single-point DUS rewrite).
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD
Squash of pb/dead-lane-scatter @ 7912307 onto union2 (3 commits: the dead-lane scatter form, the tridiagonal golden, and ScatterMaskedIndexSimplify ahead of the single-point DUS rewrite).
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD
Squash of pb/dead-lane-scatter @ 7912307 onto union2 (3 commits: the dead-lane scatter form, the tridiagonal golden, and ScatterMaskedIndexSimplify ahead of the single-point DUS rewrite).
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd)
7912307 to
69f03fd
Compare
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd) (cherry picked from commit 2696b7d)
10e578e to
e297f58
Compare
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd)
69f03fd to
f777805
Compare
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd) (cherry picked from commit 2696b7d)
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd)
e189479 to
14b40aa
Compare
eb816b7 to
d7576d1
Compare
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd)
14b40aa to
ce1ad00
Compare
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd) (cherry picked from commit 78be8e326f43b77003cc5bc69e687dd1e3e63b23)
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd)
ce1ad00 to
9c4c1d5
Compare
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd) (cherry picked from commit d483774)
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd) (cherry picked from commit d483774)
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd) (cherry picked from commit d483774)
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd) (cherry picked from commit d483774)
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd)
9c4c1d5 to
33a1e1e
Compare
scatter_dus_guard / scatter_masked_index: with #2993's ScatterMaskedIndexSimplify and #3022's provable-bounds guard in the same pipeline, a masked single-index scatter has its mask resolved into the update and then stays a scatter at the live (unproven) index — neither PR's golden alone described the pair. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD (cherry picked from commit b1882dd) (cherry picked from commit 2459cf4)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2993 +/- ##
==========================================
+ Coverage 29.44% 30.49% +1.05%
==========================================
Files 238 238
Lines 48117 48576 +459
==========================================
+ Hits 14166 14814 +648
+ Misses 33951 33762 -189 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD
A store under a lane mask raises as gather-select-scatter, writing the original value back on masked-out lanes. But a dead lane's index expression is unconstrained — strip-mine bound clamps (
max(extent, tid + bd)) collapse dead lanes onto live lanes' slots — and scatter applies duplicate indices in unspecified order, so the stale write-back can land after the live lane's update and clobber it.Found via mfem's QuadratureInterpolator under the XLA backend (#2968): the dynamic 2D tensor-product eval kernel produced partially-zero, element-varying results; a PJRT harness on the raised module reproduced it deterministically, and redirecting dead lanes out of bounds fixes it bit-exactly.
The fix selects dead lanes' indices to
-1; out-of-bounds scatter updates are dropped, so masked-out lanes write nothing. This also removes the gather of the original values.This PR now carries only the raising change. The
enzyme-hlo-opthalf that resolves the masked index ahead of the single-point scatter-to-DUS rewrite (ScatterMaskedIndexSimplify) is split out into its own PR, and the bounds guard on that rewrite is #3022. Ordering matters: with this change a masked-out lane's correctness rests on the scatter dropping its out-of-bounds index, so the DUS rewrite must not clamp it. This should land with, or after, one of those two.The previous form let
enzyme-hlo-optfold a full-grid masked store into a pureselect; with the index-select form the scatter survives inaffine_to_stablehlo_masked_scatter.mlir. Teaching the dense-scatter fold to look through the index select would recover that.🤖 Generated with Claude Code
https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD