Gen.clamp_mods applied the VOP3 clamp bit as a bare GLSL.std.450
FClamp, which is undefined for a NaN operand. The game's MODE has
DX10_CLAMP=1, under which the hardware turns a NaN result into +0
(measured on gfx1036: the v_rcp_iflag_f32 run and SHADER-186 for
v_fmac_f16 / v_fma_mix*). Select +0 for a NaN before FClamp, as the
div_fixup, cvt_pk_u8 and cvt_pknorm clamps already do. This covers
every f32/f16 op that applies clamp through clamp_mods/clamp_f16.
- tests/semantic/test_vop3_clamp_nan.py: NaN operands (quiet,
negative, signalling) and invalid operations (inf-inf, -inf*0)
under clamp give +0 for f32, f16 (low and high half), conversions,
legacy and mix ops; controls without a NaN are unchanged. It fails
33 subtests on the old translator.
- The two negative controls that expected the undefined FClamp
(test_alu_f32_min_max, test_alu_min3_max3) now expect +0, and the
f16 unary harness checks clamp of a NaN result instead of skipping.
- test_rcp_iflag_mods / test_f64_conversion match the new SPIR-V.
- docs/design.md and docs/shader_validation.md no longer list the
f32/f16 clamp of a NaN as unmodelled. Still a bare FClamp: the f64
clamp (open PR #475) and the packed v_pk_* clamp.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bit 24 of V# word 3 (GFX10 RESOURCE_LEVEL) is WRITE_COMPRESS_ENABLE on GFX12, so
the informational --gfx10-word3 run is refused there. On gfx1200 a vector load
after a store of the same thread needs no wait (--hw-sync none without the
scalar ops: 1,000 of 1,000); the scalar loads need the store wait and s_dcache_inv.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gfx12 kernels are the GFX10/GFX11 text respelled (gfx12_lines): a MUBUF
soffset is null instead of the literal 0, which is what made every
buffer_load/store_b* "operands are not valid for this GPU or mode";
s_waitcnt_vscnt, s_waitcnt vmcnt/lgkmcnt and buffer_gl0/gl1_inv become
s_wait_storecnt, s_wait_loadcnt, s_wait_kmcnt and global_inv. The V#s keep
their layout (Mesa gfx12-rsrc.json: word 1 and word 3's fields as on GFX11);
word3() now refuses a family it has no layout for.
RX 9060 XT (gfx1200), AMD 26.11.2: seeds 2-4 x 2,000 programs x wave32 and
wave64, 12,000 of 12,000 match; the negative control catches all 8
perturbations. GFX10, GFX11 and translator text are byte-identical.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The valu_fuzz hardware-oracle section gets the per-family gate and the RX
9070 numbers: f16 1,000/1,000 kernels match (500 programs, both wave
sizes), mem refused on gfx12xx with the two AMD clang rejects named, and
gfx1170 assembling both families clean. The lds_fuzz GFX12 bullet now
covers ds_permute_b32 reaching all 64 lanes as well, with the send-
direction measurement, the masked ds_swizzle control, and the 500-program
numbers of the default run.
AI-assisted (GLM-5.3).
Squash-merged after diff review of PR #6911 - docs/shader_validation: f32_fuzz has no Vulkan oracle, so drop it from the --oracle hw,vk section (EGEN-DOCS-F32-FUZZ-VK)
Also: #2490's committed conflict markers in fssm_crosscheck.md resolved to main's text, the SHADER-605 section
moved below the troubleshooting table it split, a header rule for the export-format table, two backticked
paths that name no Leonida file, and the BOM dropped from anim_move.py and its test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mem_diff found one class of mismatch: a 16_FLOAT/16_16_FLOAT/16_16_16_16_FLOAT
typed buffer load of a half NaN. Measured natively on RDNA2 (gfx1036) with the new
tools/f16_widen_probe.py, wave32 and wave64, MUBUF and MTBUF, formats 13, 29 and 71:
the hardware widens a half NaN to f32 as sign | 0x7F800000 | (payload << 13), keeping
the sign and the quiet bit exactly as the half has them (0x7ddb -> 0x7fbb6000,
0x7fe6 -> 0x7ffcc000, 0xffb2 -> 0xfff64000).
Gen.decode_format decoded every half with UnpackHalf2x16, whose NaN result is
undefined and which the interpreter canonicalises to 0x7fc00000, so the payload was
lost. It now uses UnpackHalf2x16 for the non-NaN halves (an exact widening) and builds
the NaN word from the bits with integer ops. v_cvt_f32_f16 was measured too: it quiets
an sNaN with the payload kept (0x7ffb6000), which the typed load does not.
mem_diff's reference used struct's '<e', which keeps the payload only from Python 3.14;
f16_to_f32 pins the measured rule so the fuzzer is version independent.
tests/semantic/test_buffer_f16_widen_hw.py pins the ten measured words for MUBUF and
MTBUF and formats 13/29/71; tests/test_f16_widen_probe.py covers the probe (models,
fake oracle, CLI); mem_diff --self-test now pins the rule too.
Review follow-up on #4536 (CHANGES_REQUESTED by Flyander; coverage note by kapitche).
- --oracle hw no longer always exits 77. It opens tools/hw_oracle (same pattern as
tools/fmisc_diff.py), runs each program as a one-lane wave32 raw kernel in the game's
inferred MODE, honours --hw-arch, and compares the four words with the reference. 77 is
returned only when the oracle is unavailable. v_rcp/v_rsq/v_sqrt_f64 are counted skips
there (native results are approximations, PROC-216); the translator-only known-divergence
exclusions do not apply to hardware.
- add_bits: an exact zero sum now follows IEEE 754-2019 6.3. +0 + +0 stays +0 in every
mode; only opposite-signed zeros and x + (-x) give -0 when rounding toward negative.
Before, every exact zero was -0 in that mode.
- tests: direct table tests for compare (16 conditions x 28 operand pairs), class (10
classes plus boundaries), div_fixup, frexp and add_bits (NaN, inf, zero signs in all four
modes), plus fake-oracle tests for hw routing, --hw-arch, exit 77, skips and shrinking.
Mutating lt to <=, add_bits NaN to 0, or dropping the signed-zero rule now fails them.
- docs/shader_validation.md describes the hw contract. No AMD hardware run has been done.
KNOWN_DIVERGENCES keeps div-fixup-nan-s0 (it waits for TEST-983 to reach main).
AI-assisted (OpenBot team).
Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
On an RX 9070 XT (gfx1201) `lds_fuzz.py --oracle hw` stopped with "the assembler rejected
every program in a chunk: ... s_barrier", and programs with a ds_cmpst were skipped because
ds_cmpstore's operand order was only measured on gfx1150.
- asm.sync_lines: GFX12 has no s_barrier, so a barrier is `s_barrier_signal -1` then
`s_barrier_wait -1`, and the LDS wait is `s_wait_dscnt 0` instead of the legacy
`s_waitcnt lgkmcnt(0)` encoding. lds_fuzz's hardware kernels go through it.
- asm.ds_line swaps ds_cmpstore[_rtn]_b32's data operands on GFX12 as on GFX11. Measured on
gfx1201: with 7 in the dword, data v1 = 9, v2 = 7 stores 9 and v1 = 7, v2 = 9 keeps 7, for
the rtn and the non-returning form (gfx1036's ds_cmpst does the opposite).
- Measured on the way: a wave64 ds_bpermute_b32 reaches all 64 lanes on GFX12, where RDNA2
and gfx1150 keep each 32-lane half separate (every lane asking for lane (l + 32) mod 64:
gfx1201 returns lane l ^ 32, gfx1036 lane l). The model describes RDNA2, so on gfx12xx a
wave64 program with a ds_bpermute is skipped with that reason; under
--perturb bpermute_wave64_cross all of them match.
RX 9070 XT, AMD 26.11.2, --programs 1000, seeds 1 and 2: wave32 1000/1000; wave64 537 and 506
match, 0 mismatch, the rest skipped for the bpermute reason. --perturb bpermute_wave64_cross:
wave64 1000/1000. --perturb cmpst_swap: 275 of 1000 wave32 programs mismatch. gfx1036
unchanged: 1000/1000 in both wave sizes and both seeds.
AI-assisted (Claude Code).
The first version said "the same chip": the RADV runs are on another gfx1036 (a Ryzen 9 7950X3D's), where the two
Windows reports are a Ryzen 7 9700X's and one more. The 96 wrong words are lanes 32-63 of each wave on
32.0.21045.16010 and lanes 0-15 and 32-47 on 32.0.21042.62.
Added, measured here:
- the reported program and its 12-instruction reduction are exact natively under RADV as 192 threads and as one
64-thread group, with the driver's default subgroup size and with vk_compute_test --require-wave64 (the fuzzer's
native run does not request a subgroup size, so the Windows driver with --require-wave64 is listed as not checked);
- over the 26,503 shaders of the game, 2,293 use v_permlanex16_b32 and 27 a DPP op with a partial row_mask; 6 have
both, all wave32 compute, and in none does the shuffle read a register such a DPP op wrote last.
The "what to do" cell no longer recommends --wave64-emulate on: auto stays native on AMD's Windows driver for
RDNA1/2 because that driver can crash on emulated LDS code (#857).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
crosslane_fuzz.py --wave 64 --w64-native --dpp --no-maskdata --seed 82001 --programs 600 gives one native
mismatch on a gfx1036 integrated GPU with AMD's Windows driver (cs_xl64_8200346406, 96 words of v5; found by
Vonsek, reduced to 12 instructions by zzEmmazz). The same run is exact on the same chip under RADV (Mesa 26.3.1)
and on an RX 7900 XTX under RADV: 454 match, 0 mismatch, 146 hyp_only, natively and emulated; the program alone
and its reduction give 0 of 2,688 words off natively on both; and the hardware oracle on that gfx1036 matches
the model in all 600 programs.
docs/testing.md gets a "Known problems" row with the affected driver versions and the working setting
(--wave64-emulate on), and docs/shader_validation.md records the measurements in the FUZZ-7 section.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The libdrm launcher refused a kernel whose descriptor has a group segment
and capped its output at 4096 words, so lds_fuzz --oracle hw was exit 77
on Linux and no LDS program ran on RDNA2 outside Windows. Both are now
gone; docs/shader_validation.md records the gfx1036 counts.
- drm.py: program COMPUTE_PGM_RSRC2.LDS_SIZE (bits 15..23, 512-byte
units) from the descriptor's group segment instead of refusing it. The
assembler leaves that field 0 (measured: 4096 bytes of LDS give group
4096 and rsrc2 0x84), so the launcher fills it as the HIP runtime does.
Only scratch memory (private) and COMPUTE_PGM_RSRC3 stay unsupported.
- hw_oracle_drm.c: the output buffer takes 1..16384 words, matching the
Windows launcher, so a 64x64 image_fuzz case (16384 words) fits.
- asm.py: a wrapped (non-raw) kernel's LDS goes into its descriptor too,
so the Linux launcher has a group segment to read.
- lds_fuzz.py: the "more than 4096 words" wording no longer applies.
Tests: test_hw_oracle.py gains a descriptor unit test (group segment to
LDS_SIZE, 65536 ceiling) and two OnHardware tests (a kernel that writes,
barriers and reads back LDS; 8192 words from 1024 threads), plus a check
that LDS reaches the descriptor and metadata of a wrapped kernel. Verified
on the integrated Radeon of a Ryzen 7 7700X (gfx1036, RDNA2, Linux
7.3.5-zen1-1-zen, libdrm 2.4.134, AMD clang 23.1.5): lds_fuzz --oracle hw
--programs 500 --seed 1 matches 0 of 1000 (wave32+wave64) mismatches,
image_fuzz --oracle hw --programs 120 --seed 1 0 of 120.
AI-assisted (OpenCode).
docs/design.md: main's versions of the rows next to "Whole-quad mode",
with this branch's edit of that row, once (a both-sides merge listed it
twice; test_docs_design_rows). docs/shader_validation.md: main's file
plus the helper-lane section, nothing else.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crosslane_fuzz.py --oracle hw on an RX 9070 XT (gfx1201, Adrenalin 26.11.2,
amdhip64_7.dll, AMD clang 23.0.0git from the rocm-sdk wheels):
- --dpp, seeds 1 to 8, 1,000 programs each: all 8,000 match (984 hyp_dpp,
1,964 hyp_permlane, the counts of the RX 6700 XT run).
- --dpp-sweep --wave both: 14,412 cases, 14,412 match, 0 failing in every family.
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
The rocm-sdk wheels put `amdclang` in the Python environment's Scripts (bin)
folder. find_clang() takes it first, because it is on PATH and lists the amdgcn
target, but ld.lld and amdgpu-arch sit beside the real clang, in the folder the
launcher reports as InstalledDir. With the wheels in a Python outside the
checkout the oracle then stopped with "no ld.lld next to the AMD clang", also
when HIP_PATH named a complete toolchain, and LEONIDA_AMD_CLANG was the only
way around it.
find_clang() now returns the clang in InstalledDir when the one it found has no
ld.lld beside it. A clang that has its linker is used where it was found, and a
launcher that names a folder without a clang is kept, so every setup that
worked resolves to the same compiler as before.
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>