Commit Graph

221 Commits

Author SHA1 Message Date
7ea654f9ac docs/shader_validation.md: document tools/d16_image_probe.py and tools/semantic_mutants.py (DOC-SHADER-VAL-D16-MUTANTS) 2026-11-25 17:33:21 +05:30
a9bed902d2 rdna2spirv: VOP3 clamp of a NaN gives +0 (DX10_CLAMP)
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>
2026-11-24 16:10:13 +05:30
d8db7715c7 docs/shader_validation.md: salu_diff has 117 opcodes in OPS and draws from 104 by default 2026-11-24 07:31:31 +05:30
b7fb698e51 docs: clarify the default salu_diff opcode pool 2026-11-24 07:30:17 +05:30
be64e8c7af docs: salu_diff generates 99 opcodes by default; v_pack_b32_f16 abs is implemented (#5519, #5517) 2026-11-24 07:30:17 +05:30
e10ec61417 Merge remote-tracking branch 'origin/pr/8987' 2026-11-23 17:40:56 -05:00
d0c0fe437a Merge remote-tracking branch 'origin/pr/8988' 2026-11-23 17:40:56 -05:00
f8867d72f0 valu_fuzz: refuse --gfx10-word3 on GFX12; docs say which mem ops need the sync
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>
2026-11-23 16:16:12 -05:00
7e2a9fb050 valu_fuzz: the mem family runs natively on GFX12 (RDNA4)
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>
2026-11-23 16:12:13 -05:00
6d9e4ac669 Add a wave32 shader checkpoint report 2026-11-24 01:25:23 +05:30
e3edd59a18 BUILD-1447: root-cause --bary-fallback PS deltas and fix %bary half-slot collision 2026-11-23 16:47:06 -03:00
d5564ef07b Merge remote-tracking branch 'origin/main' into gfx12-fuzz-gate 2026-11-23 19:52:01 +01:00
8e4dd026b5 docs: record the gfx1201 valu_fuzz and lds_fuzz hardware runs
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).
2026-11-23 19:48:55 +01:00
12806e56b7 docs/shader_validation: name tools/ab_control_flow.py with the GPU-side runners (EGEN-AB-CTRLFLOW-DOC) (#6545)
Squash-merged after diff review of PR #6545
2026-11-23 12:48:41 -06:00
77fa308f9a ps_sweep: reject incomplete readbacks in cross-GPU comparisons (#6586)
Squash-merged after diff review of PR #6586
2026-11-23 11:22:49 -06:00
5e54bda2e6 tools/div_fixup_diff.py: generate the f16 and f64 output multipliers (#6314) (#6698)
Squash-merged after diff review of PR #6698
2026-11-23 10:55:11 -06:00
db77244402 tools/wave_diff.py: CPU-only differential fuzzer for wave and cross-lane ops (wave32 and wave64) (#3592)
Squash-merged after diff review of PR #3592
2026-11-23 10:03:02 -06:00
e1b51bf95c Exercise bounded integer 2D texel fetches in the pixel sweep (#6785)
Squash-merged after diff review of PR #6785 - Exercise bounded integer 2D texel fetches in the pixel sweep
2026-11-23 09:52:44 -06:00
2c76ce6e3e shader_validation: name tools/spirv_asm.py, the stdlib SPIR-V assembler (EGEN-SPIRVASM-DOC) (#6888)
Squash-merged after diff review of PR #6888 - shader_validation: name tools/spirv_asm.py, the stdlib SPIR-V assembler (EGEN-SPIRVASM-DOC)
2026-11-23 09:47:43 -06:00
a3db25c749 docs/shader_validation: name tools/f64_omod_probe.py and its measured omod gate (#6904)
Squash-merged after diff review of PR #6904 - docs/shader_validation: name tools/f64_omod_probe.py and its measured omod gate (EGEN-F64OMOD-DOC)
2026-11-23 09:46:07 -06:00
413ffd6eb2 test(image-fuzz): exercise noncontiguous masks by default (#6894)
Squash-merged after diff review of PR #6894 - test(image-fuzz): exercise noncontiguous masks by default
2026-11-23 09:44:21 -06:00
a66e6e30d3 docs/shader_validation: f32_fuzz has no Vulkan oracle, so drop it from the --oracle hw,vk section (EGEN-DOCS-F32-FUZZ-VK) (#6911)
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)
2026-11-23 09:43:28 -06:00
a284bad1e9 pk16_diff, vint_diff, sdwa_diff, wint_diff: --oracle hw,vk runs the translated programs on a Vulkan GPU (#6306)
Squash-merged after diff review of PR #6306 - pk16_diff, vint_diff, sdwa_diff, wint_diff: --oracle hw,vk runs the translated programs on a Vulkan GPU
2026-11-23 08:25:41 -06:00
2e52b2f1d7 Docs after round 44: one row per topic, escaped literal pipes, one copy of each repeated line and list item, one i18n row per language
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>
2026-11-22 23:24:16 -05:00
d36edbe267 Merge pull request #4628 from kapitche
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:16:37 -05:00
d35ac22687 Merge pull request #4623 from YaBulochka
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/design.md
2026-11-22 23:16:34 -05:00
44a9d615e2 Merge pull request #4536 from iurysf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:15:41 -05:00
a90289cbb4 Merge pull request #4519 from Størm
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:15:30 -05:00
c33196304f Merge pull request #4075 from 0xTehuti
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:11:02 -05:00
d3184355a4 Merge pull request #4042 from Jan Trencansky
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/testing.md
2026-11-22 23:10:43 -05:00
bdf45c6030 Merge pull request #3954 from errusso
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:09:52 -05:00
7db1e35da1 Merge pull request #3949 from PeterGrieffindor
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:09:50 -05:00
57abbbe1a4 Merge pull request #3770 from Yawnz
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/shader_validation.md
2026-11-22 23:08:23 -05:00
210813af2a Merge pull request #3666 from AwkGrep256
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/design.md
#	docs/shader_validation.md
2026-11-22 23:08:11 -05:00
51013b44bf Merge pull request #3499 from Vonsek
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:07:34 -05:00
af1b3c96d2 Merge pull request #3061 from Vonsek
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/shader_validation.md
2026-11-22 23:06:42 -05:00
911aead5ac Draw a stratified sample of translated pixel shaders on two GPUs and compare (vk_ps_sweep, tools/ps_sweep.py) 2026-11-22 22:27:18 -05:00
79dfd24a30 Typed buffer loads keep a half NaN's payload, measured on gfx1036
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.
2026-11-23 06:19:54 +03:00
7bd5f01dd1 FUZZ-55: Route --oracle hw through hw_oracle, fix zero-sum sign, pin the reference
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>
2026-11-22 23:55:19 -03:00
dbe5070d18 lds_fuzz: run the hardware oracle on GFX12 (RDNA4); wave64 ds_bpermute reaches all 64 lanes there
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).
2026-11-22 20:58:48 -05:00
50b889e3c1 FUZZ-55: Harden binary64 differential probes
AI-assisted (OpenBot team).

Explicitly count FTZ and implementation-defined GPU precision skips, execute known divergence probes, correct compare modeling, and reuse prepared GPU context when shrinking. CPU campaigns and RTX 4070 Vulkan shaderFloat64 campaigns finished with zero unexpected mismatches.

Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
2026-11-22 22:57:33 -03:00
fcda84bb0d Merge hw4-ps-oracle into hw4-ps-formats (#3499)
docs/shader_validation.md
tools/ps_oracle.py

AI-assisted.
2026-11-23 00:19:13 +01:00
a96cf503b1 hw_oracle: retry probe as code object v5 on hip error 303 as well as 209 2026-11-23 00:16:43 +01:00
ef3fe9ff14 Docs: the SHADER-705 note names the gfx1036 that ran under RADV and counts the failing shape in the corpus
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>
2026-11-22 17:57:00 -05:00
59069d0497 Docs: the native wave64 mismatch on gfx1036 is AMD's Windows driver, not the translator (SHADER-705)
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>
2026-11-22 17:47:22 -05:00
f23b69060c hw_oracle (Linux): run the LDS fuzzers through libdrm
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).
2026-11-22 23:40:40 +01:00
8744504763 Merge main into ps-helper-lanes (#3061 and #3273 are on main)
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>
2026-11-23 01:40:15 +03:00
16a53cd532 shader_validation.md: cross-lane and DPP sweep hardware results on RDNA4 (gfx1201)
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>
2026-11-23 00:37:22 +02:00
8c799453fb hw_oracle: an amdclang launcher on PATH is followed to the clang it is installed as
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>
2026-11-23 00:37:22 +02:00
3986b50821 Merge main into hw4-ps-oracle (#3061)
docs/shader_validation.md

AI-assisted.
2026-11-22 23:21:41 +01:00