Repository navigation
GPU tests for misc 32-bit integer VALU ops (ps_vint_*) - #1492
Conversation
Five pixel fixtures, inputs from memory, for v_add_lshl_u32, v_and_or_b32, v_xor3_b32, v_bfi_b32, v_bfm_b32, v_bfrev_b32, v_mad_i32_i24, v_mul_hi_u32_u24, v_max3_u32, v_min3_i32 and v_max/min_i32/u32. Operands cover 24-bit sign extension with garbage in bits 24-31, shifts and field sizes of 32 and more, and signed vs unsigned min/max. Expected words are derived in the .asm headers; the same shaders are semantic fixtures. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested 452fb3f on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass. The new fixtures are exact on NVIDIA. The PR's diff applied cleanly to
|
|
Tested 452fb3f merged onto
AI-assisted (Claude Code). |
|
Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51): pass. All five new |
|
Tested 452fb3f on AMD Radeon RX 7900 XTX (RDNA3, Navi 31), AMD driver 26.11.2, Vulkan 1.4.359, Windows 11: pass.
Tools: llvm-mc 21.1.8 (WSL), Vulkan SDK 1.4.363.0, MSVC 14.44. |
|
Tested 452fb3f on Apple M2 (Mac14,3), macOS 26.4 (25E246), MoltenVK 1.4.2 (loaded directly), subgroup 4..32, llvm-mc 23.1.6, Python 3.13.18: pass.
The head configures and builds cleanly on macOS. It is currently marked conflicting with main; I fetched it unchanged into a separate worktree and did not rebase, edit or push anything. This adds an Apple/MoltenVK data point to the existing results on this PR. Synthetic shaders and aggregate counts only; no game files. AI-assisted. |
|
Tested
No game files. AI-assisted (Claude Code). |
Conflicts: runtime/test/shaders/check.py, scripts/run_gpu_tests.py, tests/semantic/regen_fixtures.py, tests/semantic/test_value_semantics.py AI-assisted.
|
Merged main as 354e129 (no rebase). Conflicts were in runtime/test/shaders/check.py, scripts/run_gpu_tests.py, tests/semantic/regen_fixtures.py and tests/semantic/test_value_semantics.py: kept main's entries and re-added this PR's registrations (VINT_ENV is now imported next to main's new pixel-check imports). CPU checks OK: regen_fixtures.py --check clean, unittest discover -s tests/semantic, test_shader_checks.py, test_run_gpu_tests.py. ps_vint_logic3, ps_vint_bits, ps_vint_mul24, ps_vint_minmax and ps_vint_minmax3 pass (4096/4096 pixels exact) on an AMD Radeon RDNA2 iGPU (driver 26.10.1). AI-assisted. |
Conflicts: tests/semantic/regen_fixtures.py AI-assisted.
|
Main moved again while this was being tested, so merged it once more as b40d803. Conflict: tests/semantic/regen_fixtures.py (main's new entry kept, this PR's re-added). CPU checks OK again (regen --check clean, unittest discover -s tests/semantic, test_shader_checks.py, test_run_gpu_tests.py), and all five ps_vint_* tests pass (4096/4096 pixels exact) on an AMD Radeon RDNA2 iGPU (driver 26.10.1) with the rebuilt runtime. AI-assisted. |
Conflicted files: runtime/test/shaders/check.py, scripts/run_gpu_tests.py AI-assisted.
|
Merged main (df91c66) again; CPU checks and the PR's GPU tests pass on Radeon RDNA2 iGPU. AI-assisted. |
Conflicts: scripts/run_gpu_tests.py AI-assisted.
|
Merged main (b2fc3f2) again; CPU checks and the PR's GPU tests pass on Radeon RDNA2 iGPU. AI-assisted. |
Conflicts: tests/semantic/regen_fixtures.py AI-assisted.
|
Merged main (f161481) again; CPU checks and the PR's GPU tests pass on Radeon RDNA2 iGPU. AI-assisted. |
tests/semantic/test_value_semantics.py AI-assisted.
scripts/run_gpu_tests.py AI-assisted.
runtime/test/shaders/check.py scripts/run_gpu_tests.py tests/semantic/regen_fixtures.py tests/semantic/test_value_semantics.py AI-assisted.
|
Tested
No game files. AI-assisted (Claude Code). |
|
Tested d2e989c (merge base aa2988c) on NVIDIA GeForce RTX 5080, Linux 580.65.06: pass Tested the PR head merged with current main
Line-by-line against my main run (results that differ from main):
Not run: the full AI-assisted (Claude Code). |
|
Tested
AI-assisted (Claude Code). |
|
Tested
Not run: AI-assisted (Claude Code). |
Requested by Lucas · project thread
Claimed in the coordination issue as: EGEN-VALU-INT-MISC, claim comment
What and why
These 32-bit integer VALU ops had CPU tests only:
v_add_lshl_u32,v_and_or_b32,v_xor3_b32,v_bfi_b32,v_bfm_b32,v_bfrev_b32,v_mad_i32_i24(without clamp),v_mul_hi_u32_u24,v_max3_u32,v_min3_i32, andv_max_i32/v_min_i32/v_max_u32/v_min_u32. This PR adds five pixel tests that run them on a GPU, plus the same shaders as semantic fixtures.v_mul_hi_i32_i24is already covered by #833 andv_add_nc_i32/v_sub_nc_i32by #1304, so they are not in this PR. Thev_mad_i32_i24clamp bit is claimed by someone else in the coordination issue, so the test doesn't use it.runtime/test/shaders/ps_vint_{logic3,bits,mul24,minmax,minmax3}.asm(new): each shader loads eight words h0..h7 from memory (s_buffer_load_dwordx8), so the driver can't constant-fold the operands. It then writes four results to mrt0. Each header gives the RDNA2 ISA pseudocode, the derivation of each word, and the wrong value a likely translator mistake would produce. The operands are chosen for the cases where mistakes show up:0xab800000,0x12fffffe). Getting sign extension vs zero extension wrong, or skipping the mask, changes thev_mad_i32_i24andv_mul_hi_u32_u24words.0xffffffffand0x12fffffe.v_add_lshl_u32andv_bfm_b32must use only bits 4:0.0x80000001vs0x7ffffffe, compared both signed and unsigned. With the wrong signedness, each min/max word changes.check.py/scripts/run_gpu_tests.py: the five tests are added toPIXEL_BITSand to theconst_wantsdict, and share a single heapVINT_ENVinPIXEL_ENV.tests/semantic: the five fixtures are added toregen_fixtures.pyand regenerated.test_value_semantics.pychecks the translated shaders against hand-written constants and a plain-Python reference (reference_vint), andOracleTestschecks that the constants and the reference agree.No translator change. All 20 words matched on both GPUs.
Tested
run_gpu_tests.py --filter ps_vint: 5 shaders translated and passed spirv-val. 5/5 pass at 4096/4096 pixels exact on:NVIDIA GeForce RTX 5080 (subgroup 32..32))AMD Radeon(TM) Graphics (subgroup 32..64))tools/rdna2spirv.pyI changedv_mul_hi_u32_u24to sign-extend (OpBitFieldSExtractin place ofOpBitFieldUExtract).ps_vint_mul24then failed on both GPUs with 4096/4096 mismatches (0xff7ffffe, 0xfffffffein place of0x7fff, 0xffff). I reverted the change.v_min3_i32compared unsigned, the new semantic test fails onps_vint_minmax3z and w (0x12345678in place of0xf0f0f0f0/0xab800000). Reverted.python -m unittest discover -s tests/semantic: OK.regen_fixtures.py --check: clean.python -I tests/test_shader_checks.py: OK.tests/test_run_gpu*.py: OK.AI-assisted.
Checklist
docs/design.md, with how it was confirmed. (No new rule: the translator is unchanged.)