Skip to content

Tests: GPU and CPU checks for the untested d16_xyz/d16_xy typed-buffer forms - #2039

Merged
ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:test/cov-d16fmt
Nov 22, 2026
Merged

ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:test/cov-d16fmt

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

Requested by Lucas · project thread

Claimed in the coordination issue as: EGEN-COV-D16FMT (#1902 (comment))

What and why

An opcode inventory of tools/rdna2spirv.py against main (every opcode the translator handles, checked against runtime/test/shaders/*.asm, tests/** and the fuzzers' tables) finds d16 typed-buffer forms that no test runs. This adds a GPU test and a tests/semantic check for four of them:

buffer_load_format_d16_xyz, tbuffer_load_format_d16_xy, tbuffer_load_format_d16_xyz, buffer_store_format_d16_xyz.

The d16_x forms (buffer_load_format_d16_x, tbuffer_load_format_d16_x) are left out: #1759 and #1885 exercise them.

runtime/test/shaders/cs_fmt_d16_xyz.asm (one thread) writes its inputs at 0x100, then:

  • six loads: MUBUF d16_xyz from a 16_16_16_16_UINT and a 32_32_32_UINT V# (the second clamps 0x10000 and 0xffffffff to 0xffff), MTBUF d16_xy from 16_16_FLOAT, and MTBUF d16_xyz from 16_16_16_16_FLOAT, 8_8_8_8_UNORM (0 and 255 only, so no rounding question) and 32_32_32_UINT. Each _xyz destination's second VGPR is seeded first, and its high half must survive (the d16 rule in docs/design.md).
  • two MUBUF d16_xyz stores into 32_32_32_UINT (16-bit values zero-extended) and 32_32_32_FLOAT (f16 widened), each into a region whose fourth word must stay untouched.

All 80 words of the heap are compared (results, untouched fill, inputs). The derivation from the ISA and the design.md rules is in the header; registered in check.py (fmt_d16_xyz_test) and run_gpu_tests.py, with the harness case in tests/test_shader_checks.py. test_value_semantics.py runs the same fixture through the interpreter with the expected words written from a small Python model (f16 via struct, the 16-bit clamp, the kept high half).

No translator change: all four match on both GPUs.

Tested

Windows 11, python -I scripts/run_gpu_tests.py --filter cs_fmt_d16_xyz:

GPU driver result
AMD Radeon (RDNA2 iGPU, Ryzen 9 9950X3D) 26.10.1 PASS, 80/80 dumped words exact
NVIDIA GeForce RTX 5080 616.92 PASS, 80/80 dumped words exact

Negative control: in buffer_load_format, the odd final d16 component written with self.dst instead of self.write_lo16 (one line, so the high half is cleared). cs_fmt_d16_xyz fails on both GPUs (word 1: expected 0xa5a57fff, got 0x00007fff) and test_d16_xyz_typed_buffers fails at the five _xyz second words. Reverted.

python -m unittest discover -s tests/semantic OK, python tests/semantic/regen_fixtures.py --check clean, python -I tests/test_shader_checks.py and python -I tests/test_run_gpu_tests.py OK.

AI-assisted.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No new rule.)

…r forms

buffer_load_format_d16_xyz, tbuffer_load_format_d16_xy/_d16_xyz and
buffer_store_format_d16_xyz were translated but no test ran them. Add the
GPU test cs_fmt_d16_xyz (one thread; integer, f16 and UNORM8 loads with the
kept high half of an odd final component, the 16-bit clamp of 32-bit UINT
channels, and stores into 32_32_32_UINT and 32_32_32_FLOAT), compared over
the whole 80-word heap, and run the same fixture in test_value_semantics.py.

AI-assisted.
@tylerstraub

Copy link
Copy Markdown
Contributor

Tested b87dc1e9af21b11375c29dfa1046232eccbed2db on NVIDIA GeForce RTX 5090, 595.99.02 (Linux).

Independent Vulkan check of b87dc1e9af21b11375c29dfa1046232eccbed2db on NVIDIA GeForce RTX 5090 (595.99.02, Linux 7.0.0-43-generic, LLVM 21.1.8, SPIRV-Tools v2026.1). AI-assisted. Synthetic input only.

Built the Vulkan harnesses at the pinned head and ran scripts/run_gpu_tests.py --filter cs_fmt_d16_xyz. The shader translated, passed SPIR-V validation, and matched all 80 dumped words. That includes the packed UINT and float loads, UINT saturation, preservation of the seeded upper half in the three-component loads, both typed stores, and the untouched words.

The targeted test_d16_xyz_typed_buffers semantic test and all 60 test_shader_checks.py tests passed. GPU coverage was limited to this fixture.

AI-assisted verification.

@Rainmaker33

Copy link
Copy Markdown

Tested b87dc1e on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass.

The PR's diff applied cleanly to main 4eb6155. VS 2022, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8; harness programs from a CMake build of that main; overlay layers off.

  • scripts/run_gpu_tests.py: 137/181 pass, 44 skipped (wave64), no failures (main: 136/180). cs_fmt_d16_xyz: 80/80 dumped words exact.
  • tests/semantic/test_value_semantics.py: OK.

@fernquill

Copy link
Copy Markdown

Tested b87dc1e merged into main 4eb6155 (clean merge) on AMD Radeon RX 9070 XT (RDNA4, gfx1201), RADV Mesa 26.3.1, Arch Linux, kernel 7.3.5; llvm-mc 23.1.5, SPIRV-Tools 2026.4; runtime built from main 4eb6155: pass.

  • tests/test_shader_checks.py: 60 OK. The whole semantic suite: 1672 OK.
  • scripts/run_gpu_tests.py: 168/181 passed, 13 skipped, 186/186 translated and valid. cs_fmt_d16_xyz PASS.
  • check.py: 156/161, 4 skipped (the one failure is cs_fma_fused, as on main, GPU tests: wire cs_fma_fused in run_gpu_tests and accept GLSL Fma split on RADV #1518). cs_fmt_d16_xyz ok.
  • Test by test against main 4eb6155 on the same machine: the only change is the new test (absent → PASS in both runners), so no regression. This adds AMD/RADV to the RTX 5090 run above.

AI-assisted (Claude Code).

@crastinator

Copy link
Copy Markdown
Contributor

Tested b87dc1e merged into main 4eb6155d (clean merge) on AMD Radeon RX 6700 XT (Navi 22, gfx1031, subgroup 32..64), RADV Mesa 26.3.1, CachyOS, Linux 7.3.5, GCC 16.2.1, llvm-mc 23.1.5: pass.

  • New test passes natively: cs_fmt_d16_xyz (80/80 dumped words exact).
  • Whole run_gpu_tests.py: 168/181 native, 168/181 with LEONIDA_W64_EMULATE=1. The skips are the D3D12-only fixtures and ps_w64x_readlane (RADV can't require a 64-wide fragment subgroup), the same as on main.
  • ctest: 36/36.
  • tests/semantic/test_value_semantics.py, tests/test_shader_checks.py: 93 passed, 325 subtests passed.

No game files. AI-assisted (Claude Code).

@gkissel

gkissel commented Nov 22, 2026

Copy link
Copy Markdown

Tested b87dc1e9 (on 4eb6155, its base) on an NVIDIA GeForce GTX 1650 Mobile (Turing TU117), NVIDIA 620.70.06, Vulkan 1.4.357, CachyOS Linux: pass. This is a Turing data point next to the Ampere, Blackwell and RDNA2 runs.

  • LEONIDA_VK_DEVICE=1650 python -I scripts/run_gpu_tests.py --build runtime/build/linux --filter cs_fmt_d16: 1 translated, 1 passes spirv-val; cs_fmt_d16_xyz PASS, 80/80 dumped words exact.
  • The same with LEONIDA_W64_EMULATE=1: PASS, 80/80.
  • python -I tests/test_shader_checks.py OK; python -m unittest discover -s tests/semantic OK.

AI-assisted (Claude Code). No game files used.

@dandasma

Copy link
Copy Markdown
Contributor

Tested b87dc1e on AMD Radeon RX 9070 (RDNA4, subgroup 32..64), AMD 26.10.1 (LLPC), Vulkan 1.4.359, Windows 11 26300: pass. Python 3.12.10, llvm-mc 21.1.8, Vulkan SDK 1.4.363.0; harness programs built from main 4eb6155 (this PR's base; it changes no C++), with LEONIDA_VK_DEVICE=9070 so no other GPU could take the run.

  • build.py: 200 shaders, 200 translated, 200 pass spirv-val (main: 199; the one added is cs_fmt_d16_xyz).
  • check.py: 157 of 161 pass, 4 skipped, cs_fmt_d16_xyz ok (main: 156 of 160, the same 4 skips).
  • run_gpu_tests.py --filter cs_fmt_d16_xyz: 1/1 in three runs, 80/80 dumped words exact each time.
  • Full run_gpu_tests.py: 168/181 passed, 13 skipped, 0 failed (main 4eb6155: 167/180, the same 13 skips: 12 D3D12-run fixtures and ps_w64x_readlane).
    AI-assisted (Claude Code).

Conflicts:
	scripts/run_gpu_tests.py
	tests/semantic/regen_fixtures.py
	tests/test_shader_checks.py

AI-assisted.
@ItsNotRexed
ItsNotRexed merged commit 66ff7cb into ItsNotRexed:main Nov 22, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants