Commit Graph

233 Commits

Author SHA1 Message Date
182746f038 Merge pull request #2189 from vinceychu/hw-image-load-pck
image_fuzz: image_load_pck / image_load_pck_sgn on the hardware oracle, measured on RDNA2 (HW-IMAGE-LOAD-PCK)
2026-12-01 15:53:45 +01:00
ac58ddc504 fmisc_diff: do not judge the class bits of a NaN whose quiet bit is unmodelled
A fuzzed sNaN through v_fmamk_f32 into v_cmp_class_f32 flipped a result
bit on both Vulkan GPUs against the reference model. The model returns a
canonical quiet NaN for v_fmamk_f32, but on gfx1036 under the game's MODE
the hardware mostly returns the NaN source's word and only sometimes
quiets a signalling one (f32_hw_s5.log), so whether the result tests as
signalling or quiet is not something the model can know. Track registers
holding such a computed NaN (st["nanf"], set by v_fmamk_f32 with a
signalling or already-fuzzy NaN operand and propagated through the
pass-through ops and register moves) and raise Uncertain when
v_cmp_class_f32 reads one, instead of reporting a mismatch that is a
model gap, not a translator bug.

Co-Authored-By: Devin <noreply@cognition.ai>
2026-11-30 22:31:48 +00:00
fa2fd0a99a Merge pull request #2560 from jjjj2244/jjjj2244-patch-1
pk16_diff: generate the packed high-half constant read by default
2026-11-29 00:47:00 +01:00
d7565e4359 Merge pull request #1605 from GTAVIB4GTAVI/docs/shader-validation-dedup
docs/shader_validation: one copy of the SHADER-302 and ps_oracle sections (DOC-SHADER-VALIDATION-DEDUP)
2026-11-28 19:27:16 +01:00
3076269e93 Merge pull request #1478 from vsking2000/shader-div-scale-probe
Shader div scale probe
2026-11-28 12:41:07 +01:00
8cf8c854f7 Merge pull request #630 from Kal0s-design/feature/cf-gpu-run
cf_gpu_run: run the FUZZ-8 control-flow programs on a Vulkan GPU (FUZZ-8-GPU)
2026-11-28 09:02:28 +01:00
0ab5ccd213 docs/shader_validation.md: the constant high-half reads are generated 2026-11-28 13:46:40 +09:00
6d1b27b3a0 docs/shader_validation: one copy of the SHADER-302 and ps_oracle sections (DOC-SHADER-VALIDATION-DEDUP)
Repeated merges left "Packed 16-bit integer operations on RDNA2 (SHADER-302)" in the file four
times and "Pixel-shader ISA on the hardware" twice: 2d3369a4c (a merge of origin/main into
main) tripled SHADER-302 as SHADER-681's helper-lanes subsection came in, af1b3c96d merged
#3061 a second time, and #3499's --format table then landed in only one ps_oracle copy. One
SHADER-302 copy went in as a bare heading and its bullets in the middle of the RADV paragraphs.

Keep one of each, in the order a66a71ffd had them before the repeats, with the two real
additions in place: #3499's --format paragraph and table (0d58747e0) and SHADER-681's helper
lanes (58bc80c33). Every kept line is main's own text; the only line dropped that is in no
remaining copy is the "Limits: ... mrt0 as RGBA32F only" line that 0d58747e0 itself replaced.
Deletions only, so #1037 and #1039 (which insert after the first SHADER-302 copy) still merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: coolpilot904 <andrewjsottile@icloud.com>
2026-11-26 00:04:12 -05:00
790b4f4364 image_fuzz: image_load_pck / image_load_pck_sgn on the hardware oracle, measured on RDNA2 (HW-IMAGE-LOAD-PCK)
design.md had no measured rule for the no-format-conversion image loads.
Measured natively on an RDNA2 iGPU (gfx1036) through tools/hw_oracle: the
texel's bytes form little-endian dwords selected by dmask (0 past the last),
a texel under 4 bytes is zero-extended (pck) or sign-extended from its top
bit (pck_sgn), and the FORMAT's numeric type does not matter.

image_fuzz.py gets --op image_load_pck|image_load_pck_sgn for the hw oracle,
the pck_oracle CPU model, sub-4-byte texel formats, a pck_sgn_zero_extend
perturbation and a wrong-FORMAT control that changes the texel size;
tests/test_image_fuzz_hw.py pins the measured words. The translator does not
translate these ops yet; this is the measured model it needs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RAL8MMXUuNpQAVa1iiyAMP
2026-11-25 22:55:38 -05:00
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
aea8ca5968 div_scale_probe: preset D with a sentinel, pin the divide sequence, isolate the denormal-S1 branch
Review follow-ups for SHADER-DIV-SCALE-PROBE.

- D is written with a sentinel (no operand of the matrix and no candidate
  prediction equals it) before every v_div_scale of the plain and modifier
  kernels, so a D that is not written is reported (d_unwritten: summary line,
  --json field, --table marker) instead of reading as the previous row's value.
  The docstring and docs say that D = S0 where no branch assigns it is an
  assumption applied in every candidate, and name the emulator that initialises
  D differently.
- The f32 divide sequence omits LLVM's s_denorm_mode switch: the summary labels
  the f32 tallies of the MODEs that flush f32 denormals as not comparable with
  LLVM's lowering (llvm_comparable in the JSON), with a note.
- New pair 2^-60 [2^-284] over the smallest denormal: a gap below 96 [768], so
  the denormal-denominator branch is reached and not the gap branch. 49 pairs,
  108 rows per width.
- A run without --json ends with a line saying the summary is not the
  measurement. --json has mask_lo/mask_hi instead of the bare list; --table
  starts with a legend.
- isa_recip_width is described as the same text with the reciprocal classified
  in the operand's width; docstring and test references to a docs/design.md row
  that does not exist point at the docs/shader_validation.md section.
- tests: the preset and sentinel before every v_div_scale, the sequence against
  a hand-written table of LowerFDIV32/LowerFDIV64 and as a division on exact
  arithmetic, an unwritten D, the labels, the legend, a cr_ftz verdict.

AI-assisted.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y7fbZYVY7EtLknWBZUfSLf
2026-11-25 00:29:45 +00:00
a2209ec35d tools: div_scale_probe measures v_div_scale on GFX10 hardware (SHADER-DIV-SCALE-PROBE)
The translator refuses v_div_scale_f32/f64: the ISA text, the D = S0
pass-through LLVM's divide lowering relies on and the rule tinygrad's
RDNA3 emulator runs disagree at the edges, so the rule has to come from
a measurement. tools/div_scale_probe.py makes that one command on a
GFX10 GPU, built like tools/f64_omod_probe.py on tools/hw_oracle: raw
one-lane kernels, the five MODEs of that probe (game MODE first), wave32
and wave64.

Per width it runs 48 numerator/denominator pairs (special, denormal,
exponent gap 95/96/97 [767/768/769], denominators around 2^126 [2^1022],
quotients around 2^-126 [2^-1022], numerator fields 22/23/24
[52/53/54], ordinary) as the denominator and the numerator call, plus
10 S0 = S1 = S2 cases, each with VCC and with an SGPR mask destination
preset to all ones; 30 modifier rows; and LLVM's whole divide sequence
on every pair. Each row prints next to it what three candidate readings
predict (the newer ISA wording, the text with an f32-width reciprocal
test, tinygrad's emulator rule), so a run shows which one the hardware
follows. Not run on hardware; no rule goes into the contract table.

tests/test_div_scale_probe.py checks the matrix and its boundaries, the
candidates' known disagreements (including the 1.0 / 2^127 -> +inf
divide through the translator's measured v_div_fmas/v_div_fixup),
assembly with llvm-mc, and parsing and the CLI with a fake oracle.
docs/shader_validation.md documents the tool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y7fbZYVY7EtLknWBZUfSLf
2026-11-24 23:36:17 +00:00
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
0ce4c5da8c cf_gpu_run: run the FUZZ-8 control-flow programs on a Vulkan GPU
tools/cf_diff.py checks the generated control-flow programs against two
CPU models only (cf_ref and the SPIR-V wave interpreter), so nothing
showed what a driver does with the translated control flow: how it
reconverges after a divergent if/else, a per-lane loop with a break mask
or a saveexec idiom.

tools/cf_gpu_run.py takes the same programs, turns each into a one-wave
compute program that stores v8..v11 of every lane, runs it through
vk_fuzz_run (translator + vk_compute_test) and compares every lane with
cf_ref, in wave32 and in wave64 (LEONIDA_W64_EMULATE=1 on a 32-wide GPU).
Before a campaign it runs a control, a reference with a flipped branch
that must differ from the GPU's result, and does not start if that fails.
A skipped program is counted with its reason and is never a pass. Exit
status: 0 no mismatch, 1 mismatch (minimised in summary.json), 2 nothing
ran, 3 control failed.

vk_fuzz_run.run_programs gets encoded=True for complete listings that
already carry `; encoding:` byte counts, so they skip llvm-mc. A program
the translator does not translate now reports the translator's last
error line.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-24 10:51:36 +01:00
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