Skip to content

tests: a GPU fixture and whole-corpus counts for one-register wave64 mask destinations (TEST-W64-SDST-PAIR-GPU) - #1090

Merged
ubiquitarianism merged 3 commits into
ProjectLeonida:mainfrom
milk4sale:test-w64-sdst-pair-gpu
Nov 25, 2026
Merged

ubiquitarianism merged 3 commits into
ProjectLeonida:mainfrom
milk4sale:test-w64-sdst-pair-gpu

Conversation

@milk4sale

@milk4sale milk4sale commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Item: TEST-W64-SDST-PAIR-GPU

Depends on: #1021 (its commit is the first one in this branch; only the second is this change)

#1021 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 a GPU fixture and the counts over the whole corpus.

What is in it

  • runtime/test/shaders/cs_w64x_cmp_sdst.asm: written like the game's listings. It has no mattr line, so llvm-mc prints v_cmp_gt_u32_e64 s4, ... for the pair, as it does for the game; every other wave64 fixture names the pair, which is why none of them saw the stale high register. Six compares and a carry-out, each with lanes on both sides of lane 32, read back by s_and_b64, s_or_b64, s_xor_b64, s_andn2_b64, s_and_saveexec_b64, s_mov_b64 exec, s_bcnt1_i32_b64 / s_ff1_i32_b64 and SCC. The high register holds another mask, 0 or nothing beforehand. The eight expected words are derived from the ISA in the header. Registered in check.py and scripts/run_gpu_tests.py.
  • tests/semantic/test_wave64_sdst_pair_fixture.py: the fixture on a 64-wide subgroup and under --wave64-emulate; the same program with pair destinations translates to the same SPIR-V text; wave32 code through translate() keeps its single register; and what tools/wave64_halves.py makes of the one-register form (the LLVM form of a uniform branch is tier A with equal words from one wave of 64 lanes and two of 32; the mask read as data is still tier C).
  • One row in docs/design.md under rdna2spirv: a wave64 VALU mask operand printed as one SGPR is the pair (SHADER-W64-SDST-PAIR) #1021's, with the counts below.

Counts (1.0.2.1, all 26,503 listings, llvm-mc backend)

Compares into a one-register SGPR in wave64 shaders 292,733, every one on an even register (wave32: 137,832 of 299,058 odd)
Wave64 shaders that read such a pair back, on main 13,314 (7,120 PS, 4,918 MS, 664 CS, 612 VS)
Full translation with #1021 26,503 translated, 26,503 pass spirv-val; 19,453 modules change, all wave64
SHADER-10 tiers, main -> #1021 A 5,059 -> 5,267, B 101 -> 397, C 8,245 -> 7,741; 504 leave C, none enters

Tested

  • GPU: NVIDIA GeForce RTX 4070 Ti, Linux, driver 620.70.06, subgroup 32 only. LEONIDA_W64_EMULATE=1 scripts/run_gpu_tests.py --filter cs_w64x_cmp_sdst: PASS with rdna2spirv: a wave64 VALU mask operand printed as one SGPR is the pair (SHADER-W64-SDST-PAIR) #1021 (10240 6144 2053 8224 7714 6184 4144 5); main 1504c1af6 stores 16384 16384, five times 0xffffffff and 1. This confirms the translated SPIR-V against the ISA reference, not native RDNA2 behaviour. This card has no 64-wide subgroup (--require-wave64 skips here).
  • Native 64-lane subgroups, measured by reviewers after this was opened (not by me): sodove on a Ryzen 5 9600X Radeon iGPU (Windows 11, driver 32.0.21045.29003, --require-wave64): 0 of 8 words with the translator before rdna2spirv: a wave64 VALU mask operand printed as one SGPR is the pair (SHADER-W64-SDST-PAIR) #1021, 8 of 8 with it, on each of three dispatches; thesubtleties on gfx1036 (RADV, Mesa 26.3.1): passes with native 64-wide subgroups and under emulation, and with main's translator fails with the same eight wrong words as above.
  • python -I scripts/run_semantic_tests.py tests/semantic: 472 files, 6,176 tests, 0 files failed.
  • tests/semantic/regen_fixtures.py --check, tests/test_regen_fixtures.py, test_run_gpu_tests.py, test_shader_checks.py, test_design_contract_rows.py, test_docs_design_rows.py: pass.

No game data: counts and opcode names only. AI-assisted (Claude Code).

🤖 Generated with Claude Code

…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>

@KernelSmoker KernelSmoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independently checked exact head 9f1a072. The focused fixture suite passes 8/8. On an RTX 3090 (NVIDIA subgroup 32), LEONIDA_W64_EMULATE=1 with run_gpu_tests.py --filter cs_w64x_cmp_sdst passed 1/1 and returned the expected eight words: 10240 6144 2053 8224 7714 6184 4144 5. The generated module also passed spirv-val --target-env vulkan1.2 in the Fedora tool container (the host runner itself skipped validation because spirv-val is not installed on the host). This is an independent subgroup-32 emulation result, not native wave64 hardware validation. Upstream changes since the PR's base do not touch its changed files; GitHub reports this head mergeable.

@sodove

sodove commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

The new cs_w64x_cmp_sdst fixture also passes on a native 64-lane Vulkan compute subgroup. Tested 9f1a072f7 on Windows 11 using the Ryzen 5 9600X Radeon iGPU (driver 32.0.21045.29003) and RTX 5070 Ti (610.74).

GPU and compute subgroup Pre-#1021 translator 3ed8e50b7 PR head including #1021
Radeon, native 64 (--require-wave64) 0/8 8/8
Same Radeon, forced 32 with wave64 emulation 0/8 8/8
RTX 5070 Ti, fixed 32 with wave64 emulation 0/8 8/8

Each cell is the number of readback words matching the fixture's ISA-derived reference on each of three independent dispatches. Used the same PR fixture and Windows Vulkan harness throughout, switching only the translator revision and execution mode. The harness confirmed the selected adapter and subgroup size. All four translated modules passed spirv-val --target-env vulkan1.2. Requesting native 64 on the RTX returned the expected skip (77). The eight focused semantic tests also passed.

This exercises the translated Vulkan path on hardware. The expected words come from the fixture's reference calculation. Only the repo's synthetic fixture was used.

AI-assisted: yes (OpenAI Codex).

@Okachamie

Copy link
Copy Markdown
Contributor

Independently verified cs_w64x_cmp_sdst at 9f1a072f7056b420096125317ceb001142e33f11 on CachyOS with an NVIDIA GeForce RTX 5090 Laptop GPU and driver 620.73.04. With LEONIDA_W64_EMULATE=1, GPU readback matched all eight expected words. Native wave64 skipped with exit 77 because the device exposes only subgroup size 32.

Both modules passed spirv-val --target-env vulkan1.2, and all eight focused semantic tests passed. The #1021 translator produced byte-identical SPIR-V in both modes. The pre-fix translator also passed SPIR-V validation, but its emulated GPU readback missed all eight expected words. This verification used a synthetic fixture. AI-assisted (Codex).

@thesubtleties

Copy link
Copy Markdown
Contributor

Tested bc7143b5f (#1021) and 9f1a072f7 (#1090), each merged onto main 3aa97542. NVIDIA RTX 3080 (620.73.04) and AMD Raphael RDNA2 iGPU gfx1036 (RADV, Mesa 26.3.1), CachyOS.

This runs translated SPIR-V, not native RDNA2 code. Not tested: game corpus. AI-assisted (Claude Code)

milk4sale and others added 2 commits November 24, 2026 16:31
Brings the branch up to date with main 68d1331. 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 ProjectLeonida#930).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
main now holds ProjectLeonida#1021 (SHADER-W64-SDST-PAIR), which this branch was stacked on. No conflict by hand: the
TEST-W64-SDST-PAIR-GPU row stays right under ProjectLeonida#1021's row in docs/design.md.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@ubiquitarianism
ubiquitarianism merged commit 871e4b8 into ProjectLeonida:main Nov 25, 2026
4 of 5 checks passed
aslan2142 added a commit to Rain156/leonida-contrib that referenced this pull request Nov 25, 2026
Fourteen commits main gained after ProjectLeonida#968: ProjectLeonida#413, ProjectLeonida#1114, ProjectLeonida#1090 and ProjectLeonida#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 ProjectLeonida#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>
@milk4sale

Copy link
Copy Markdown
Contributor Author

Local stand-in for this pull request's CI, which has been queued here since 22:31 UTC (about 580 runs waiting).

Tested: b57a5b870 merged with main b4b7756e8 (2026-11-25 01:13 UTC), in one tree together with #1087, #1089, #1114, #413, next to main alone. The trees came from git merge-tree, and nothing was pushed. Each job used the workflow's own selection from ci.yml and runtime.yml.

Job main + the five pull requests main alone
check steps: compileall, make_game.py --help pass pass
stdlib-tests-linux (every standalone file, run to the end) 492 of 492 pass 491 of 491 pass
translator-tests (pytest files) 1,890 pass, 2 fail 1,886 pass, the same 2 fail
viewer-tests pass pass
semantic-tests 477 files, 6,231 tests, 0 failed
linux-gpu-tools: ctest 76 of 76 pass
linux-gpu-tools: run_gpu_tests.py, plain, LEONIDA_W64_EMULATE=1 --filter cs_, LEONIDA_BARY_FALLBACK=1 0 failures on lavapipe, 0 on the RTX 4070 Ti
no-game-data: scripts/check_no_game_data.py on this pull request's files clean

This pull request's fixture, cs_w64x_cmp_sdst, passes in the LEONIDA_W64_EMULATE=1 --filter cs_ pass on lavapipe (CI's CPU path) and on the RTX 4070 Ti. In the other two passes it is skipped, since neither device has a 64-wide compute subgroup, as on CI's runners. tests/semantic/test_wave64_sdst_pair_fixture.py passes in the translator suite.

The two pytest failures are main's: tests/test_translate.py on the text-only fixture cs_dpp_cmp.asm (test_gpu_samples_translate_and_validate, test_wave64_emulate_uses_no_subgroup_ops). With #1375 applied, both pass.

Not covered: the Windows and macOS jobs.

Setup: Linux (CachyOS), Python 3.14.10 (CI uses 3.12), llvm-mc 23.1.4 (CI uses 19), Node 26.13.1. GPU suite on lavapipe from Mesa 26.2.6 with GALLIUM_OVERRIDE_CPU_CAPS=avx, the code path of CI's runners, which lack AVX-512; and on an RTX 4070 Ti, NVIDIA 620.70.06.

AI-assisted (Claude Code).

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.

6 participants