No fuzzer generated these five scalar ops. The SCC selects keep D when SCC is
0, read SCC without writing it, and join the --branches consumers. For the
relative reads a program sets M0 to 0..7 after the seeds, and each s_movrels
reads SGPR[S0 + M0] inside the seeded SGPRs; an odd M0 gives no b64 form (an
odd-aligned pair is unmeasured). Shrinking keeps the M0 line. The rows rest
on the gfx1035 cases of tools/int_hw_probe.py.
Five translator mutations (s_cmov_b32 ignores SCC, s_cmovk_i32 zero-extends,
s_cmov_b64 keeps the high word, s_movrels ignores M0, the b64 high word read
without M0) each fail a unit test and a 2,000-program run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CPU oracle accepts two different literal words even though the instruction has space for one. Replace the conflicting first source with an initialized SGPR so the same generated case can run through the hardware backend.
With --branches every SCC producer may be followed by a chain of 1..3
consumers (s_cselect_b32, s_addc_u32, s_subb_u32) or by s_cbranch_scc0/scc1
forward over the next 1..3 scalar instructions (one lane, no loops, no
nesting). Half the instructions are drawn from the SCC producers. Program
lines write a branch as "+N" instructions; the listing for the translator
carries the dword offset and ; encoding: placeholders of each instruction's
size (literal = 8 bytes), which place the branch targets. The reference
models the skip, the shrinker keeps skipped ranges consistent, and a
mismatch prints the real offsets. Default runs are unchanged so existing
seeds keep their programs; the hardware oracle refuses --branches.
8000 branch programs (8 seeds, max-ops 6/12/20, one with --bfe-any) match
on main. Also drops the stale "until #349 lands" note (#349 is merged).
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/hw_oracle wraps the generated scalar programs in GFX10/GFX11 kernels,
assembles them with AMD clang and runs them through the HIP runtime of the
AMD Windows driver (hw_oracle.c, loaded with LoadLibrary, no SDK). salu_diff
compares the hardware's three SGPRs + SCC with the reference, alone or
together with the translator. A missing tool prints "unavailable" and exits 77.
First finding: s_bfe_i32 with offset + width > 32 stops the field at bit 31
on gfx1150 (width = min(width, 32 - offset)); the reference followed the
pseudocode literally. The translator already did the hardware thing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SHADER-46 (#349) fixes the same s_ff0_i32_b32 bug and was opened first, so
this branch drops its translator change and ps_salu_ff and keeps the
fuzzer. s_bfe_* control words stay inside offset + width <= 32 unless
--bfe-any; --programs/--max-ops below 1 is an argument error; the tests
no longer exclude s_min/max_i32 (#332 is on main) and check the BFE range.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/salu_diff.py runs seeded SOP1/SOP2/SOPC/SOPK programs through its
own reference and through the translator plus spirv_mini_interp, and
compares three SGPRs and SCC. It found that s_ff0_i32_b32 read a 32-bit
constant source as a lane mask; constants are now values, as for
s_bcnt*_b32. GPU-checked with ps_salu_ff.asm.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>