Skip to content

cf_diff: float compares and class tests into VCC and EXEC in the FUZZ-8 fuzzer - #4930

Open
tunczzz wants to merge 11 commits into
ItsNotRexed:mainfrom
tunczzz:fuzz-8-fcmp
Open

tunczzz wants to merge 11 commits into
ItsNotRexed:mainfrom
tunczzz:fuzz-8-fcmp

Conversation

@tunczzz

@tunczzz tunczzz commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

FUZZ-8 follow-up, claimed on #4683 (comment).

Depends on #4909, which sits at the end of the FUZZ-8 chain #615 → #663 → #4077 → #4104 → #4134 → #4241 → #4909. Only the last two commits, fae577f4 and the review fix d4f19e4c, are new here.

tools/cf_diff.py drove EXEC and VCC with integer compares only. Compilers also branch on float conditions (NaN guards, discard tests, isinf checks), and the translator lowers all 16 f32 conditions to OpFOrd*/OpFUnord*/OpIsNan, and v_cmp(x)_class_f32 to class tests. Those paths had unit tests but were never exercised inside control flow. This adds:

  • tools/cf_ref.py: IEEE f32 compares per the RDNA2 ISA. The ordered forms are false and the n forms true when either side is a NaN; o/u test for NaNs, f/tru are constant, and -0 equals +0. It also has the 10 class bits of v_cmp_class_f32, with S0 as the value and S1 as the mask.
  • tools/cf_diff.py: two new shapes. fif is v_cmp_<cc>_f32 or v_cmp_class_f32 → s_and_saveexec → [s_cbranch_execz] → body → s_or exec. fcmpx is the v_cmpx_... form, with EXEC saved and restored around it. Both compare a per-lane f32 built in v12 from a data VGPR: ±1.0..1.75, ±0, ±inf or a quiet NaN. One wave32 of v8 already holds every one of those classes. The value is never a denormal, so the result doesn't depend on the denorm mode. It is compared against float inline constants, -0/±inf/NaN literals, or a class mask in v13 (any of the 1,024 masks, 0 included).
  • tests/semantic/spirv_wave_interp.py: OpIsNan and OpIsInf on floats, with unit tests.
  • Docs: the docs/design.md rows "Floating-point class compare" and "Constant and ordered VOPC" note the fuzzer coverage, and docs/shader_validation.md adds the shapes to the FUZZ-8 list. tests/test_cf_ref.py's list of unsupported examples now uses an f16 compare, because f32 compares are modelled.

No new findings. The translator agrees with the reference everywhere.

Tested (WSL Ubuntu, CPU) on 9d07681e:

  • tests/test_cf_diff.py + tests/test_cf_ref.py: 306 passed, 64 subtests. (The first push had 301; the review fix added the mask-0 case and test_fvalue_covers_every_class_in_one_wave32.)
    • FCMP_CASES (16 cases, including a never-firing class mask 0: lt, nge, u, o, eq -0, neq inf, lg, nlg, ge -inf, ngt, tru, f and three class masks) match in wave32 and wave64, structured and dispatch loop.
    • With ordered and unordered swapped on NaN lanes (the OpFOrd/OpFUnord slip) every compare case that has NaN lanes mismatches, and the class cases mismatch with the sign ignored.
    • _fcmp and _fclass are pinned by their own unit tests: NaN against everything, -0 == +0, and each of the 10 classes.
  • tests/semantic/test_spirv_wave_interp.py: 22 passed.
  • tools/cf_diff.py: seeds 8180–8182 on 9d07681e (300 programs × wave32 and × wave64; 200 at --depth 4 --dispatch-loop; 200 at --depth 4 --spirv-val): 1,400 pass, 0 mismatch, 0 skipped, 0 harness errors. Seeds 6160–6162 on the first push gave the same.
  • Full pytest tests --ignore=tests/semantic -n 2: 7227 passed, 157 skipped, 7 failed. The 7 failures are the ones plain main 98fa503f has: test_joaat_agreement, fixed by find_hash_lookup: hash --hash names as latin-1, like hashdict (test_joaat_agreement fails on main) #4753, and test_rdna2_decode's llvm-mc parity test, claimed by MichaelL401.

No GPU needed: this is a fuzzer/reference change. The PC has an RTX 5070 Ti, and nothing here runs on it. No game files.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

The new float condition can give a branch the wrong target. In Emitter.fvalue(), v_or_b32 v12, 0x3f800000, v12 uses the inline encoding for 1.0. On gfx1036 its four bytes are f2 18 18 38. The fuzzer's _size() counts eight bytes. A forward branch across this instruction can land one instruction past its label.

To reproduce on 6906e16, run this Python from the repository root:

import sys
sys.path.insert(0, "tools")
import cf_diff as d

e = d.Emitter(32)
e.br("s_branch", "target")
e.fcompare(("lt", "0x80000000", 1), False)
e.place("target")
e.ins("s_nop 0")
e.ins("s_endpgm")
for text, size in e.assemble():
    print(text)

I assembled the printed output with AMD COMGR for amdgcn-amd-amdhsa--gfx1036. The first instruction is s_branch 18 (12 00 82 bf). It lands on s_endpgm. As a control, replace s_branch 18 with s_branch target and put target: immediately before s_nop 0. The assembler emits 11 00 82 bf (offset 17). Both binaries are 80 bytes.

Please count the inline constant as four bytes here. Add a branch-over-float-condition test with an independently derived offset. The reference and the translator can agree when both consume the same synthetic instruction sizes.

The direct parent b06d031 and merge base 98fa503 do not generate this float condition. On Windows with CPython 3.14.7, all 323 tests in tests/test_cf_diff.py, tests/test_cf_ref.py, and tests/semantic/test_spirv_wave_interp.py pass. This reproduction checks machine-code encoding. It does not require GPU execution.

AI-assisted.

@SphyserX

Copy link
Copy Markdown

Tested 6906e16 on Arch Linux (in a VM), CPython 3.14, LLVM 23.1.5, SPIRV-Tools v2026.4: pass.

  • pytest tests/test_cf_diff.py tests/test_cf_ref.py tests/semantic/test_spirv_wave_interp.py tests/test_run_gpu_tests.py: 364 passed (132 subtests).
  • Fuzzer runs: cf_diff.py --programs 300 --wave both --spirv-val with seeds 11-14, plus seed 15 with --dispatch-loop. 3,000 translations, 0 mismatches, 0 skipped, 0 harness errors. The new shapes are present: of the first 60 programs of seed 11 (--show), 23 contain a v_cmp*_f32 and 3 a v_cmp*_class_f32.
  • Code read of cf_ref.py: the ordered and n forms with NaN, o/u, f/tru, -0 == +0, and the class bits (0 sNaN, 1 qNaN, 2 -inf ... 9 +inf, quiet bit = mantissa bit 22) match the RDNA2 ISA tables. Keeping the operand free of denormals makes the reference independent of the denorm mode, as you say.

I only looked at the last commit; the rest of the chain is #4909 and earlier.

@tupacfan04

Copy link
Copy Markdown
Contributor

APPROVE, with a base/stack note.

This branch is stacked: 10 commits ahead of 98fa503f, so gh lists #4909's chain too; only 6906e16b is this PR. It must land after #4909.

compileall clean. pytest tests/test_cf_diff.py tests/test_cf_ref.py tests/semantic/test_spirv_wave_interp.py tests/test_run_gpu_tests.py gives 364 passed / 132 subtests, and 364 pass after a real merge with current main; merge-tree clean. Fuzz: seed 6160 100x both = 200 pass, seed 6161 depth 4 = 80 pass, 0 mismatch/skip/error. Negative control: main collection fails with AttributeError: module 'cf_ref' has no attribute '_fcmp'; a signed-zero mutant of _fcmp mismatches wave64 lane 56, so the ref is sensitive.

_fcmp/_fclass match RDNA2 ISA (ordered/unordered, -0 == +0, 10 class bits); fif/fcmpx EXEC save/restore and VCC handling are correct (tools/cf_diff.py:712-737).

Minor: the class mask randrange(1,1024) never produces 0 (tools/cf_diff.py:121), and the eq -0 case only sees +/-0 lanes in wave64 (v8 = 9 ^ lane), so wave32 exercises the -0 operand only. GPU/full suite/Windows shader checks not run here.

Approve. AI-assisted review, no game files.

@memorypressure

Copy link
Copy Markdown

Verified merged with main 3faac55: compileall clean; test_cf_diff 268 passed (pytest, re-run here; under python -I it fails fast at import pytest as documented), test_cf_ref 33, tests/semantic/test_spirv_wave_interp 22, test_run_gpu_tests 41 — all green; cf-family, docs and guard regressions OK. The wave interpreter extends the one already on main rather than adding a parallel model, the guard allowlist entry predates the PR, both new .asm listings are hand-written with run recipes and attribution, and newline-pinning/stdlib/no-game-data all hold. The GPU-side expectations (cs_scc_mask32, cs_w64_exec_half) are unverifiable in a CPU-only run; CI pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@bunbeans2-arch

Copy link
Copy Markdown

Independent run on an AMD Radeon RX 9070 XT (RDNA4, subgroup 32..64), Windows 11 23H2, head 6906e16:
the GPU suite with --require-pass gives 204/219 passed, 15 skipped, and both new fixtures pass
(cs_scc_mask32, cs_w64_exec_half). In the CPU tests, 363 pass. The 1 failure is test_no_arguments_prints_usage,
which times out on a cold checkout because cf_diff compiles rdna2spirv every run (timeout=5 against about 7 s).
It is on main too and not from this PR.
AI-assisted (Claude Code). No game files.

@tunczzz

tunczzz commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @tupacfan04, both points were right. Fixed in 9d07681e (pushed).

  • Wave32 never saw ±inf or ±0. fvalue took the specials from bits 4–5 and the sign from bit 3, and no wave32 source reaches bit 5. Now bits 0–1 pick the mantissa (1.0, 1.25, 1.5, 1.75), bits 2–3 the special (NaN, +inf, +0) and bit 4 the sign, so one 32-lane wave of v8 (9 ^ lane) holds every value. The new test_fvalue_covers_every_class_in_one_wave32 runs fvalue(v8) in the reference and requires qNaN, ±inf, ±0 and ±normal in wave32. With the old bits it fails (it saw qNaN, -normal and +normal only).
  • The class mask is never 0. It is now randrange(0, 1024), and FCMP_CASES has a mask-0 case, which never fires.

Rerun on the new tip (#4947 rebased onto it, eb0f7431): tests/test_cf_diff.py + test_cf_ref.py 306 passed. cf_diff.py seeds 8180–8182 (300 × wave32 and × wave64; 200 at depth 4 dispatch loop; 200 at depth 4 with --spirv-val): 1,400 pass, 0 mismatch, 0 skipped. The full pytest tests --ignore=tests/semantic has only main's 7 known failures. Still no translator finding: the translator gets ±inf and ±0 right in wave32 too. CPU only (WSL); the PC's RTX 5070 Ti wasn't used. AI-assisted (Claude Code).

@gertify

gertify commented Nov 23, 2026

Copy link
Copy Markdown

Tested 9d07681 on AMD Radeon 610M (RADV, subgroup 32..64), Linux: the new GPU fixtures pass with LEONIDA_VK_DEVICE=RADV, cs_scc_mask32 and ps_scc_mask32 (2/2) and cs_w64_exec_half (1/1). CPU side: tests/test_cf_diff.py plus tests/test_cf_ref.py give 306 passed, 64 subtests passed under pytest (the PR body says 301; I did not investigate the difference), test_spirv_wave_interp has 22 tests OK, and tools/cf_diff.py seeds 6160, 6161 and 6162 (1,400 programs) show 0 mismatch and 0 harness errors. test_cf_diff.py collects 0 tests under unittest discover, so it needs pytest.

AI-assisted.

@tunczzz

tunczzz commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @gertify. The 301 in the description was from the first push. The review fix 9d07681e added the mask-0 case and test_fvalue_covers_every_class_in_one_wave32, which makes 306. I've updated the description to the current numbers and seeds. And yes, test_cf_diff.py uses pytest parametrize, so it needs pytest. AI-assisted (Claude Code).

@Atomic258

Copy link
Copy Markdown
Contributor

Tested 9d07681 on Windows Server 2022, CPython 3.13.12: pass

  • pytest tests/test_cf_diff.py -> 273 passed; python -I tests/test_cf_ref.py -> OK
  • Negative control (tools/cf_ref.py swapped to upstream/main): collection error - differentiates

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. AI-assisted (Devin).

tunczzz and others added 11 commits November 23, 2026 11:54
…_mask32 GPU test

The translator side of this PR (s_not_b32 on a wave32 lane mask votes its
SCC) landed on main through ItsNotRexed#3225 (SweatierKey), so the branch now keeps
main's tools/rdna2spirv.py and adds the checks around it:

- tools/cf_ref.py models s_not_b32/b64; tools/cf_diff.py generates s_not
  in the sccmask/csel shapes; tests/test_cf_diff.py has the two s_not
  regression cases (they fail with the old per-lane SCC).
- runtime/test/shaders/cs_scc_mask32.asm: @kotorvr's compute test for
  s_and + s_cselect, s_andn2 + s_cbranch_scc1, s_not, s_or, s_xnor,
  registered as a wave32 dump in check.py and run_gpu_tests.py (skipped
  below 32 lanes).
- docs/design.md: s_not_b32 in the rule, the GPU results and @kotorvr's
  corpus count.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alf GPU test

The translator side of this PR (wave64 32-bit ops on one half of EXEC/VCC:
exec_lo writes and the half's SCC vote) landed on main through ItsNotRexed#3225
(SweatierKey), so the branch now keeps main's tools/rdna2spirv.py. The
new shapes below pass on it; they found both bugs on the translator
before ItsNotRexed#3225:

- A register written to exec_lo set all 64 lanes, and any op but
  s_mov_b32 into exec_hi was rejected ("destination exec_hi").
- The SCC of a 32-bit op on one half of a mask took the lane's own bit.

Fuzzer: cf_ref treats every _b32 op as a 32-bit word op (halves
included) and models s_cmp_eq/lg_u64 and s_cselect_b64; cf_diff adds
e64 compares into SGPR masks (saveexec, v_cndmask), constant EXEC,
half-EXEC ops, half-mask SCC, s_cmp on masks and s_cselect between
masks, and counts literals in instruction sizes. GPU test
cs_w64_exec_half (wave64 dump; expected 1 0 1 1 0 3 9 9).

Depends on: ItsNotRexed#615

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two loop shapes: per-lane trip counts closed by s_cbranch_vccnz (the
wave loops while any lane wants to, EXEC unchanged), and loops that drop
finished lanes with v_cmpx and close on s_cbranch_execnz. cf_ref models
s_andn1/andn2_wrexec (EXEC = ~S0 & EXEC / S0 & ~EXEC, D = EXEC, SCC).

No new findings: 2,600 cases with the loop shapes (structured, dispatch
loop, depth 4) and s_andn2_wrexec in both wave sizes and forms match.
s_andn1_wrexec and the xor/orn2/nand/nor/xnor/andn1/orn1 saveexec forms
are not translated (Unsupported); every corpus shader translates, so the
game does not use them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two new program shapes cover translator rules the fuzzer did not reach:

- mread: s_bcnt1 / s_ff1 of EXEC, VCC or an SGPR compare mask into a
  uniform SGPR (wave64: _b64, or _b32 on one half), added to every
  active lane, optionally followed by s_cmp on it and a branch.
- waterfall: v_readfirstlane of a lane value -> v_cmp_eq ->
  s_and_saveexec -> body -> s_xor exec, closed by s_cbranch_execnz or
  by the SCC of the s_xor (the descriptor-per-group-of-lanes loop).

cf_ref models v_readfirstlane_b32 (lowest active lane, lane 0 when
none), s_bcnt1_i32_b32/b64 (SCC = count != 0) and s_ff1_i32_b32/b64
(-1 when no bit is set); a _b32 form reads one 32-bit word, one half of
the mask in wave64.

Both shapes are sensitive: with v_readfirstlane read per lane (the
pre-2026-11-21 translation) or s_bcnt1 counting the lane's own bit,
seed 3 gives 5 and 4 mismatches of 120. Waterfalls take v1/v2/v3
(8 or 16 distinct values); v8 (one value per lane) nested inside other
loops ran past the wave interpreter's step limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A `wqm` shape: s_wqm of EXEC after narrowing it to a compare, or of VCC
into EXEC, around a body [-> s_cbranch_execz / scc0 / scc1], with EXEC
restored by s_mov; or s_wqm of a compare into an SGPR feeding an SCC
branch (SCC = some quad has a lane on). Wave64 also gets the _b32 form on
one half. Nested inside a divergent if, it turns quad-mates the if had
turned off back on, which the translator must do through %active.

- cf_ref: s_wqm_b32/b64 (each 4-bit group all ones when any bit of it is
  set; SCC = D != 0; a _b32 form is one 32-bit word).
- spirv_wave_interp: OpGroupNonUniformQuadSwap (direction 0/1/2 reads
  lane ^ 1 / ^ 2 / ^ 3) and QuadBroadcast (lane 4n + index); the
  translator's WQM path in fragment shaders uses QuadSwap.

With s_wqm put back to the identity it was before SHADER-34, 12 of the
38 generated WQM programs of seed 3 mismatch; test_whole_quad_mode_cases_
catch_an_identity_wqm pins one of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uzzer

A `lanes` shape at any nesting depth: v_readlane_b32 of a data VGPR
(added to every active lane) or v_writelane_b32 into one (v8/v9 are
preferred, since they go straight to the export), with a constant lane
(also past the wave, which wraps: S1[4:0] in wave32, S1[5:0] in wave64)
or an SGPR lane. Both ignore EXEC, so a lane an enclosing if or loop
turned off is still read and written. cf_ref models both ops.

With writelane changed to honour EXEC (a planted bug, not committed),
the LANE_CASES mismatch in wave32 and wave64 and seed 7 gives 6 of 600
mismatches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tsNotRexed#4134)

- test_cf_diff: the wrap case writes lane 100 (lane 4 in wave32, lane 36
  in wave64) from s11 (5); lane 84 was lane 20 in both waves, and s12 is
  0 like the v9 it overwrote, so the write wasn't observable. With the
  wave64 writelane masked by 31 the case now mismatches in both forms.
- test_cf_ref: a wave64 test pins lane 45 read while off and lane
  100 & 63 = 36 written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A `far` shape: s_getpc_b64 -> s_add_u32 K -> s_addc_u32 0 -> s_setpc_b64
jumping forward over a block that never runs, or as the back edge of a
uniform counter loop (s_sub_u32 K / s_subb_u32 0, or s_add_u32 -K /
s_addc_u32 -1), at any nesting depth. The emitter resolves K from label
positions at assembly time (the s_add/sub literal always takes 4 bytes),
and s[2:3] is the scratch pair. This runs the translator's
fold_far_branches in context; ItsNotRexed#2697 GPU-tests the idiom by itself.

cf_ref: s_getpc_b64 (byte address of the next instruction, code at 0),
s_setpc_b64, s_addc_u32 and s_subb_u32 (carry / borrow through SCC).

With the s_sub_u32 form read as +K in the fold, the loop case mismatches
(test_far_branch_cases_catch_a_lost_sign); with the s_addc_u32 -1 high
word ignored, the translator rejects the target as outside the code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e FUZZ-8 fuzzer

The translator has handled every saveexec kind and both wrexec forms since
6cfcf7c, and cf_ref models them, but the fuzzer generated neither wrexec
form and never drew andn1/orn1 for its saveexec shape.

- wrelse: s_and_saveexec -> then -> s_andn2_wrexec D, save (EXEC = save &
  ~EXEC, the else lanes) -> [s_cbranch_execz/scc0] -> else -> s_mov exec.
- wrloop: per-lane trip counts closed by s_andn1_wrexec D, vcc (EXEC =
  ~done & EXEC), back edge s_cbranch_scc1 or s_cbranch_execnz.
- saveexec draws andn1 and orn1 too.
D is the sccmask scratch SGPR (nothing reads it).

Tests: WREXEC_CASES in tests/test_cf_diff.py (wave32/64, structured and
dispatch loop) match, and each mismatches with andn1/andn2 and orn1/orn2
swapped in the translator's EXEC_LOGIC. No new findings: 1,700 programs
(seeds 5150-5152, depth 3-4, dispatch loop, spirv-val), 0 mismatch.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-8 fuzzer

The fuzzer drove EXEC/VCC with integer compares only. Compilers also
branch on float conditions (NaN guards, discard tests), and the
translator maps all 16 f32 conditions to OpFOrd*/OpFUnord*/OpIsNan and
v_cmp(x)_class_f32 to class tests.

- cf_ref: IEEE f32 compares (ordered forms false and n forms true on a
  NaN, o/u, f/tru, -0 == +0) and the 10 class bits.
- cf_diff: fif (v_cmp_<cc>_f32 / v_cmp_class_f32 -> s_and_saveexec) and
  fcmpx (v_cmpx_...) on a per-lane f32 built in v12 from a data VGPR:
  +-1.0..1.875, +-0, +-inf or a NaN, never a denormal (so denorm mode
  does not matter), against float constants, specials or a class mask.
- spirv_wave_interp: OpIsNan / OpIsInf on floats.

Tests: FCMP_CASES (15 cases, wave32/64, structured and dispatch loop)
match; they mismatch with ordered and unordered swapped on NaN lanes,
and the class cases with the sign ignored; unit tests pin _fcmp and
_fclass. No new findings: 1,400 programs (seeds 6160-6162, depth 3-4,
dispatch loop, spirv-val), 0 mismatch, 0 skipped.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of ItsNotRexed#4930 (tupacfan04): fvalue took the specials from bits 4-5 and
the sign from bit 3 of the source, and no wave32 source reaches bit 5,
so wave32 never compared against +-inf or +-0 (only NaNs and normals).
The mantissa now comes from bits 0-1, the specials from bits 2-3 and
the sign from bit 4: one 32-lane wave of v8 (9 ^ lane) holds every
value. The class mask can also be 0 (never true).

test_fvalue_covers_every_class_in_one_wave32 checks it in the
reference: with the old bits, wave32 saw qNaN, -normal and +normal
only. FCMP_CASES gains a mask-0 class case.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tunczzz

tunczzz commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Rebased the FUZZ-8 stack onto main 561b65a8 (main's large merge had made every PR in the stack conflict). This PR's commit is now fae577f4 + d4f19e4c (force-pushed). Main had edited the two docs/design.md rows this PR touches. The row-wise merge was clean, and the PR's notes are in both rows.

Tests (WSL Ubuntu, llvm-mc 21, CPU only; the PC's RTX 5070 Ti not used): on #615's head, tests/test_cf_diff.py + test_cf_ref.py + test_run_gpu_tests.py give 121 passed, 148 subtests. On the stack tip 8811c2b2 (#4947) the same three give 393 passed, tests/semantic/test_spirv_wave_interp.py 23 passed, and tools/cf_diff.py seeds 9180–9182 give 1,400 programs (wave32 and wave64, depth 3/4, dispatch loop, --spirv-val) with 0 mismatch and 0 skipped. The full pytest tests --ignore=tests/semantic -n 2 on the tip has 7 failures, the same 7 plain main 561b65a8 has: test_joaat_agreement (fixed by #4753) and test_rdna2_decode's llvm-mc parity test. AI-assisted (Claude Code).

@IxMxAMAR

Copy link
Copy Markdown

Tested d4f19e4 on Windows 11 Pro 26200: pass, no regressions. AMD Radeon RX 9070 XT (AMD 26.11.2, Vulkan 1.4.359, subgroup 32..64, native wave64) and the Intel Graphics iGPU of a Core Ultra 5 225 (driver 101.8860, subgroup 8..32, LEONIDA_W64_EMULATE=1). Runtime built from 561b65a with MSVC 19.50 (its runtime sources are identical to this head), Vulkan SDK 1.4.350, llvm-mc AMD LLVM 23.

  • run_gpu_tests.py: RX 9070 XT 218/234 passed, 16 skipped, 0 failed. Intel 200/234 passed, 33 skipped, 1 failed. cs_scc_mask32 and cs_w64_exec_half pass on both GPUs, and every other test has the same result as on main 561b65a. The Intel failure is ms_wave_info_s3, which fails the same way on main (ms_wave_info_s3 intermittently fails on RX 7900 XT / RADV NAVI31 (pass rate 100% -> 2.5%, same binaries) #6172).
  • test_cf_diff.py 277 passed, test_cf_ref.py 33 OK, test_run_gpu_tests.py 47 OK, tests/semantic 6154 run OK.
  • Main has since moved to 1cc6e3c, and this head now conflicts with it in docs/design.md, runtime/test/shaders/check.py and scripts/run_gpu_tests.py.

No game files. AI-assisted.

@lunarminus

Copy link
Copy Markdown

Tested d4f19e4c merged onto main d0835dd9 on an AMD Radeon 760M (RDNA3 iGPU, gfx1103, subgroup 32..64), RADV Mesa 26.3.1, CachyOS Linux: pass

  • The head already contains d0835dd9, so the merge was a fast-forward and the tree tested is d4f19e4c itself. The PR's base is 561b65a8. Compared with that base, the only runtime/ changes are check.py and the two new .asm fixtures. The test programs come from a clean, up-to-date RelWithDebInfo build of 561b65a8.
  • run_gpu_tests.py gives 218/234 passed, 16 skipped, 0 failed both natively and with LEONIDA_W64_EMULATE=1, and rdna2spirv translates 240/240 with 240 passing spirv-val. The two fixtures pass in both modes:
    • cs_scc_mask32 gives 7 0 0 9 11 13 7 13.
    • cs_w64_exec_half gives 1 0 1 1 0 3 9 9.
  • Per-test comparison:
    • With d0835dd9 without the PR (196/210, 14 skipped): no test changes PASS/FAIL/SKIP in either mode. The PR run has 24 more tests, 22 PASS and 2 SKIP (ps_live_width, ps_m2_literal). Apart from the two fixtures, they all come from main between d0835dd9 and 561b65a8.
    • With a 561b65a8 control run here (216/232, 16 skipped, both modes): the only difference is the two new fixtures.
  • CPU, with pytest and LEONIDA_AMD_CLANG pointing at clang/llvm-mc 23.1.5:
    • tests/test_cf_diff.py: 277 passed.
    • tests/test_cf_ref.py: 33 passed, 64 subtests.
    • tests/test_run_gpu_tests.py: 47 passed, 84 subtests.
    • tests/semantic/test_spirv_wave_interp.py: 23 passed, 26 subtests. unittest discover on it also gives 23 OK.
    • cf_diff.py --self-test is ok.
  • tools/cf_diff.py: 1,400 translations, 0 mismatch, 0 skipped, 0 harness errors:
    • Seed 4930: 300 programs, wave32 and wave64, 600 pass.
    • Seed 4931: 200 programs, --depth 4 --dispatch-loop, 400 pass.
    • Seed 4932: 200 programs, --depth 4 --spirv-val, 400 pass.
  • @shdann's encoding note still applies at d4f19e4c. _size() counts v_or_b32 v12, 0x3f800000, v12 in fvalue() as 8 bytes, but llvm-mc 23.1.5 for gfx1036 encodes it as the 4-byte inline 1.0 (f2 18 18 38).
    • On shdann's snippet, the printed s_branch 18 assembles to BF820012 and lands on s_endpgm at 0x4c.
    • The same listing with a label assembles to BF820011.
    • Inside cf_diff the translator reads only the encoding lengths, so the reference and the translator still agree and no fuzz case fails because of this. A listing that is assembled for real would branch to the wrong place.

AI-assisted (Claude Code).

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.

10 participants