Skip to content

GPU test cs_w64x_vcmp: compare masks over the 64 lanes of a wave64 - #2455

Open
evilclanker9000 wants to merge 7 commits into
ItsNotRexed:mainfrom
evilclanker9000:test/gpu-w64x-vcmp
Open

evilclanker9000 wants to merge 7 commits into
ItsNotRexed:mainfrom
evilclanker9000:test/gpu-w64x-vcmp

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

Requested by Lucas · project thread

Claimed in the coordination issue as: EGEN-W64-VCMP, #2300 (comment)

Depends on: #2415 (this branch is stacked on it: it adds W64X_FULL to check.py, which cs_w64x_vcmp uses; until #2415 lands the diff shows its commits too).

What and why

Compare results are lane masks. The wave32 compare tests (ps_vcmp_*, #1299 and #2220) are pixel shaders on 32 lanes; no GPU test checks a compare mask that is a 64-bit SGPR pair or VCC over 64 lanes. This adds cs_w64x_vcmp, one 64-lane group (a cs_w64x_* cross-half test):

  • 16 v_cmp masks: signed/unsigned i32, v_cmp_lt_u64 and v_cmp_gt_i64 (both words matter: the low words alone give a different mask), f32 with NaN, signaling NaN and infinity lanes (lt, nlt, u, o, neq, lg), v_cmp_class_f32 with a per-half class mask; two of them go to VCC (v_cmp_ne_u32_e32, v_cmp_ge_i32_e64 vcc), the rest to SGPR pairs.
  • 7 64-bit SALU logic ops on those masks (s_and, s_or, s_xor, s_andn2, s_orn2, s_nor, s_xnor_b64).
  • The masks used as v_cndmask selectors (VOP3 with an SGPR pair, VOP2 with VCC).
  • Per-half patterns: a mask cut to its low word, with its words swapped, or from a 64-bit compare of the low words alone is a different mask for all but one of the 23.
  • 430 words: a flag word per lane (bit k = lane's bit of mask k, read back with v_cndmask, so the check does not depend on how an SGPR pair reads as data), five v_cndmask selection arrays, and s_bcnt1_i32_b64 / s_ff1_i32_b64 of every mask. The .asm header lists each mask as a 64-bit constant derived from the ISA definition; W64X_VCMP_WORDS in check.py is the same formulas in plain Python.

The same shader is a semantic fixture (test_w64x_vcmp_fixture.py: hand-derived masks, popcounts and lowest lanes, a plain-Python model, and the translated shader run on 64 lanes in the wave interpreter). No translator change; it passed as it was.

Tested

  • AMD Radeon iGPU (Ryzen 9 9950X3D, driver 26.10.1), native wave64 (compute subgroup size: 64): run_gpu_tests.py --filter cs_w64x_vcmp 430/430 words exact.
  • RTX 5080 (driver 616.92) with LEONIDA_W64_EMULATE=1 (--wave64-emulate, 32-wide subgroups): 430/430 words exact.
  • Negative controls (each fails, then reverted): the 64-bit ordered compare deciding on the low words only (Radeon: word 0 expected 0x0056728b, got 0x0056720b); s_bcnt1_i32_b64 of a lane mask counting only the low word (RTX 5080 emulated: word 385 expected 0x3f, got 0x20).
  • python -m unittest discover -s tests/semantic OK; python tests/semantic/regen_fixtures.py --check clean; python -I tests/test_shader_checks.py OK.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • No new translator rule, so no contract row.

AI-assisted.

v_add_co_u32, v_add_co_ci_u32, v_sub_co_u32, v_subrev_co_u32, v_sub_co_ci_u32 and
v_subrev_co_ci_u32 with the carry-out in an SGPR pair or in VCC and the carry-in from an
SGPR pair or from VCC, per lane of one 64-lane group. The carry-in mask differs between
the two halves, so a mask cut to its low word or with its words swapped shows. The test
dumps 922 words (13 ops x 64 lanes, a flag word per lane, s_bcnt1 / s_ff1 of every mask),
derived from the ISA pseudocode in the .asm header. The wave32 counterpart is
cs_w32_dot4_carry (ItsNotRexed#2311).

check.py gets W64X_FULL for wave64 tests judged on a whole dump (--require-wave64, a skip
on a device without 64-wide subgroups, no flag with LEONIDA_W64_EMULATE=1).

AI-assisted.
v_cmp i32/u32/i64/u64/f32 (NaN, infinity, class) into SGPR pairs and into VCC, the 64-bit
SALU logic ops on those masks (s_and/or/xor/andn2/orn2/nor/xnor_b64), and v_cndmask with
the masks as selectors, per lane of one 64-lane group. The inputs differ between the two
halves, so a mask cut to its low word, with its words swapped, or from a 64-bit compare of
the low words alone is a different mask. The test dumps 430 words (a flag word per lane,
five v_cndmask selections, s_bcnt1 / s_ff1 of every mask), derived from the ISA pseudocode
in the .asm header.

AI-assisted.
@duudiis

duudiis commented Nov 22, 2026

Copy link
Copy Markdown

Independent test of 2b3f7e8 on Windows 11 build 26300, RTX 5070, driver 621.24. All four semantic tests passed, and Vulkan 1.2 spirv-val accepted both generated modules.

  • Native module with --require-wave64: the Vulkan compute test returned 77 with “full 64-wide compute subgroups unavailable” on this 32..32 device, as expected.
  • --wave64-emulate: all 430 GPU readback words matched both the fixture's Python reference and W64X_FULL, including masks spanning both halves, selected lane values, popcounts and first-set-lane indices.

Synthetic fixture only. AI-assisted review.

@umnitus

umnitus commented Nov 22, 2026

Copy link
Copy Markdown

Tested 2b3f7e8 on an RTX 3060 12 GB (subgroup 32..32), NVIDIA 621.14, Vulkan 1.4.357, Windows 11 26H2: pass.

With LEONIDA_W64_EMULATE=1, I ran scripts/run_gpu_tests.py --filter cs_w64x_vcmp using harnesses built from the same commit. The shader passed spirv-val and all 430/430 output words matched exactly (exit 0).

Tools: llvm-mingw Clang 23.1.6, llvm-mc 23.1.6, SPIRV-Tools 2026.4. Synthetic inputs only. AI-assisted setup and verification; test ran locally.

@Rainmaker33

Copy link
Copy Markdown

Tested 2b3f7e8 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 4947579. VS 2022, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8; overlay layers off. Harness programs from a CMake build of that main.

  • scripts/run_gpu_tests.py: 139/187 pass, 48 skipped, no failures. cs_w64x_vcmp skips natively (no 64-wide subgroups).
  • With LEONIDA_W64_EMULATE=1 --filter cs_w64x_vcmp: pass, "430/430 dumped words exact".
  • tests/semantic/test_w64x_vcmp_fixture.py: OK. tests/test_shader_checks.py: OK.

@emirduran707

Copy link
Copy Markdown
Contributor

Tested 2b3f7e8 on AMD Radeon RX 9060 XT (RDNA4), AMD driver 26.10.44 (LLPC, Vulkan driver 2.0.395), Windows 11 Pro 10.0.26300, subgroup 32..64: pass. The checks above have no AMD run from outside the author; this adds an AMD card with native 64-wide subgroups.

  • python -I scripts/run_gpu_tests.py --build <build> --filter <fixture>, one run per new fixture:
    • cs_w64x_carry: PASS, 922/922 dumped words exact; same with LEONIDA_W64_EMULATE=1
    • cs_w64x_vcmp: PASS, 430/430 dumped words exact; same with LEONIDA_W64_EMULATE=1
  • Whole suite (native wave64): 192 shaders translated, 192 pass spirv-val; 172/187 passed, 15 skipped, 0 failed (main 4947579 here: 170/185, 15 skipped). The skips are the 14 fixtures the d3d12_* tests run, and ps_w64x_readlane (skipped on main too, see check.py: judge ps_w64x_readlane where vk_harness required 64 (its line has no "required") #2085).
  • build.py + check.py: 206 shaders: 206 translated, 206 pass spirv-val; 161 of 165 pass, 4 skipped; ok for cs_w64x_carry, cs_w64x_vcmp.
  • CPU: python -I -m unittest discover -s tests/semantic -p test_w64x_carry_fixture.py 3 OK, python -I -m unittest discover -s tests/semantic -p test_w64x_vcmp_fixture.py 4 OK, tests/test_shader_checks.py 60 OK, tests/test_run_gpu_tests.py 30 OK, tests/semantic/regen_fixtures.py --check clean. I did not run the whole tests/semantic suite.

Test programs: an MSVC 14.44 build of 4947579, this PR's base; the PR changes no C++ or CMake. llvm-mc 21.1.8 (native), Vulkan SDK 1.4.363.0. No negative control run here. No game files. AI-assisted (Claude Code).

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

AI-assisted.
@crastinator

Copy link
Copy Markdown
Contributor

Tested a9a8116 merged into main f847748c (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 tests pass natively: cs_w64x_carry (922/922 dumped words exact); cs_w64x_vcmp (430/430 dumped words exact).
  • Whole run_gpu_tests.py: 188/202 native, 188/202 with LEONIDA_W64_EMULATE=1 (the skips are the D3D12-only fixtures and ps_w64x_readlane, as on main). ctest 41/41.
  • tests/semantic/test_w64x_carry_fixture.py, tests/semantic/test_w64x_vcmp_fixture.py, tests/test_shader_checks.py: 81 passed, 1572 subtests passed.

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

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

AI-assisted.
@amarovndres

Copy link
Copy Markdown

Tested 3b5aaada (the current head; the last check was on a9a8116) on AMD Radeon RX 9060 XT (RDNA4, discrete, subgroup 32..64), AMD 26.10.1 (32.0.32015.7029, LLPC, Vulkan 1.4.359), Windows 11 Pro (build 26200): pass.

  • scripts/run_gpu_tests.py (full suite; test programs built from this head with llvm-mingw, llvm-mc 23.1.6): 199/213 passed, 14 skipped, 0 failed. cs_w64x_carry 922/922 and cs_w64x_vcmp 430/430 dumped words exact (plus their 64-word dumps, 64/64 each). main d0835dd9 on the same machine: 196/210, the same 14 skipped, so nothing regresses.
  • tests/semantic/test_w64x_carry_fixture.py + test_w64x_vcmp_fixture.py: 7/7 OK; tests/test_shader_checks.py: 75/75 OK.

AI-assisted (Claude Code). Synthetic shaders only, no game files.

@bobcatchris

Copy link
Copy Markdown
Contributor

Tested 3b5aaadae47f179082a192290da29481f349ce3d on AMD Radeon Pro V540 (RDNA1, Navi 12; RADV/Mesa 25.2.8-0ubuntu0.24.04.4, Ubuntu 24.04.4, Linux 7.0.0-31-generic, Vulkan 1.4.318, subgroup range 32..64). The box is described as gfx1012; tools/hw_oracle reports gfx1011 for this Navi 12 part. PCI 1002:7360.

  • GPU pinning: DRI_PRIME=pci-0000_1c_00_0! and DRI_PRIME=pci-0000_1f_00_0! (two different cards, one process each).
  • Command: python3 -I scripts/run_gpu_tests.py --filter cs_w64x_vcmp --build runtime/build/linux: 2/2 passed (430/430 and 64/64 dumped words exact) on both cards; same with LEONIDA_W64_EMULATE=1.
  • Command: python3 -I scripts/run_gpu_tests.py --build runtime/build/linux: 185/213 passed, 26 skipped, 2 failed on both cards (216 shaders translated, 216 pass spirv-val); with emulation also 185/213. Base aa2988cc in a separate worktree with the same toolchain: 182/210 passed, 26 skipped, 2 failed. The extra passing tests are this PR's new fixtures; no regression.
  • The two failures (cs_signed_zero_nan, cs_w32_salu64) are pre-existing with identical words on base.
  • Toolchain note: built with current Khronos Vulkan-Headers 1.4.335 (-DVulkan_INCLUDE_DIR=...) because this head's vk_harness uses VK_KHR_pipeline_binary, absent from Ubuntu 24.04's 1.3.275 headers. GCC 13.3.0, llvm-mc 21.1.8, SPIRV-Tools 2026.1.

Counts and pass/fail only; no game data. No code changes.

AI-assisted.

@lunarminus

Copy link
Copy Markdown

Tested 3b5aaada merged onto main d0835dd9 on an AMD Radeon 760M (RDNA3 iGPU, gfx1103, subgroup 32..64), RADV Mesa 26.3.1, CachyOS Linux: fail. The new fixtures pass, but scripts/run_gpu_tests.py no longer records the result of cs_fmt_sint32.

  • The merge is clean. The PR changes no C++/CMake, so I used test programs built from d0835dd9.
  • New fixtures, native and with LEONIDA_W64_EMULATE=1: cs_w64x_vcmp PASS, 430/430 dumped words exact. cs_w64x_carry PASS, 922/922 dumped words exact.
  • Full run_gpu_tests.py: 199/213 passed, 14 skipped, in both modes. d0835dd9 without the PR: 196/210, 14 skipped.
  • Per-test comparison with d0835dd9 (PASS/FAIL/SKIP and name of every result line), same in both modes. There is no new FAIL or SKIP, and the 14 skips are the same tests. The other differences:
    • cs_fmt_sint32 is missing. It PASSes 64/64 on d0835dd9.
    • cs_w64x_vcmp and cs_w64x_carry each print twice: once with the real count and once more as 64/64 dumped words exact.
    • So the +3 is 2 new fixtures + 2 duplicate lines - 1 dropped test.
  • Cause: since the merge a9a81161, the new elif name in dict(W64X_FULL): branch sits between problem = fmt_sint32_test(...) and its results.append((name, not problem, problem or "64/64 dumped words exact")).
    • cs_fmt_sint32 still runs, but its result is thrown away. --filter cs_fmt_sint32 exits 2 with no runnable GPU test cases, while it passes 1/1 on d0835dd9.
    • That append now runs at the end of the W64X branch. From reading the code (not run here): on a device without 64-wide subgroups and without emulation, problem is None, so the stray line records a PASS next to the SKIP.
  • Fix checked locally, then reverted: I moved that results.append back under cs_fmt_sint32. With that, --filter runs give cs_fmt_sint32 PASS 64/64 (native only), and cs_w64x_vcmp 430/430 and cs_w64x_carry 922/922 in both modes, one line each.
  • CPU: tests/semantic/test_w64x_carry_fixture.py + test_w64x_vcmp_fixture.py 7/7 OK, tests/test_shader_checks.py 75 OK, tests/test_run_gpu_tests.py 40 OK, tests/semantic/regen_fixtures.py --check clean.

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

@MKS2508

MKS2508 commented Nov 23, 2026

Copy link
Copy Markdown

Tested 3b5aaada on AMD RX 5700 (RADV NAVI10), Mesa 26.2.3, Vulkan 1.4.357, NixOS (LLVM 21.1.8): pass

179/186 pass, 8 skipped (same environmental skips: mesh fixtures and VK_KHR_fragment_shader_barycentric, which RADV doesn't expose on RDNA1). cs_w64x_carry and cs_w64x_vcmp pass on native 64-wide subgroups.

Also checked #2546 (05943b5e) on the same setup — same result, and its new cs_w64x_maskbits passes too (comment there).

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.

10 participants