Commit Graph

35 Commits

Author SHA1 Message Date
2c0ed64ae4 valu_fuzz: prevent oracle leak, validate CLI options upfront, and add stdlib tests 2026-11-26 19:55:26 +08:00
541ce95e78 Merge remote-tracking branch 'origin/pr/9718' 2026-11-23 17:24:41 -05:00
2ef6e128e1 valu_fuzz: a failed GPU child with the unpinned-subgroup warning is a harness error
run_translator took the "compute subgroup size: N not available" line as a
skip before it looked at vk_compute_test's exit status, so a child that
printed the warning and then failed was counted as skipped and the run could
still exit 0. Only a run that exited 0 is skipped for an unpinned subgroup
now, as lds_fuzz already does; a failed one is reported as ERROR and the
fuzzer exits 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:00:35 -03: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
d14b22fe00 fuzz: the gfx1170+ hardware gate is per family, not per tool
asm.rdna23_skip_reason refused every family of valu_fuzz.py and lds_fuzz.py
on gfx1170+ with "the kernels here do not assemble for it" (fef61b247), which
is false for most of what they emit. Checked by assembling what the
generators produce with AMD clang 23 (300 programs per wave size each):

- lds_fuzz assembles clean for gfx1150, gfx1170 and gfx1201 and runs there:
  on an RX 9070 (gfx1201, RADV/Mesa 26.2.6, the Linux DRM launcher) the
  default --oracle hw run gives wave32 500/500 match, wave64 250 match plus
  250 skipped for the committed wave64 bpermute reason, 0 mismatch,
  0 rejected. The blanket gate is gone; the per-program hw_skip_reason is
  the mechanism.
- valu_fuzz --family f16 assembles clean for gfx1150, gfx1170 and gfx1201
  (its op_sel lines are respelled by the runner's asm.opsel16_spelling
  there, which the assemble test now applies as well): 500 programs (1,000
  kernels, both wave sizes) 1,000/1,000 match, 0 rejected, and the negative
  control catches all six wrong models.
- valu_fuzz --family mem assembles clean for gfx1150 AND gfx1170 (every op
  kind, 0 of 600 kernels rejected per arch) but genuinely cannot on gfx12xx:
  GFX12 has no s_waitcnt_vscnt ("instruction not supported on this GPU")
  and rejects every buffer_load/store_b32/b64/b96/b128 form the generator
  writes ("operands are not valid for this GPU or mode"). The new
  hw_family_skip_reason refuses exactly that, naming both rejects, and
  --family mem --oracle hw exits 77 with them on gfx1201.

Running the lds hardware suite un-skipped on gfx1201 found one more
difference: a wave64 ds_permute_b32 reaches all 64 lanes on GFX12, like
ds_bpermute_b32. Measured on the RX 9070: every lane sending to lane
(l + 32) & 63 delivers its value to lane l ^ 32, all 64 lanes, with
lane-to-itself sending as the control; a masked wave64 ds_swizzle keeps
its halves there (0 mismatches in a 40-program --swizzle-exec run). Those
programs are skipped on gfx12xx now too, and the new perturbation
permute_wave64_cross models the crossing: under it every wave64 program
that runs in the --extended seed-1 run matches (23 of 40, 0 mismatch). The
lds negative control on gfx1201 reports the two wave64_cross perturbations
as not detected -- on GFX12 they are the measured behaviour, so the canary
cannot trip there; every other perturbation is caught.

asm.rdna23_skip_reason stays for the OnHardware guards of f32_fuzz and
f16_trans_sweep, whose MODE probes set IEEE and DX10_CLAMP, which gfx1170+
cannot encode (FUZZ-43); its docstring now says that instead of claiming
the fuzzers use it.

CPU: tests/test_valu_fuzz.py 88 OK, tests/test_lds_fuzz.py 37 OK,
tests/test_lds_fuzz_hw.py 44 OK (its OnHardware class runs on the RX 9070:
44 OK), tests/test_lds_fuzz_cli.py 8 OK, tests/test_hw_oracle.py 59 OK
(3 skips), tests/test_f32_fuzz.py 28 OK (1 skip), compileall clean,
scripts/check_no_game_data.py clean. The AMD-clang tests ran with
LEONIDA_AMD_CLANG=/opt/rocm/llvm/bin/clang. The semantic suite is
unchanged: its 47 failures (test_image_atomics_guard,
test_image_store_d16) are on the base commit too; nothing here touches
the translator.

AI-assisted (GLM-5.3).
2026-11-23 19:48:52 +01:00
7ec3056789 docs: point valu_fuzz at its --help usage line (#6642)
Squash-merged after diff review of PR #6642
2026-11-23 11:08:15 -06:00
4330cd60c1 Merge pull request #4410 from TG0000
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:14:29 -05:00
373c688468 Merge pull request #4388 from TG0000
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:14:16 -05:00
830cd6c71a Merge pull request #3978 from tedin7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:10:07 -05:00
8c73de5dc1 fuzz: bound pending valu_fuzz assembly futures 2026-11-23 02:25:09 +01:00
6d2dd8e6fc Let valu_fuzz assemble fixtures in parallel 2026-11-23 02:16:09 +01:00
387fe27fda fuzz: time out stalled Vulkan test processes in valu_fuzz 2026-11-23 01:54:05 +01:00
fef61b247c tools: the RDNA2/3 hardware fuzzers and tests skip on gfx1170+ instead of failing (TEST-873) 2026-11-22 23:45:21 +01:00
2eb82649cb fix: report unusable fuzzer work directories 2026-11-23 00:25:34 +02:00
1f81022095 tools: isolate fuzzer work output per run 2026-11-22 23:23:06 +02:00
78855ed7d6 Merge pull request #2608 from whoalin1 2026-11-22 13:16:32 -05:00
aca640bb41 valu_fuzz, lds_fuzz: support --pc-tail-ubo / LEONIDA_PC_TAIL_UBO=1
Add --pc-tail-ubo (also honoured via LEONIDA_PC_TAIL_UBO=1) to both
tools/valu_fuzz.py and tools/lds_fuzz.py so they pass --pc-tail-ubo to
rdna2spirv.py and LEONIDA_PC_TAIL_UBO=1 to vk_compute_test. Without this,
128-byte push-constant GPUs hit VUID-VkPushConstantRange-size-00298 /
VUID-vkCmdPushConstants-size-00371 (144 > 128) or skip/fail when fuzzing.

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
2026-11-22 19:37:24 +02:00
2753a632b5 valu_fuzz: order signed zeros in the f16 median model 2026-11-22 12:40:05 -03:00
ec9b6cf22b tools: text reports are written with LF line ends on every platform (BUILD-468)
open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly
listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/,
make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source
with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention.

AI-assisted (Claude), on behalf of dev-ewann.
2026-11-22 14:20:30 +00:00
1062df5154 Shader: accept abs on v_pack_b32_f16 (a sign clear of the packed half)
Follow-up to #1570, which took the `neg` half of SHADER-260 and left `abs`
refused. `abs` is the ISA's absolute value of the operand: a clear of the
sign bit, on the 16-bit half the operand contributes and applied before
`neg` (which #1570 emits as a bit 15 flip). The instruction already moved
each half unchanged, so the translator emitted nothing for `abs` and threw
`Unsupported("v_pack_b32_f16 abs modifier")` for any shader that used it.

Emit the clear instead: OpBitwiseAnd 0x7FFF on the selected half, before
the `neg` xor. No hardware run of this instruction with `abs` exists, so
the docs row says the rule is ISA-derived and unmeasured rather than
quoting a measurement.

Tests: exact-bit CPU cases in tests/semantic/test_pack_b32_f16_mods.py and
tests/test_values.py (both halves, op_sel, an sNaN payload, neg+abs order),
the interpreter-run GPU fixture ps_f16_pack_mods with its words derived
from the rule, and the row in docs/design.md.

SHADER-260, Depends on: #1570
2026-11-22 15:23:17 +02:00
cbb770ff65 Merge pull request #1447 from Claude 2026-11-22 07:07:47 -05:00
449cb7b460 fuzzers: skip wave32 runs vk_compute_test could not pin to 32 lanes
valu_fuzz.py, lds_fuzz.py and crosslane_fuzz.py ask vk_compute_test for
32-lane subgroups (VKC_SUBGROUP_SIZE=32) for wave32 programs, but they
ignored its "compute subgroup size: 32 not available" line. On a device
that can't pin that size (Mesa llvmpipe: 8 lanes) every wave32 program
was judged at the driver's size and its cross-lane results came out as
translator mismatches. On main f85582e with llvmpipe, lds_fuzz --emulate
--programs 400 --seed 5150 gave 215 mismatches, all wave32, and
crosslane_fuzz --wave 32 --no-maskdata gave 68 of 100.

Those wave32 programs are now skips, as check.py's unpinned_subgroup_skip
does for its lane-mask dumps. Programs translated with --wave64-emulate
use no subgroup operations, so they are still compared at any size
(400 of 400 match on llvmpipe). crosslane_fuzz counts the skips in its
summary and exits 2 when every program was skipped, as the other two
fuzzers already do.

The line is parsed by compute_fixture.unpinned_subgroup, shared by the
three fuzzers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:33:45 +00:00
f698bf2206 tools: a path outside the console's code page no longer crashes a tool's output
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").

tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:27:00 +00:00
eef40049f1 valu_fuzz: review fixes (signaling-NaN-only uncertainty, unjudged-word count, --skip-op validation, Kernel resource test)
mem translator path ran on the Radeon 880M: 400 of 400 match. Docs: --show line back in the options list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:35:23 +01:00
7c90988628 valu_fuzz: --oracle hw for the f16 and mem families (FUZZ-2, FUZZ-5)
Runs the same programs natively on the AMD GPU through tools/hw_oracle (wave32 and wave64) and compares them with the model. mem gains OOB_SELECT semantics (per-mode, per-dword), V#s in the GFX10 and GFX11 layouts, s_load and s_buffer_load; f16 writes op_sel forms the GFX11 assembler lacks as instruction words; --negative-control, --hw-sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:07:56 +01:00
e63bf6bdef mc_command.run: a missing llvm-mc is one line, not a FileNotFoundError traceback
Without llvm-mc, run_gpu_tests.py, valu_fuzz.py, lds_fuzz.py,
image_fuzz.py, crosslane_fuzz.py and runtime/test/shaders/build.py
ended in 'FileNotFoundError: [WinError 2]' from subprocess.run: the first
step of TEST-71 on a Windows machine without one. Only shader_disasm.py
said what was missing. mc_command.run() starts an llvm-mc command and
turns a command that can't be started into shader_disasm.py's message
(set LLVM_MC or --llvm-mc, build_llvm_mc.ps1, the WSL form); the six
llvm-mc call sites use it. tests/test_mc_command.py covers run() and
each tool with a nonexistent LLVM_MC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 03:02:20 -06:00
0706d57393 valu_fuzz mem: the structured V# says OOB_SELECT 1
The fuzzer's structured V# (stride SLOT, num_records = idx_slots elements) copied
word3 from the push-constant V#, which is RAW (OOB_SELECT 3) now. Under the
OOB_SELECT rule that checks the byte offset against num_records instead of the
index its model assumes, so it gets word3 0x11016fac (STRUCTURED). The raw V#
keeps s3. 30 mem programs match natively.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 07:40:20 +01:00
a6e3198607 Fuzzers: find vk_compute_test in a Visual Studio build
valu_fuzz.py and lds_fuzz.py ran <build>/vk_compute_test, so with the Visual
Studio generator (runtime/build/RelWithDebInfo) every program stopped with a
FileNotFoundError traceback. They now look in <build> and then its
RelWithDebInfo/Release folder, as run_gpu_tests.py does, and stop with one line
when it isn't built. crosslane_fuzz.py's default --exe gets the same fallback.
2026-11-22 09:37:03 +05:30
b5d15862fc docs: valu_fuzz --family f16 needs llvm-mc 21+; 18 runs the rest
docs/testing.md asks for LLVM 21+, but says a distribution's llvm-mc is
enough on Linux, and the fuzzer does not say what it needs. Measured with
Ubuntu 24.04's llvm-18 (18.1.3): valu_fuzz --family mem and lds_fuzz
assemble and run, but every --family f16 program fails, because 18
rejects op_sel on the 16-bit integer VOP3 forms; 23.1.6 assembles them.
Both places now say so.
2026-11-22 02:22:21 +00:00
6ad7bd17a1 Merge pull request #695 from SirAmong 2026-11-21 21:08:42 -05:00
57f98f79e6 docs: stale GPU-verified rows, runner note, duplicated section, pipeline_check and valu_fuzz docstring (PROC-21)
From SuarezPM's list in #634, each point checked against main first:
- design.md: ps_scc_mask32 is no longer "not run on a GPU yet" (it passes on
  an RTX 4050 native and emulated, a Radeon 740M and, per #634, an RTX 2060
  SUPER); ps_med3_mods, the nine ps_f16_* fixtures and ms_v5_workgroup also
  pass on the RTX 4050 and the Radeon 740M.
- shader_validation.md: the GPU runners are no longer "future work" (names
  the four tools); the 16-bit/memory section was duplicated verbatim (lines
  269-292 and 335-358), the second copy is removed.
- pipeline_check.md: vk_pipeline_check does create graphics pipelines
  (vkCreateGraphicsPipelines); what it does not do is draw with them.
- valu_fuzz.py: the mem family generates dword..dwordx4 only; the docstring
  listed byte and short forms that MEM_OPS never produces.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-21 21:02:36 -05:00
6bb076d10b valu_fuzz.py: validate --programs, --max-report, and --show via ap.error 2026-11-22 01:42:06 +00:00
91050d0cee valu_fuzz: drop the wave family; FUZZ-7 is @kotorvr's crosslane_fuzz.py 2026-11-22 01:09:53 +01:00
e9773f181d Tools: f16, buffer memory and cross-lane differential fuzzers on the GPU (FUZZ-2, FUZZ-5, FUZZ-7) 2026-11-22 01:04:35 +01:00