Skip to content

TEST-725: Add RDNA2 assembly coverage for signed scalar immediates - #3595

Open
skipper-hack wants to merge 2 commits into
ItsNotRexed:mainfrom
skipper-hack:test/sopk-immediate-fixture
Open

skipper-hack wants to merge 2 commits into
ItsNotRexed:mainfrom
skipper-hack:test/sopk-immediate-fixture

Conversation

@skipper-hack

Copy link
Copy Markdown

Adds a hand-written wave32 assembly fixture for scalar instructions with 16-bit immediates. It checks signed versus unsigned s_cmpk, verifies that s_mulk_i32 preserves both values of SCC, and verifies that s_addk_i32 sets SCC on signed overflow.

The CPU semantic test and both Vulkan runners check the same eight output words. All inputs are synthetic.

Verification

  • Assembled with llvm-mc for gfx1013 and gfx1030. The translated shader passed spirv-val.
  • The filtered Vulkan run matched all eight output words on Linux using Mesa llvmpipe (software Vulkan, LLVM 20.1.2).
  • The full semantic suite completed 7,323 tests with one expected failure.
  • The new CPU test caught deliberate regressions in comparison sign extension, SCC preservation, and overflow handling.

Coordination claim for TEST-725

Add a wave32 assembly fixture for SOPK sign extension and the scalar condition flag. Run the generated listing in the CPU interpreter and check the same output words in both Vulkan runners.
@Kam471

Kam471 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 24c7456ae933a32e55201b228e47d9bd314341da on Windows 11, NVIDIA GeForce RTX 5070 Ti (desktop, 16 GB), driver 621.24, Vulkan 1.4.357.

  • python -I scripts/run_gpu_tests.py --build ... --filter sopk -> 1/1 passed, 0 skipped, 0 failed (cs_w32_sopk); translator 1 shader, 1 pass spirv-val.
  • Fixture returned 0xFFFF8000 0 0xFFFFFFEB 0 0x00018000 1 0x80000000 1.
  • Direct vk_compute_test ... cs_w32_sopk.spv 1 dump -> device: NVIDIA GeForce RTX 5070 Ti (subgroup 32..32), 1 groups x 64: 0 mismatches.
  • python tests/semantic/test_sopk_fixture.py -> 1 test OK (without -I; -I removes tests/semantic from sys.path, the known invocation issue).

No game files.

@javdc

javdc commented Nov 22, 2026

Copy link
Copy Markdown

Tested 24c7456 on Steam Deck LCD (Jupiter), AMD Custom GPU 0405 "Van Gogh", RADV Mesa 26.2.0-devel (git-5c65d4fc31), Vulkan 1.4.350, SteamOS 3.9.5 (holo), kernel 7.2.7-valve2-2-neptune-72-g31504582a073: pass

  • python3 -m pytest tests/semantic/test_sopk_fixture.py -q -> 1 passed
  • python3 -I scripts/run_gpu_tests.py --build <build> --filter sopk -> 1/1 passed (cs_w32_sopk)
  • python3 -I scripts/run_gpu_tests.py --build <build> -> 185/200 passed, 14 skipped, 0 failed (expected D3D12-owned skips)

No runtime C++ changes; GPU suite run from the PR worktree against the existing main runtime build.

AI-assisted (OpenCode).

@kotorvr

kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 24c7456 on NVIDIA GeForce RTX 4090 (Ada, subgroup 32..32), 621.14, Windows 11 (26200): pass. A real-GPU result next to the PR's llvmpipe run.

Test programs: MSVC 19.44 RelWithDebInfo build of main f847748, the branch's base (the PR changes no test program). llvm-mc 21.1.8, Vulkan SDK 1.4.363.0, Python 3.13.7.

main f847748 24c7456
python -I scripts/run_gpu_tests.py 153/199 passed, 46 skipped 154/200 passed, 46 skipped, 0 failed
the same with LEONIDA_W64_EMULATE=1 184/199 passed, 15 skipped 185/200 passed, 15 skipped
runtime/test/shaders/build.py 224 translated, 224 pass spirv-val 225 translated, 225 pass spirv-val
runtime/test/shaders/check.py 139 of 174 pass, 35 skipped 140 of 175 pass, 35 skipped

run_gpu_tests.py --filter cs_w32_sopk --require-pass:

PASS  cs_w32_sopk           4294934528 0 4294967275 0 98304 1 2147483648 1

which is 0xFFFF8000, 0, 0xFFFFFFEB, 0, 0x00018000, 1, 0x80000000, 1, the eight words in the fixture's header. tests/semantic/test_sopk_fixture.py: 1 test OK; python -I -m compileall -q make_game.py tools tests exit 0.

Not run: the full tests/semantic suite. No game files. AI-assisted check (Claude Code).

@crastinator

Copy link
Copy Markdown
Contributor

Tested 24c7456 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 test passes natively: cs_w32_sopk (4294934528 0 4294967275 0 98304 1 2147483648 1).
  • Whole run_gpu_tests.py: 186/200 native, 186/200 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_sopk_fixture.py: 1 passed.

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

@TreXito

TreXito commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 24c7456a (base f847748c) on NVIDIA GeForce RTX 3060 Ti (Ampere), driver 580.173.02 (Vulkan 1.4.312), Linux (Ubuntu 26.04 container on a TrueNAS 26.0 host, Python 3.14.4): pass. This is the first hardware GPU run of the fixture; your body reports llvmpipe only.

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

@iurysf

iurysf commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 24c7456a (on main f847748c) on RTX 4070 (Ada, NVIDIA 621.01, subgroup 32..32), Windows 11 (10.0.26300), llvm-mc 23.1.6 (AMDGPU), spirv-val from Vulkan SDK 1.4.363.1, Python 3.14.6: pass.

  • scripts/run_gpu_tests.py: 154/200 passed, 46 skipped, 0 failed (153/199 on f847748c; the +1 is cs_w32_sopk, PASS 4294934528 0 4294967275 0 98304 1 2147483648 1, the eight words in the fixture header). The full tests/semantic suite: 7323 tests OK, 0 failures (7322 on the base; the +1 is test_sopk_fixture).
  • Since the PR only adds coverage, I checked that it catches a regression: with the s_cmpk_*_i32 sign extension removed from tools/rdna2spirv.py (if False and ty == "i32" and v & 0x8000:), cs_w32_sopk fails on the GPU (word 5 reads 0, expected 1) and test_sopk_fixture fails (test_result_and_scc); with the original translator both pass.

Not tested: mutations of s_mulk_i32/s_addk_i32, wave64, AMD/Intel, real RDNA2 hardware. Tested with AI assistance (Claude); synthetic programs only, no game data.

Conflicts in the wave32 and GPU-test dump lists in runtime/test/shaders/check.py
and scripts/run_gpu_tests.py: kept cs_w32_sopk alongside main's new entries.
@Kev-Ball

Copy link
Copy Markdown

Tested 153d6794 on an NVIDIA GeForce RTX 3080 Ti (32-lane subgroups), driver 620.73.04, CachyOS Linux 7.3.5-2-cachyos. I rebuilt the Vulkan harnesses from this revision and selected the NVIDIA device explicitly.

Ran the PR’s synthetic fixture through scripts/run_gpu_tests.py --build runtime/build/linux --filter <fixture> --require-pass. The shader translated and passed Vulkan SPIR-V validation. GPU readback passed:

  • cs_w32_sopk — 4294934528 0 4294967275 0 98304 1 2147483648 1.

AI-assisted verification with synthetic inputs.

@kapitche

Copy link
Copy Markdown
Contributor

Tested 153d6794 merged with main 3eb4410b on Windows 11, RTX 4080 SUPER + Intel UHD 770 (MSVC 14.51): pass.

  • scripts/run_gpu_tests.py --filter cs_w32_sopk: PASS on both GPUs (1/1 each).
  • python -I -m unittest discover -s tests/semantic -p test_sopk_fixture.py: 1 test OK.
  • Control: test-only PR, so there are no non-test files to revert.

The GPU test programs are the runtime build of main 7b7d73f8 (same exes for every run); the PR's tools/, scripts/ and runtime/test/shaders come from the merge.

@lunarminus

Copy link
Copy Markdown

Tested 153d6794 merged onto main d0835dd9 on an AMD Radeon 760M (RDNA3 iGPU, gfx1103, subgroup 32..64), RADV Mesa 26.3.1, CachyOS Linux: pass

  • The merge was clean. The PR changes no C++/CMake, so the test programs are the runtime build of d0835dd9. llvm-mc 23.1.5.
  • python -I -m unittest discover -s tests/semantic -p test_sopk_fixture.py: 1 test OK. compileall exit 0.
  • scripts/run_gpu_tests.py, whole suite: 197/211 passed, 14 skipped, 0 failed natively and also with LEONIDA_W64_EMULATE=1. On d0835dd9 without the PR it is 196/210 passed with 14 skipped in both modes. Comparing every test with d0835dd9, both modes are identical apart from the new cs_w32_sopk: PASS 4294934528 0 4294967275 0 98304 1 2147483648 1, the eight words in the fixture header.
  • --filter cs_w32_sopk --require-pass: 1/1 passed. Running it directly with vk_compute_test cs_w32_sopk.spv 1 dump gives device: AMD Radeon 760M Graphics (RADV PHOENIX) (subgroup 32..64), 1 groups x 64: 0 mismatches, and the same eight words.
  • runtime/test/shaders/build.py: 235 translated, 235 pass spirv-val (234/234 on d0835dd9). check.py: 182 of 185 pass, 3 skipped (181 of 184 on d0835dd9). The only difference is cs_w32_sopk ok. Both were run natively only.
  • I also checked that the fixture catches the s_mulk_i32/s_addk_i32 regressions an earlier report lists as not tested. Each mutation went into tools/rdna2spirv.py in a scratch copy of the merge, and each one failed both cs_w32_sopk on the GPU and test_sopk_fixture on the CPU:
    • SCC set from the result after s_mulk_i32: out[3] reads 1 instead of 0.
    • The overflow SCC of s_addk_i32 removed: out[7] reads 0 instead of 1.
    • The s_mulk_i32 immediate zero-extended: out[2] and out[4] read 458731 and 2147581952.
  • Not run: the full tests/semantic suite and ctest.

Synthetic test shaders only, no game files. 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.

10 participants