Repository navigation
tools/wave_diff.py: CPU-only differential fuzzer for wave and cross-lane ops (wave32 and wave64) - #3592
tools/wave_diff.py: CPU-only differential fuzzer for wave and cross-lane ops (wave32 and wave64)#3592intelshadow wants to merge 3 commits into
Conversation
kacper-serewis
left a comment
There was a problem hiding this comment.
At 78e2da0 tools/wave_diff.py:425 catches CpuRefError, which includes ProgramError as well as Unsupported. A reference-model ProgramError became a skipped program and the CLI exited 0. Catch Unsupported at this point and classify ProgramError as a harness error with exit 2. All 11 supplied tests passed; independent readlane and missing/wrong-store checks produced the expected lane/register diagnostics. AI-assisted CPU only.
|
Tested 78e2da0 on Windows 11, AMD Radeon iGPU gfx1036 (driver 26.10.1, subgroup 32..64) and RTX 5080 (driver 616.92, subgroup 32), runtime built from this head (MSVC, RelWithDebInfo),
No negative control run. AI-assisted. |
|
Tested
Not checked: |
|
Tested
No game files. AI-assisted (Claude Code). |
…a skipped program run_one caught cpu_ref.CpuRefError, which includes ProgramError, so a broken reference run counted as a skip and the CLI exited 0. Only Unsupported is a skip now; ProgramError reaches run_suite as a harness error. Test added. (Review on ItsNotRexed#3592.) AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@kacper-serewis thanks, you're right. Fixed in 395da87: Thanks @Vonsek for the GPU runs too. |
…a skipped program run_one caught cpu_ref.CpuRefError, which includes ProgramError, so a broken reference run counted as a skip and the CLI exited 0. Only Unsupported is a skip now; ProgramError reaches run_suite as a harness error. Test added. (Review on ItsNotRexed#3592.) AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
395da87 to
57fff44
Compare
|
Tested 57fff44 merged onto main aa2988c on an RTX 5090 (driver 616.92), Windows 11, Vulkan SDK 1.4.363. The GPU test programs were built from the same tree:
AI-assisted (Claude Code). |
…ane ops (wave32 and wave64) The family crosslane_fuzz.py checks on a GPU, checked on the CPU so it can run where the translator tests run. The reference is cf_ref.WaveMachine (FUZZ-8) extended with what it leaves out: v_readlane, v_readfirstlane, v_writelane, ds_bpermute_b32, v_permlane16/x16 (FI = 0 as measured in ItsNotRexed#374), s_bcnt0/1 and s_ff0/1 (b32/b64) and s_not. The translated SPIR-V runs on spirv_mini_interp.run_workgroup, the whole wave in one subgroup, and every dword every lane stores is compared. Known gaps on main are opt-in: --masks-as-data (ItsNotRexed#210) and --permlane-partial (SHADER-74, ItsNotRexed#580). tests/test_wave_diff.py: hand-derived reference cases, canaries and a short seeded run on both wave sizes. Depends on ItsNotRexed#1409 (the default run finds its case on main). AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a skipped program run_one caught cpu_ref.CpuRefError, which includes ProgramError, so a broken reference run counted as a skip and the CLI exited 0. Only Unsupported is a skip now; ProgramError reaches run_suite as a harness error. Test added. (Review on ItsNotRexed#3592.) AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… found are fixed) AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
57fff44 to
e0be341
Compare
|
Tested This PR is CPU-only (
Counts and pass/fail only; no game data. No code changes. AI-assisted. |
Claimed in #374. AI-assisted (Claude Code). No game files, no GPU, no llvm-mc.
What
tools/wave_diff.pyis a CPU-only differential fuzzer for wave and cross-lane ops, the familycrosslane_fuzz.py(FUZZ-7) checks on a GPU. It runs wherever the translator tests run, CI included. It doesn't replace the GPU fuzzer: it's a cheap check that can run on every PR.Reference:
cf_ref.WaveMachine(FUZZ-8), subclassed aswave_diff.WaveRefwith only the instructions it leaves out:v_readlane,v_readfirstlane,v_writelane,ds_bpermute_b32,v_permlane16/x16,s_bcnt0/1ands_ff0/1(_b32and_b64), ands_not. Each rule is written next to its instruction:ds_bpermute_b32works per 32-lane half; an inactive source reads 0.v_permlane16/x16with FI = 0 and an inactive source leaves vD unchanged, as measured on RDNA2/RDNA3.5 in Coordinating who works on what (2) (moved to #634) #374 (PROC-19). Withop_sel, the instruction raises and the case is a counted skip.Nothing in
cpu_ref.pyorcf_ref.pychanges.Translated side:
rdna2spirvoutput onspirv_mini_interp.run_workgroup, every lane of the wave in one subgroup of the wave's size.Programs: straight-line wave32 and wave64 compute under random EXEC (
v_cmpx, saveexec, constants), mixing the instructions above with compares, mask logic,v_mbcnt,v_cndmaskand integer VALU. All 12 dwords every lane stores are compared: four VGPRs, two masks, VCC and the final EXEC as each lane's bit, and four scalars. A mismatch reports the lane, the register, both words and the listing.Default run = regression check: lane masks and 64-bit data stay in separate registers, and
v_permlaneonly runs with every lane on. Two known gaps onmainare opt-in:--masks-as-data: Translator: wave64 lane masks used as integers read back as per-lane bools; wave64 inferred from mnemonics #210, Translator: a lane mask read as data gives the wave's bits (SHADER-21 part 1, #210) #293.--permlane-partial: SHADER-74, Translator: v_permlane16/x16 FI=0 and BOUND_CTRL for source lanes off in EXEC (SHADER-74) #580.Options:
--self-test(canaries: a hand-checked program matches, a sabotaged SPIR-V is caught, anop_selpermlane is a counted skip),--wave 32|64|both,--report-all.Results
--max-ops 16, half wave32 and half wave64, nothing skipped.s_and_b32 exec_lo, exec_lo, Kin wave32, ands_ff0_i32_b64of a negative constant (Tests: cs_imm_mask, constants as wave64 lane masks and as 64-bit data (s_ff0_i32_b64 of -1 included) #1409). Both are fixed onmainsince.main7b7d73f: 600 of 600 match (seeds 401 to 403).Tests
tests/test_wave_diff.py(standard library), 12 tests:ProgramErrorcounted as a harness error (exit 2), not a skip.Run on Linux aarch64 (Raspberry Pi 5, Python 3.11). There's also a short section in
docs/shader_validation.md, after thecrosslane_fuzz.pyone.🤖 Generated with Claude Code