Skip to content

Tests: wave64 GPU checks for s_and/s_or/s_andn2_saveexec_b64 and s_andn2_wrexec_b64 with VCC and SGPR-pair sources - #1665

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Vonsek:test/saveexec-b64
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Vonsek:test/saveexec-b64

Conversation

@Vonsek

@Vonsek Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Requested by Lucas · project thread

Claimed in the coordination issue as: EGEN-SAVEEXEC-B64

What and why

s_and_saveexec_b64 and s_or_saveexec_b64 with a register source had no GPU test that checks what they return. They appear in many wave64 tests as part of an if-block, but nothing looked at D or SCC, and s_or_saveexec_b64 only ran with a constant source (cs_w64_mask_imm, #1367). s_andn2_saveexec_b64 and s_andn2_wrexec_b64 were tested with VCC only (cs_w64x_andn2_exec).

This adds runtime/test/shaders/cs_w64x_saveexec_b64.asm, a wave64 dump test (64 threads, one wave):

  • s_and_saveexec_b64 with an SGPR-pair source (v_cmp_*_e64 into s[10:11]) and with VCC;
  • s_or_saveexec_b64 with VCC and with an SGPR pair;
  • s_andn2_saveexec_b64 and s_andn2_wrexec_b64 with an SGPR-pair source.

It checks the new EXEC per lane (each lane on in it writes 1, then a compare collects them), D (old EXEC for saveexec, new EXEC for wrexec) and SCC. In every case the old EXEC and S0 differ between the two 32-lane halves, so swapped halves move the lowest lane and a result cut to 32 bits loses lanes. Three SCC cases cover an empty result, two halves that don't overlap (AND gives 0), and a result in the high half only. The header derives the eight words from the ISA pseudocode.

tests/semantic/test_saveexec_b64.py runs the same four ops on all 64 lanes for both sources and 13 pairs of S0 and EXEC each, compared against the ISA lines written as integers. It also runs the new fixture. The test is registered in check.py (W64X_DUMPS), run_gpu_tests.py and regen_fixtures.py.

The translator doesn't handle s_xor, s_orn2, s_nand, s_nor, s_xnor, s_andn1 or s_orn1 _saveexec_b64 (they are Unsupported), so they are not tested here.

Overlap checked: tools/crosslane_fuzz.py runs s_and_saveexec_b64 on the GPU, but only reads D back through s_mov_b64 exec and never checks SCC. tools/cf_diff.py (#663) uses s_and/s_or_saveexec without a GPU. #293 and #1299 don't test these ops in wave64.

Tested

On main 41f4482 + this commit, Windows 11:

Check Result
AMD Radeon RDNA2 iGPU (Ryzen 9 9950X3D), driver 26.10.1, native wave64 (--require-wave64, "compute subgroup size: 64") cs_w64x_saveexec_b64 passes: 6160 12304 5120 2088 6168 8192 7176 1837171; all 20 w64x_ tests pass
NVIDIA RTX 5080, driver 616.92, LEONIDA_W64_EMULATE=1 (subgroup 32) passes, same words; all 20 w64x_ tests pass
Negative control: s_or_saveexec computed as AND in tools/rdna2spirv.py (reverted) fails on AMD: out[2] = 0xffffffff (EXEC empty), SCC bit for case 2 lost (out[7] = 1837169)
python -m unittest discover -s tests/semantic OK
regen_fixtures.py --check, tests/test_shader_checks.py, compileall clean / OK

No translator change, so no docs/design.md row, and the translated and spirv-val counts are unchanged. No bug found.

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. (None here: tests only.)

…C and SGPR-pair sources in wave64

cs_w64x_saveexec_b64 checks the new EXEC per lane, D (old or new EXEC) and SCC, with old EXEC and S0
different in each 32-lane half. test_saveexec_b64.py runs the four ops on all 64 lanes for both sources
against the ISA lines, and the fixture.

AI-assisted.
@Doorriiaann

Copy link
Copy Markdown

Tested c2251c1 on NVIDIA GeForce RTX 3070 (Ampere, subgroup 32..32), driver 610.57.04 (Vulkan 1.4.341), Debian 13 (kernel 6.12.115): pass. With 32-wide subgroups this covers the emulated wave64 path.

Base is main 41f4482; runtime/build/linux built from each side; llvm-mc 21.1.8, SPIRV-Tools v2025.5, GCC 14.2.0.

main 41f4482 this PR
cs_w64x_saveexec_b64, LEONIDA_W64_EMULATE=1 (not present) PASS, 6160 12304 5120 2088 6168 8192 7176 1837171
cs_w64x_saveexec_b64, native (not present) SKIP (no 64-wide compute subgroup)
scripts/run_gpu_tests.py 115/145 passed, 30 skipped 115/146 passed, 31 skipped
LEONIDA_W64_EMULATE=1 scripts/run_gpu_tests.py 145/145 passed 146/146 passed
python -I -m unittest discover -s tests/semantic 1338 tests OK 1342 tests OK

Negative control: this PR's test_saveexec_b64.py run against main fails test_gpu_test_fixture (1 of 4).

AI-assisted: yes

@Rainmaker33

Copy link
Copy Markdown

Tested c2251c1 on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass, including the new fixture under wave64 emulation.

The PR's diff applied cleanly to main a0acd33. 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 (DISABLE_RTSS_LAYER=1, DISABLE_VULKAN_OBS_CAPTURE=1).

  • scripts/run_gpu_tests.py: 125/164 pass, 39 skipped (wave64), no failures. cs_w64x_saveexec_b64 skips natively.
  • With LEONIDA_W64_EMULATE=1: 156/164 pass, 8 skipped, no failures. cs_w64x_saveexec_b64: 6160 12304 5120 2088 6168 8192 7176 1837171.
  • tests/semantic/test_saveexec_b64.py: OK.
  • check.py with LEONIDA_W64_EMULATE=1 reports cs_w64x_saveexec_b64 SKIP (the device can't run this shader at 64 lanes on request), so only run_gpu_tests.py runs it emulated here. That check.py run also fails cs_w64x_partial and cs_w64x_partial_scmp, but main fails those two the same way, so they aren't this PR.

@Zebraine

Copy link
Copy Markdown
Contributor

Tested c2251c16ce3a203270478912f58bc9f6683dd583 on AMD Radeon RX 7700 XT (RDNA3, RADV NAVI32, subgroup 32..64), Mesa 26.3.1-arch3.5, CachyOS Linux 7.3.4-1-cachyos-bore, llvm-mc 23.1.5: pass.

  • python -I scripts/run_gpu_tests.py --build <build> --filter cs_w64x_saveexec_b64: 1/1 passed natively and 1/1 passed with LEONIDA_W64_EMULATE=1. Both modules passed spirv-val.
  • Running the native module directly with vk_compute_test <spv> 1 dump --require-wave64 reported compute subgroup size: 64 and 0 mismatches.
  • Both runs matched all eight words: 6160 12304 5120 2088 6168 8192 7176 1837171.

@ItsNotRexed
ItsNotRexed merged commit 806ca61 into ItsNotRexed:main Nov 22, 2026
2 of 4 checks passed
@kapitche

Copy link
Copy Markdown
Contributor

Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51): cs_w64x_saveexec_b64 builds and skips cleanly on both the RTX 4080 SUPER and the Intel UHD 770 (no 64-wide compute subgroup on this device), so it isn't exercised here. It needs an AMD GPU to actually run.

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