Skip to content

EnzymeHLOOpt: a scatter whose every index is out of range writes nothing - #3442

Merged
wsmoses merged 2 commits into
mainfrom
pb/scatter-oob-noop
Oct 9, 2026
Merged

wsmoses merged 2 commits into
mainfrom
pb/scatter-oob-noop

Conversation

@wsmoses

@wsmoses wsmoses commented Oct 8, 2026

Copy link
Copy Markdown
Member

ScatterOutOfBoundsNoop: a scatter whose indices are a splat constant with a negative component, or one at or past the size of a dimension of window one, drops every update (StableHLO: out-of-range updates are skipped), so it is its operand. Registered as scatter_out_of_bounds_noop in the scatter group and the runtime list.

Why: a branch of a specialized kernel that cannot run (the 3-D arm of PADiffusionSetup on a 2-D problem) leaves its masked stores as scatters to index -1 — in ex1's exec-time module three of the six scatters, each fed by a chain of 20480x32x32 arithmetic that XLA then computes for nothing. With the fold the scatters and their chains go.

Test scatter_out_of_bounds_noop.mlir: negative, past the end of a window-one dimension (both fold), an index in range and a windowed start in range (kept).

🤖 Generated with Claude Code

https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 29.92%. Comparing base (aa88cd8) to head (ce84b86).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3442   +/-   ##
=======================================
  Coverage   29.92%   29.92%           
=======================================
  Files         241      241           
  Lines       48628    48628           
=======================================
+ Hits        14550    14551    +1     
+ Misses      34078    34077    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wsmoses

wsmoses commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

MFEM GPU unit suite (74 tests) with the runtime built from Enzyme-JAX main + #3437 #3439 #3440 #3441 #3442 and Reactant.jl #3423 + #3425, over objects from main + the open affine-cfg PRs (#3436 #3438 among them): 74/74 (sweep final55, 2026-10-08 17:38).

ex1 (Poisson, order 3, PA, PCG to 1e-12), timed solves in one process (JIT excluded), native CUDA for reference:

  • star (185k dofs, 400 iterations): 0.64 s (native 0.047 s) — the morning's state ran ~70 iterations per 600 s
  • fichera (802k dofs, 270 iterations): 1.08 s (native 0.14 s)

The update of an out-of-range index is dropped, so a scatter whose index
constant is one tuple with a negative component, or one at or past the
size of a dimension of window one, is its operand. A dead branch of a
specialized kernel leaves such scatters, index -1, with the work that
fed them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD
@wsmoses
wsmoses force-pushed the pb/scatter-oob-noop branch from 0b2b005 to 1bbdb91 Compare October 9, 2026 01:03
@wsmoses
wsmoses merged commit 1690b2a into main Oct 9, 2026
25 of 33 checks passed
@wsmoses
wsmoses deleted the pb/scatter-oob-noop branch October 9, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant