Commit Graph

1 Commits

Author SHA1 Message Date
aad0d61b15 tests: wave reductions and lane-spilled masks under --wave64-emulate (TEST-W64-EMU-WAVE-REDUCE)
run_emulated_workgroup, the CPU model that runs --wave64-emulate output on
all 64 lanes, executed only the OR, add, AND, XOR and exchange atomics: a
program with ds_min_u32 stopped at "unsupported op OpAtomicUMin". It now
runs OpAtomicUMin, UMax, SMin, SMax and ISub, in a branch of its own below
the existing one.

tests/semantic/test_wave64_emulate_wave_reduce.py uses it for two sequences
a compiler emits for a wave64 and that need both 32-lane halves to agree:

- a reduction over the wave (EXEC widened, the identity for lanes that were
  off, four DPP steps per 16-lane row, v_permlanex16_b32, v_readlane_b32 of
  lanes 0 and 63) that the first active lane alone commits with ds_or_b32 or
  ds_min_u32; a ds_add_u32 counter shows exactly one lane ran each commit
- a 64-bit lane mask kept in two lanes of a VGPR with v_writelane_b32 and
  read back with v_readlane_b32 after its SGPRs were reused
- ds_min_u32, ds_max_u32, ds_min_i32, ds_max_i32 and ds_sub_u32 from all 64
  lanes of one wave

Each program is translated without and with --wave64-emulate and run on 64
lanes, natively and emulated; both must match a plain-Python reference in
every lane. The translator is right for all of it: this is coverage.

Four planted translator faults each fail the new file and pass again when
removed: LDS atomics not ordered before a later LDS read, v_readlane_b32
selecting lane & 31 in a wave64, v_permlanex16_b32 reading its own row
half, a parked mask reloaded by a lane shuffle. Without the interpreter
change the reduction test stops at the NotImplementedError above.
scripts/run_semantic_tests.py tests/semantic: 475 files, 6199 tests, 0
files failed.

AI-assisted. No game files.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 16:56:39 -06:00