Files
mandy/runtime/test/shaders/ps_scc_mask32.asm
tunczzzz 71a16c11cf FUZZ-8: control-flow/EXEC differential fuzzer; wave32 SCC of mask ops is wave-wide
tools/cf_diff.py generates seeded wave32/wave64 pixel shaders from the
control-flow shapes compilers emit (saveexec if/else, v_cmpx, VCC- and
SCC-voted branches, uniform and per-lane loops, two-entry cycles) and
compares every lane's export between:
  * tools/cf_ref.py: cpu_ref's Machine plus branches, compares, v_cmpx,
    saveexec and 64-bit masks (the ISA model, one wave)
  * rdna2spirv + tests/semantic/spirv_wave_interp.py: every invocation of
    one subgroup in lockstep, split at selections and rejoined at merges,
    with the subgroup operations the translator emits
in both the structured and the dispatch-loop form; --spirv-val also
validates each module, --minimize reduces a mismatch.

Finding (fixed here): in a wave32 program s_and/or/xor/andn2/orn2/nand/
nor/xnor_b32 on lane masks set SCC from the lane's own bit instead of the
whole mask, so `s_and_b32 s0, vcc_lo, exec_lo; s_cbranch_scc0` and loops
closed by `s_andn2_b32 exec_lo, ...; s_cbranch_scc1` split the wave. SCC
is now the same subgroup vote as for the _b64 forms. GPU test
ps_scc_mask32 (not run on a GPU yet).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:02:16 +00:00

15 lines
683 B
NASM

; Wave32 SCC from a 32-bit lane-mask op: lanes with i > 0.27 set VCC, and s_and_b32 of VCC_LO with EXEC_LO sets
; SCC = (the wave's mask != 0), one value for the whole wave. A wave with any set lane runs the scalar add in all
; its lanes. Expected, as for ps_uniform_branch: bit=1 pixels export s5 = 8; some bit=0 pixels (same wave) also 8;
; the rest 7. Before 2026-11-22 each lane took its own bit as SCC, so no bit=0 pixel got 8 (found by FUZZ-8,
; tools/cf_diff.py).
v_cmp_lt_f32 vcc_lo, 0x3e8a3d71, v0
s_mov_b32 s5, 7
s_and_b32 s6, vcc_lo, exec_lo
s_cbranch_scc0 1
s_add_u32 s5, s5, 1
v_mov_b32 v3, s5
v_cndmask_b32_e64 v4, 0, 1, vcc_lo
exp mrt0 v3, v4, v0, v0 done vm
s_endpgm