Commit Graph

555 Commits

Author SHA1 Message Date
c9f097eb50 Merge pull request #2419 from ProjectLeonida/fix/cvt-f16-denorm-and-clamp
rdna2spirv: preserve f16 denormals, NaN payloads, and bit-exact clamp in conversions (SHADER-CVT-F16-DENORM-AND-MODS)
2026-11-28 12:54:01 +01:00
87f12b9dcc Merge pull request #1587 from exoticLgk/fix-exp-f32-denorm
rdna2spirv: flush v_exp_f32 denormal results (SHADER-EXP-F32-DENORM)
2026-11-28 12:52:59 +01:00
11df2b0069 Merge pull request #1112 from klikso/carry/shader-f64-omods
rdna2spirv: the binary64 VALU ops take clamp and nothing else from their omod (SHADER-F64-OMODS-CARRY)
2026-11-28 12:52:22 +01:00
ca0827cdc2 Merge pull request #2026 from alexandersato0830/codex/gpu-runner-replay-no-cases
Reject GPU disassembly replays with no runnable tests (GPU-RUNNER-REPLAY-NO-CASES)
2026-11-28 09:04:32 +01:00
20264ffa0a Merge pull request #1978 from vinceychu/fix/run-gpu-tests-versioned-llvm-mc
run_gpu_tests: find a versioned llvm-mc when --llvm-mc and LLVM_MC are unset (TEST-RUN-GPU-TESTS-VERSIONED-LLVM-MC)
2026-11-28 09:04:22 +01:00
8509d368b1 Merge pull request #1333 from delysidemanYT1/gpu-runner-probe-json
GPU-RUNNER-PROBE-JSON: Treat valid JSON that is not an object as an u…
2026-11-28 09:03:12 +01:00
7734dc8e45 Merge pull request #1310 from delysidemanYT1/gpu-runner-output-decode
GPU-RUNNER-OUTPUT-DECODE: keep diagnostics with undecodable bytes
2026-11-28 09:03:01 +01:00
3e4d890c56 Merge pull request #2435 from quartz-heron-58/mesh-serial-waves
rdna2spirv: --mesh-serial-waves, an emulated mesh program's waves one after the other (SHADER-W64-MESH-SERIAL-WAVES)
2026-11-27 23:50:27 +01:00
e2377070d3 GPU tests: give cs_pk_mul_lo_const its 128 words, keep the exit message of a dump row
cs_pk_mul_lo_const runs 32 lanes that each store 16 bytes, 128 words, but
run_gpu_tests.py and check.py ran it without VKC_OUT_WORDS, so
vk_compute_test gave it the default 64 and lanes 16-31 wrote past the
buffer through its device address (GPU-AV:
VUID-RuntimeSpirv-PhysicalStorageBuffer64-11819). Both runners now pass
VKC_OUT_WORDS=128 (check.PK_MUL_LO_ENV), and the fixture's Run line
says so.

run_gpu_tests.py's dump rows (the bounds group, cs_heap_init,
cs_user_sgprs) showed the printed words whenever there were any. A run
that printed the right words and then exited non-zero (validation
errors) was a FAIL that showed only the expected words. dump_result now
reports "exit N: <output>" for a non-zero exit.

Found by kevincommits in the coordination issue (#1608).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 04:36:05 -06:00
dbdef2efd7 mesh-serial-waves: a GPU fixture whose two waves run loops of different length
ms_w64x_wave_loops: each wave loops while a wave-wide count is not 0, 5 iterations in wave 0 and 9 in
wave 1, so under --wave64-emulate the waves reach different numbers of workgroup barriers. Written after
stalls were reported with the serial form on an RTX 2070 SUPER (issue 1608). On an RTX 4080 (NVIDIA
621.24) it draws 4096/4096 pixels exact side by side and in series; that does not explain the stalls.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 17:29:50 +08:00
fbceecf042 mesh-serial-waves: unit tests, the design row, the GPU runner's switch
tests/test_mesh_serial_waves.py: the module shape of a program that
qualifies (64 invocations, the pass loop, the index from the built-in,
the exchange's own place, per-pass copies of the exports, one
OpSetMeshOutputsEXT), that every initialised Function variable is set
again per pass, and that ms_wave_info_s3 (LDS), a 32-thread program,
native wave64 and --mesh-compute are unchanged by the flag.

LEONIDA_MESH_SERIAL_WAVES=1 is read by scripts/run_gpu_tests.py, like the
other translation switches, and no longer by rdna2spirv.py itself.
docs/design.md and docs/testing.md say what the flag does and how it is
tested; conftest gives ms_w64x_wave_votes its 128-vertex PSV0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 11:29:22 +08:00
e954dc8c16 mesh-serial-waves: a GPU fixture whose waves vote differently; no memory writes in a serial program (work in progress)
ms_w64x_wave_votes: two waves take different branches, each with its own
ballot count (and a v_readfirstlane in the second), and the triangle's
vertices come from threads 0 and 1 of the first wave and thread 64 of the
second, so ms_tri's picture needs both waves to have run their own branch
with their own votes. It passes in the side-by-side form and with
--mesh-serial-waves on an RTX 4080 (NVIDIA 621.24).

A program with a store or an atomic to memory keeps the side-by-side
form, as one with LDS does: its waves could pass each other something.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 11:13:58 +08:00
df294dd8a1 rdna2spirv: preserve f16 denormals, NaN payloads, and bit-exact clamp in conversions (SHADER-CVT-F16-DENORM-AND-MODS)
Route v_cvt_f32_f16 through f16_in_bits so SDWA/DPP half selection, subnormals, neg/abs,
and IEEE=0 NaN sign/payload bits are preserved without raw UnpackHalf2x16 flush risk,
and clamp v_cvt_f16_f32 and v_div_fixup_f16 directly on rounded f16 bits via shared
clamp_f16_bits. Verified on RTX 3060 (driver 617.14, native + --wave64-emulate: fixed
first word 0x7FFFFFFF -> 0xFFC4A000 on cs_w32_cvt_f16_mods), 13/13 new semantic tests,
501-module semantic suite (6,385 passed, 0 failed), and 100/100 real corpus shaders
passing spirv-val.

AI-assisted: Codex gpt-6.2-sol + Antigravity gemini-4-neon.
2026-11-26 22:11:21 -03:00
aa3e217ac6 run_gpu_tests: find a versioned llvm-mc when --llvm-mc and LLVM_MC are unset (TEST-RUN-GPU-TESTS-VERSIONED-LLVM-MC)
run_gpu_tests.py and bench_wave64.py defaulted --llvm-mc to
os.environ.get("LLVM_MC", "llvm-mc"), so mc_command() never reached
versioned_llvm_mc(). With only Ubuntu's llvm-21 installed (llvm-mc-21 and
/usr/lib/llvm-21/bin/llvm-mc, no plain llvm-mc) the suite stopped with the
message that says that install is found without further setup. Leave the
default to mc_command(), and add a test that no tool pins the plain name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RAL8MMXUuNpQAVa1iiyAMP
2026-11-26 14:31:58 -05:00
c5f1807515 rdna2spirv: translate v_cmpx in DPP form (SHADER-VOPCX-DPP)
Extend #957's DPP VOPC compare to v_cmpx: the same lane selection, with the
result written to EXEC. v_cmpx prints no destination, so src0 is its first
operand. Only the forms where every lane writes its bit are taken, as for
v_cmp. 78 pipeline-library pixel shaders of 1.0.2.1 were refused for it; all
78 now translate and pass spirv-val.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 23:36:00 +01:00
0bae6f545a Merge main into wave64-partial-wave-zero
scripts/run_gpu_tests.py: main added cs_w32_wrxchg2_ext and
cs_w32_wrxchg2st64 to the same name list; keep main's list and add
cs_w64x_partial_swizzle to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 16:37:28 -05:00
d96b3a8644 Merge pull request #857 from ohshitwaddup/tests/gpu-wrxchg2-b32
tests: GPU fixtures for the ds_wrxchg2_rtn_b32 pair cases and ds_wrxchg2st64_rtn_b32 (TEST-WRXCHG2-B32-EXT)
2026-11-25 22:28:36 +01:00
fb5796b8ed Merge pull request #609 from TuroYT/fix/gpu-runner-tbuffer-verdict
run_gpu_tests: record the cs_tbuffer_store verdict (GPU-RUNNER-TBUFFER-VERDICT)
2026-11-25 22:27:40 +01:00
721a3b85ae Merge main into wave64-partial-wave-zero
Conflict in scripts/run_gpu_tests.py: the dump-test name list gained
cs_w64x_cmp_sdst on main and cs_w64x_partial_swizzle here; both are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 14:37:20 -05:00
85e522c3b0 Reject GPU disassembly replays with no runnable tests 2026-11-25 12:29:41 -06:00
188207a9d4 run_gpu_tests: ps_m15_dual is run by d3d12_translated_draw_test, like ps_m15 (RT-DUAL-SOURCE-BLEND review)
The generic pixel-shader harness picked up the new fixture and lost the device on an RTX 4060: it has no second
colour target and no SRC1 blend. d3d12_translated_draw_test --dual-source owns that draw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 12:08:24 +01:00
eb39d2765e rdna2spirv: flush v_exp_f32 denormal results 2026-11-25 05:33:06 +01:00
0819cfec80 Merge main (3ff2a2adc) into the #939 merge
Fourteen commits main gained after #968: #413, #1114, #1090 and #1491. Two conflicts, both in the shader check lists: scripts/run_gpu_tests.py imports both sides' cases, and tests/test_shader_checks.py counts eight cases next to COMPUTE (main's cs_w32_salu_ext) and #939's IMAGE_STORE_CASES table in place of main's fixed seven store shaders.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 21:23:42 -05:00
a9761ab2f9 tests: GPU fixtures for the ds_wrxchg2_rtn_b32 pair cases and ds_wrxchg2st64_rtn_b32 (TEST-WRXCHG2-B32-EXT)
docs/design.md's ds_wrxchg2_rtn_b32 row names cs_w32_new_ops as its fixture, and that fixture
compares only the first returned word and data1 in LDS. Four things the row states were therefore
never checked on a GPU: the second returned word, data0, the st64 step, and vdst aliasing the data
VGRs. The row's own note also records the non-st64 step indirectly only on gfx1100.

Two branchless fixtures, one lane each (32 lanes on one LDS address would race):

  cs_w32_wrxchg2_ext   both offsets on one dword: the first exchange returns the old word and the
                       second returns data0, not the word the first wrote; a neighbouring LDS word
                       is untouched; with vdst aliased onto the data VGPRs the data is read before
                       the result is written, so vdst gets the old pair and LDS the new one.
  cs_w32_wrxchg2st64   the st64 unit is 64 dwords: base 0x80 with offsets 1/2 addresses 0x180 and
                       0x280. 0x84/0x88 (where a 4-byte step would land) and 0x140/0x2c0 (one step
                       either side of the real elements) are seeded and must come back untouched,
                       which is what pins the stride rather than assuming it.

Both are registered in check.py (CS_DUMPS, WAVE32_DUMPS, WAVE32_LANE_DUMPS) and
scripts/run_gpu_tests.py, and judge all eight words in hex.

Measured on a Radeon RX 6900 XT (RDNA2, GFX1030, RADV Mesa 26.2.4, Nobara Linux 44), main d0da7da:
  build.py          283 shaders: 283 translated, 283 pass spirv-val
  check.py          217 of 222 pass, 3 skipped, 2 failed
  run_gpu_tests.py  233/251 passed, 16 skipped, 2 failed (native and LEONIDA_W64_EMULATE=1 alike)
  --filter wrxchg2  2/2 PASS both modes, every word exact (16/16)
The two failures in the full runs are cs_imgload_tfe and cs_imgload_d16_tfe, the pre-existing
SHADER-1266/#31 pair, unchanged by this commit.

No game files, nothing online. AI-assisted (Hermes Agent).
2026-11-25 08:53:57 +07:00
871e4b8b99 Merge pull request #1090 from milk4sale/test-w64-sdst-pair-gpu
tests: a GPU fixture and whole-corpus counts for one-register wave64 mask destinations (TEST-W64-SDST-PAIR-GPU)
2026-11-24 20:50:01 -05:00
8a57b3b1d3 Merge pull request #1114 from milk4sale/gpu-test/salu-ext
tests: GPU readback for 38 scalar ALU ops on run-time operands (GPU-SALU-EXT)
2026-11-24 20:49:40 -05:00
154e4ec034 Merge the #984 result (main + RT-PROTON-STORY-LOAD) into #939
The base is 8a242efeb, the merge of main and #984. 68 files conflicted; they were resolved in seven groups by
one rule: the same change in two forms keeps the base's form, everything only #939 has is kept, and where the
two solve one problem in two ways the base's is the frame and #939's plugs into it.

A, the Xbox proxy (d3d12_xs_device.cpp/.h, d3d12_xs.cpp, d3d12_xs_pso_stream.cpp/.h, d3d12_xs_alloc_size.h,
d3d12_xs_desc_clean.h, device_proxy_test.cpp, queue_proxy_test.cpp): the base's files with #939's additions
ported in. Device slot 57 asks #939's NativeGraphicsFactory first and falls back to the base's
proxy_create_graphics_pipeline_from_native_code on E_NOTIMPL. Kept from #939: the providers (texture lease,
raw texture view, resource by address, constant view, descriptor mapping, depth-stencil UAV, texture pages),
the title-backed descriptor mirror, slot 13's feature answers, GPU labels on list slots 71/72. Dropped: #939's
duplicates of the boot ladder routes, its fallback window, its slot 133 stand-in.

A2 (xs_proxy_mock_test.cpp): the base's test with #939's slot 70 raw-buffer case; presentation cases follow
#939's rule that a device which ever had a handler has no queue fallback.

B1, the Vulkan device (d3d12_vulkan_device.cpp, d3d12_com.cpp/.h, shader_library.h, queue_families.h,
pipeline_cache_file.h, startup_trace.h): one lazy-pipeline mechanism, the base's; #939's pending_base_compile
and first_use_backend_pipelines dropped, prepare_on_bind and cold_graphics_compile kept. create_texture keeps
the base's signature; #939's deferred backing is folded into the base's placed-memory binder. #939's quad
lists as triangle indices.

B2, the D3D12 tests (d3d12_existing_heap, a8_dimensions, pipeline_cache_seed, title_va, rect_list,
shader_library, loader_tls_index0, draw, compute, xmem_placed, shader_library_corpus): the base's tests where
both carry the same case, #939's cases added (rebound tables, linear texture map, large vertex batch,
executable shaders, default A8 views).

C, the backend (vulkan_replay.h, vulkan_backend.h, vulkan_bindless.h, vulkan_scratch.h, vulkan_present.h,
rect_list_geometry.h, vk_test_device.h, vk_pipeline_check.cpp, vk_store_test.cpp, bindless_sizing_test.cpp,
replay_texture_barrier_test.cpp): the base's prepare_draw and lazy compute, its #1055 release rule and its
rectangle generator; #939's rectangle variants, GPU quad index expansion, 1D/3D and depth-stencil UAVs, the
label fence on the base's submit.

D, memory, services, presentation (xmem.cpp/.h, xg_xs.cpp, xg_xs_test.cpp, title_va_alias.h and its test,
main.cpp, frame_pacer.h, xbox_present.cpp/.h; xgameruntime_offline.cpp for one comment): the base's xmem with
#939's label hooks, file-backed sections and pin_mapped_data; both texture computers in xg_xs.cpp, the base's
answering first; --first-run-ui kept without host speech in its profile.

E, build, tools, docs (runtime/CMakeLists.txt, make_game.py, tools/rdna2spirv.py, tools/shader_disasm.py,
scripts, tests, docs; docs/README.md and tests/test_exe_shaders_stage.py beyond the conflicts): the base's
v_dot4 decode, #281's disassembler form and tests/semantic/test_fspx_dot4_op_sel_disasm.py dropped; the
base's executable-shader step with #939's cache fix; 366 registered tests.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 20:26:00 -05:00
8f498bed96 rdna2spirv: the f64 VALU ops keep only clamp, not their omod
RDNA2 ignores the VOP3 output modifier of the f64 VALU arithmetic and rounding
ops while f64 denormals are kept, which is the MODE this translator models. I
measured it with tools/hw_oracle raw kernels on a gfx1036 iGPU (the Radeon
iGPU of a Ryzen 7 7800X3D, Windows driver 31.0.24002.92, code object v5),
wave32 and wave64 identical, over the four combinations of MODE.IEEE and
denorm_mode_16_64. mul:2 / mul:4 / div:2 changed nothing for v_add_f64,
v_rcp_f64, v_rsq_f64, v_sqrt_f64, v_trunc_f64, v_ceil_f64, v_floor_f64 and
v_rndne_f64 while f64 denormals were kept, applied only with MODE.IEEE off and
the denormals flushed, and clamp applied in every one of those runs. The two
f64 call sites that still forwarded a full modifier list now hand
clamp_mods_f64 only the clamp they act on, and the rows that described the
scaling for those ops are corrected to what the hardware does.

This is SHADER-721, the binary64 counterpart of the f16 omod row (#4542,
"an f16 destination ignores omod"). The row for v_add_f64 records the sweep and
how it was confirmed and keeps the LLVM VOP3 citation main already had; the
rcp/rsq/sqrt and rounding rows keep the measurements others contributed (the
v_sqrt_f64 ulp errors, @timelery's sweep of the four rounding ops) and only
change the sentence about the omod. One contradiction is removed on the way:
main's rounding row said the translator applies the modifiers "as those rows
do" while the code applied them to ops whose own row says they are ignored.

Ops with their own rows are left exactly as they are - v_cvt_f64_i32/u32,
v_cvt_f32_f64, v_frexp_mant_f64, v_div_fixup_f64 and v_ldexp_f64 keep what
their rows measure. The same rule probably reaches the first three as well, and
tests/semantic/test_alu_ldexp_f64.py already knows it for ldexp; I raised that
in #5256 as a finding instead of folding unmeasured ops into this change.

Counted over the whole corpus, not a sample: 216 v_add_f64 in 5 of the 26,503
listings, none carrying an omod or a clamp, and no f64 mnemonic in the corpus
carries one, so no game shader changes behaviour here. The two translated
fixtures that do carry a modifier move to the unmodified result, which is what
the sweep predicts: cs_f64_add now reads 0x0 0x3ff40000.

Expectations follow the rule in tests/semantic/test_valu_add_f64.py,
tests/semantic/test_f64_round.py, tests/test_f64_output_modifiers.py,
tests/test_f64_transcendentals.py and the two fixtures with their runners.
tools/f64_diff.py keeps its f64-omod case as a known divergence and
tests/test_f64_diff.py now expects it to mismatch the ISA reference rather than
match it: the reference applies the omod the ISA text describes, the translator
no longer emits it, and that case is the one MODE in which the hardware does
apply it. ps_f64_mods, cs_f64_add and ps_f64_round pass on an NVIDIA RTX 4090
(driver 32.0.16.2124) and on the gfx1036 iGPU above, 3/3 on both; cs_f64_add
reads the same words on Intel UHD 630 / Mesa ANV at this head (@gertify).
2026-11-25 00:45:11 +00:00
1bedab24c3 Merge pull request #1000 from Okachamie/gpu-pin-exit-status
Merging.

**Why merged:** GPU-PIN-EXIT-STATUS: in check.py and run_gpu_tests, a helper that exits non-zero is always a failure, never a subgroup-pin SKIP, so a crashing helper can't hide as a skip. KernelSmoker approved it after an RTX 3090 GPU run, and the author compared it against #125.

**Why it's good:** run_gpu_tests, shader_checks and run_gpu_tests_paths: 177 passed.

Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 0f98d193c. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests, ctest_registration) gives 578 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 18:22:17 -05:00
2376e7d56b Merge pull request #1063 from milk4sale/gpu-test/frexp-ldexp
tests, rdna2spirv: GPU readback for frexp and ldexp, and their neg/abs sources move the sign bit (GPU-FREXP-LDEXP, SHADER-FREXP-LDEXP-SIGN-MODS)
2026-11-25 00:20:58 +01:00
0c3acdc030 Merge main into gpu-test/salu-ext
Brings the branch up to date with main 68d1331e5. No conflicts; the merged tree was tested before the push (every standalone
test file under tests/ passes except tests/test_ci_registration.py, which fails on main alone since #930).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 16:31:08 -06:00
89f6c264ed Merge main into test-w64-sdst-pair-gpu
Brings the branch up to date with main 68d1331e5. No conflicts; the merged tree was tested before the push (every standalone
test file under tests/ passes except tests/test_ci_registration.py, which fails on main alone since #930).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 16:31:08 -06:00
2eb49b1a6f Merge main into gpu-test/frexp-ldexp
Brings the branch up to date with main 68d1331e5. No conflicts; the merged tree was tested before the push (every standalone
test file under tests/ passes except tests/test_ci_registration.py, which fails on main alone since #930).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 16:31:07 -06:00
7998d65400 Merge main into shader/round-f64-specials
Brings the branch up to date with main 68d1331e5. No conflicts; the merged tree was tested before the push (every standalone
test file under tests/ passes except tests/test_ci_registration.py, which fails on main alone since #930).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 16:31:06 -06:00
75a5d6e965 GPU-RUNNER-PROBE-JSON: Treat valid JSON that is not an object as an unavailable capability report in both launcher probes. The existing fallbacks, overrides and cache behavior remain intact. 2026-11-24 22:58:03 +01:00
aaf5926724 GPU-RUNNER-OUTPUT-DECODE: keep diagnostics with undecodable bytes 2026-11-24 22:40:36 +01:00
6261ca916e Merge pull request #957 from quartz-heron-58/vopc-dpp
Merging.

**Why merged:** SHADER-VOPC-DPP decodes and translates VOPC compares in DPP16/DPP8 form. `shader_disasm` gets a second llvm-mc pass that patches the word llvm-mc rejects to a `v_max_f32` stand-in, then restores the name and encoding. KernelSmoker approved it, Timon360SB ran it on Blackwell native and w64, and kawaii-shakal ran all 2,684 CS programs of the real library through it.

**Why it's good:** on the RTX 4070 SUPER, `scripts/run_gpu_tests.py --filter cs_dpp`:
- native: 9/10 pass, and `cs_dpp_w64` is skipped (no 64-wide compute subgroup on this device);
- with `LEONIDA_W64_EMULATE=1` under the Khronos validation layer: 10/10 pass, with no VUIDs;
- `cs_dpp_cmp` reads the expected `3 2 3 2 1 0 1 0`, and all 10 shaders pass spirv-val.

Own tests (dpp_compare, dpp_eager_subgroup, rdna2_decode, shader_disasm, run_gpu_tests*, docs): 207 passed, 0 skipped. The llvm-mc cases ran with a real AMDGPU llvm-mc.

Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 66d4f5aa3. With it in, the repo-consistency set gives 573 passed / 5 skipped / 0 failed, and check_no_game_data is clean. git merge-tree against current main: no conflicts. Security read of the three-dot diff: decoder and translator branches plus the tool changes above, with no binaries, downloads, network calls or CI changes. Heads-up from the PR body: this conflicts with #281 in `shader_disasm.py`, so #281 will need a rebase.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 16:04:56 -05:00
cec2c7074c tests: GPU readback for 38 scalar ALU ops on run-time operands (GPU-SALU-EXT)
No fixture in runtime/test/shaders ran s_sub_i32, s_andn2_b32, s_orn2_b32, s_xor_b32, s_ashr_i32, s_mul_hi_u32,
s_lshl3_add_u32, s_lshl4_add_u32, s_pack_ll_b32_b16, s_pack_hh_b32_b16, s_abs_i32, s_bcnt0_i32_b32, s_bitset0_b32,
s_bitset1_b32, s_brev_b32, s_flbit_i32, s_flbit_i32_b32, s_sext_i32_i8, the six s_cmp_*_i32, s_cmp_gt_u32,
s_cmp_le_u32, s_bitcmp0_b32, s_bitcmp1_b32, s_addk_i32, s_mulk_i32, s_cmovk_i32, s_ashr_i64, s_lshl_b64, s_lshr_b64,
s_bcnt0_i32_b64, s_bitset0_b64, s_cmov_b64 or s_ff0_i32_b64.

cs_w32_salu_ext gets sixteen operand words in s4..s19 from VKC_SGPRS, so each op reaches the driver as SPIR-V and
is not folded by the translator as an op on literals is. One thread stores every destination and four words of SCC
bits: SCC after each op that writes it, run on operands that set it and on operands that clear it, each compare
both ways, and SCC after each op that must keep it, set to 1 and to 0 in turn before them.

The 73 expected words are literals in check.py, derived in the fixture's header. tests/test_gpu_salu_ext.py
recomputes them from the fixture's own instruction lines with the reference of tools/salu_diff.py, checks that
every op that writes SCC is seen with both values, and checks the readback and both runners' verdicts.

The fixture is the first in the folder with bit 15 set in the immediate of a signed SOPK op (s_addk_i32 s52,
0x8000). tools/rdna2_decode.py gives that immediate sign-extended and llvm-mc 23.1.4 prints the same word as
0x8000, so test_parity_with_llvm_mc_on_shader_fixtures failed on it. That test now compares the immediates of the
ten signed SOPK ops as the 16 bits they are, as it already does for SOPP branch offsets, and a hand-encoded test
pins which of the sixteen ops the decoder sign-extends.

No translator, decoder or runtime change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 12:40:29 -06:00
9f1a072f70 tests: a GPU fixture and whole-corpus counts for one-register wave64 mask destinations (TEST-W64-SDST-PAIR-GPU)
SHADER-W64-SDST-PAIR makes the SGPR a wave64 VALU instruction names for a lane mask the pair it is on hardware. Its
own test compares the two printed forms on the interpreter; this adds what it does not have.

cs_w64x_cmp_sdst is written like the game's listings (no mattr line, so llvm-mc prints one register): six compares
and a carry-out whose pairs are read back across both halves by s_and_b64, s_or_b64, s_xor_b64, s_andn2_b64,
s_and_saveexec_b64, s_mov_b64 exec, s_bcnt1 / s_ff1 and SCC. RTX 4070 Ti (620.70.06, subgroup 32) under
LEONIDA_W64_EMULATE=1: the eight words its header derives; main before the rule gave none of them.

docs/design.md gets the counts over all 26,503 shaders: every one of the 292,733 one-register compares in wave64
code names an even register, 13,314 wave64 shaders read such a pair back, the rule's full translation passes
spirv-val 26,503 of 26,503, and 504 wave64 VS/PS leave SHADER-10 tier C (8,245 to 7,741).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 11:47:35 -06:00
5f063e5812 tests, rdna2spirv: GPU readback for frexp and ldexp, and their neg/abs sources move the sign bit (GPU-FREXP-LDEXP, SHADER-FREXP-LDEXP-SIGN-MODS)
v_frexp_mant_f32, v_frexp_exp_i32_f32, v_ldexp_f32, v_frexp_mant_f64 and v_frexp_exp_i32_f64 are lowered with
integer ops on the float's words, and no fixture in runtime/test/shaders ran any of them.

cs_w32_frexp_ldexp is memory-fed, like cs_w32_shift64: check.py seeds 64 records of a binary32 value, an ldexp
exponent and a binary64 value, and each thread loads one at run time and stores the five results, v_frexp_mant_f32
with a neg source, and v_ldexp_f32 with an abs source run with the odd threads turned off. The records cover the
exponent clamp, overflow and underflow, binary32 denormals, binary64 subnormals on both sides of the dword boundary,
zeros, infinities and NaNs. The expected words come from an oracle written from the rows of docs/design.md, checked
against math.frexp and math.ldexp in tests/test_gpu_frexp_ldexp.py.

On an RTX 4070 Ti (NVIDIA 620.70.06) six words were wrong: every NaN source under neg or abs came back as
0x7fffffff, the driver's default NaN. The binary32 branch applied the modifiers as FAbs and OpFNegate, from which
Vulkan lets a driver return any NaN. The three ops only move bits, so the branch now reads its source through
Gen.src_u_sign_mods, as the min/max family does. tests/semantic/test_alu_frexp_ldexp.py checks that the modifiers
are emitted as sign-bit ops. With that the fixture's 768 words are exact on the RTX 4070 Ti and on llvmpipe.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 11:32:48 -06:00
26d010b41d rdna2spirv: the binary64 roundings keep a NaN's bits and round a subnormal without the driver (SHADER-ROUND-F64-SPECIALS)
v_trunc_f64, v_ceil_f64, v_rndne_f64 and v_floor_f64 hand their source to the driver's double-precision Trunc,
Ceil, RoundEven and Floor. Vulkan lets a driver return any NaN for a NaN operand and, with no DenormPreserve for
64 bits, read a subnormal as zero, and cs_w32_round_f64 measured both: a signalling NaN came back quiet on an RTX
4070 Ti (NVIDIA 620.70.06) and on llvmpipe, and llvmpipe read the smallest subnormals as zero, so v_ceil_f64 of the
positive one gave +0. RDNA2 returns a NaN unchanged and keeps subnormals: that ceil is 1.

The two kinds of source are now selected with integer ops on the words, after the source modifiers and before the
output ones. A NaN's words pass through. A subnormal gives a zero of its sign, or 1 with its sign where the op
rounds that sign away from zero (ceil of a positive one, floor of a negative one). Every other source still takes
the driver's result.

cs_w32_round_f64 now compares all 1152 words exactly, on both devices. tests/semantic/test_f64_round.py runs the
four ops under a model of a driver that quiets a NaN and reads a subnormal as zero; without the change that class
fails for the signalling NaNs and for ceil and floor of a subnormal. The row in docs/design.md describes the rule
and how it was confirmed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 11:15:37 -06:00
355c8c9c2d tests: GPU readback for the binary64 roundings, v_trunc_f64, v_ceil_f64, v_rndne_f64 and v_floor_f64 (GPU-ROUND-F64)
The translator gives the four ops to the driver's double-precision Trunc, Ceil, RoundEven and Floor, and no
fixture in runtime/test/shaders ran them, so what a driver does with ties, the largest value below 0.5, values at
and above 2^52, signed zeros, subnormals, infinities and NaNs had never gone through the GPU suite.

cs_w32_round_f64 is memory-fed, like cs_w32_shift64 and cs_w32_cmp_f64: check.py seeds 64 inputs and each thread
loads one at run time and stores eight results: the four roundings, v_trunc_f64 with a neg source, v_ceil_f64 with
an abs source, a v_floor_f64 whose destination pair overlaps its source pair, and a v_rndne_f64 run with the odd
threads turned off, whose destination must keep the pair it held. The expected words come from Python floats
(exact IEEE-754, the result keeping its source's sign) and are checked against exact rational rounding in
tests/test_gpu_round_f64.py.

Two kinds of input are judged by what Vulkan lets a driver do, not by RDNA2: a NaN may come back as another NaN,
and a subnormal may be read as a zero of its sign, since the module declares no DenormPreserve for 64 bits. That is
what the fixture measured: on an RTX 4070 Ti a signalling NaN comes back quiet, and on llvmpipe the smallest
subnormals are also read as zero. The row in docs/design.md records both as an approximation. dump_test takes an
optional judge for such a readback.

No translator or runtime change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 11:04:58 -06:00
e55b3be88a tests: fail when a subgroup warning precedes a dispatch error 2026-11-24 11:43:12 -05:00
50407827cd tests: GPU readback for the binary64 vector compares, v_cmp_*_f64 and v_cmpx_*_f64 (GPU-CMP-F64)
The v_cmp_*_f64 / v_cmpx_*_f64 row of docs/design.md was CPU-checked and measured on native gfx1100, and no
fixture in runtime/test/shaders used a binary64 compare, so the SPIR-V those 32 ops translate to had not run on a
driver.

cs_w32_cmp_f64 is memory-fed, like cs_w32_shift64: check.py seeds 256 operand pairs, the product of 16 values
(+-inf, +-max, the 1-ULP neighbours of +-1, the smallest subnormals, +-0, the smallest normal, a NaN whose payload
is only in the low dword, a negative quiet NaN), and each of 128 threads loads two of them at run time. Per pair it
stores a v_cmp_ word (through VCC) and a v_cmpx_ word (through EXEC): one bit per predicate in opcode order, a bit
for tru run with the odd threads turned off (an inactive lane gets VCC 0 and stays off through v_cmpx_), and two
bits for lt and nge with VOP3 abs/neg. The expected words come from Python floats. Both GPU runners compare all
1536 heap words, the unchanged inputs included.

tests/test_gpu_cmp_f64.py checks, without a GPU, the oracle against an independent restatement of the 16
predicates, a few words worked out by hand, that the assembly gives every predicate the oracle's bit, and the
readback and runner verdicts. docs/testing.md describes the fixture and the row names it.

No translator or runtime change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 10:41:43 -06:00
98a977b4b7 Merge pull request #335 from milk4sale/gpu-test/cube-store
Tested 0d27fdcf9 merged locally onto main 1504c1af6: cs_imgstore_cube passes everywhere, and nothing else changes state.

Devices: RADV, Mesa 26.3.1, Linux:
- AMD Radeon RX 7900 XTX (RDNA3, gfx1100);
- Ryzen 9 7950X3D iGPU (RDNA2, gfx1036);
- llvmpipe.

New fixture, 10 runs each with run_gpu_tests.py --filter cs_imgstore_cube --require-pass:
- 10/10 natively and 10/10 with LEONIDA_W64_EMULATE=1 on all three devices, 0 bad for all three cube images;
- the validation layer, with sync validation on, reports nothing on either AMD GPU.

Regressions, main vs main + #335:
- Full run_gpu_tests.py on both GPUs, native and emulated: 232/250 → 233/251. The only change is the new PASS.
- Every existing vk_store_test fixture keeps its state.
- tests/test_shader_checks.py and tests/semantic/test_image_cube_store_glc.py pass on both trees.

CI: this head's checks are still queued on GitHub, so I ran the Linux jobs locally. They give the same result on both trees. The only failures are already on main:
- cs_imgload_tfe and cs_imgload_d16_tfe (#31, fixed by #892);
- tests/test_tool_stdout_encoding.py.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 17:21:28 +01:00
d4b3a001d2 Merge pull request #572 from DeSunShine/fma64-rt
rdna2spirv, docs: NVIDIA splits a binary64 Fma only when folding an all-constant one; add cs_div_fmas_f64_rt (FMA64-RT)
2026-11-24 10:50:14 -05:00
d046559435 rdna2spirv, shader_disasm: VOPC compares in DPP form (SHADER-VOPC-DPP)
Three pipeline-library compute programs of 1.0.2.1 hold v_cmp_gt_f32 with a
DPP16 or DPP8 src0. llvm-mc has no gfx10 decoding for the pair, so the
listing dropped the words and the programs were refused.

shader_disasm.py prints the pair through a VOP2 stand-in that takes the same
DPP word, rdna2_decode.py decodes it directly, and Gen.dpp_insn translates
the compare for the forms where every lane writes its bit. Other forms and
v_cmpx are refused: what an unwritten lane does to VCC is not measured.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 23:41:08 +08:00
5668f16b49 wave64 emulate: a cross-lane read of a missing lane in a partial wave gives 0
Restores old upstream PR 7450, ported onto main.

With --wave64-emulate, every read of another lane's exchange slot (ds_swizzle,
ds_bpermute, ds_permute, readlane, ...) now selects 0 when the source lane does
not exist in a partial last wave (Gen.x_lane_word), instead of relying on the
prologue's zeroed slot. RADV (Mesa 26.3.1) turned the store, barrier and load of
an exchange behind a branch into masked_swizzle_amd with fetch_inactive, so in a
40-thread group lanes 32-39 of a SWAP 8 swizzle read the missing lanes'
registers. Full waves emit the same module as before.

scripts/run_gpu_tests.py now runs the partial-wave fixtures emulated at subgroup
32, as check.py's partial_wave_test does. It left the subgroup size to the
driver, and RADV picks 64 for compute, where the new fixture passed even without
the fix.

GPU test cs_w64x_partial_swizzle (words measured on gfx1036 through
tools/hw_oracle), semantic test test_w64x_partial_swizzle with a hand-written
fixture, and a contract-table row in docs/design.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 09:18:49 -05:00
99168a5fae Run the VCC scalar-address readback through the standard GPU checks
Seed eight words in the synthetic shader and check them in both GPU runners. Keep the desktop TFE load cases registered alongside the volume-view cases.
2026-11-24 21:59:18 +08:00
aa8be9aef2 Integrate the offline first-run UI runtime with current main and the published renderer fixes
Use the tagged pipeline variants and indexed quad expansion from #722 and #682 with the shared shader cache. Retain title-backed index uploads, cross-queue scratch sharing, amd64 console return conventions and the PC/console caller discriminator. The local shader build indexes native containers and includes the executable's embedded stages.
2026-11-24 21:26:25 +08:00