Skip to content

GPU fixtures: LDS mskor, inc/dec/min/max and 64-bit wrxchg - #4789

Open
YaBulochka wants to merge 1 commit into
ItsNotRexed:mainfrom
YaBulochka:feat/fixtures-batch5
Open

YaBulochka wants to merge 1 commit into
ItsNotRexed:mainfrom
YaBulochka:feat/fixtures-batch5

Conversation

@YaBulochka

Copy link
Copy Markdown
Contributor

Six GPU fixtures for the last three LDS-atomic rows, all wave32 dumps of eight words:

Fixture Row Covers
cs_w32_lds_mskor 321 ds_mskor_b32, ds_mskor_rtn_b32, an offset: form, the _rtn_ old word, and DATA2 bits outside DATA being ORed in (not a masked insert)
cs_w32_lds_atomics_incdec 322 ds_inc/dec/rsub_u32 without a return: inc at DATA-1/DATA/above, dec at 0/1/DATA/above, rsub wrapping
cs_w32_lds_atomics_rtn 322 the three _rtn_ forms, the old word read before the operation
cs_w32_lds_minmax_f32 322 ds_min/max_f32 and _rtn_ with qNaN in either operand, -0/+0 and +/-inf
cs_w32_lds_wrxchg_b64 324 ds_wrxchg_rtn_b64, ds_wrxchg2_rtn_b64, old pairs, vdst order at *8 offsets 1/2, the written words
cs_w32_lds_wrxchg2st64_b64 324 ds_wrxchg2st64_rtn_b64 at *64 offsets 1/2 (0x200/0x400), 2 KiB LDS, markers at 8/16

Measured on the RDNA2 iGPU (gfx1036, RADV RAPHAEL_MENDOCINO, Mesa 27.0.0-devel), exactly:

inc/dec   5 0 0 5 0 4 5 0xfffffffe
rtn       4 5 0 5 7 0xfffffffe 5 0
minmax    0x80000000 0 0x3f800000 0x3f800000 0x7fc00000 0x3f800000 0x3f800000 0x3f800000
mskor     0x11223344 0x11220008 0xffff0000 0xff000001 0xdeadbeef 0x5f5f5f5f 0xfeedface 0x12345678
wrxchg    0x11111111 0x88888888 0x22222222 0x44444444 0x33333333 0xcccccccc 0xdddddddd 0xeeeeeeee
wrxchg st64 0x11111111 0x44444444 0x55555555 0x88888888 0x33333333 0x77777777 0xaaaaaaaa 0xeeeeeeee

run_gpu_tests.py --filter cs_w32_lds is 9/9 (the six new plus the three existing LDS guards); check.py reports all six ok. The new tests/semantic/test_batch5_gpu_fixtures.py, the runner, shader-check and docs-row tests: 131 passed + 411 subtests; regen_fixtures --check clean. No translator change was needed: every word matched on the first run, including the mskor approximation and the b64 tearing model.

Docs: rows 321/322/324 now name the fixtures and the measured results and drop only the stale "Not GPU-verified" markers; the approximation caveats (b64 tearing, mskor as two atomics) stay. docs/shader_validation.md has a new subsection, and tests/semantic/README.md lists the new test.

@Atomic258

Copy link
Copy Markdown
Contributor

Tested at abbe0a0f on Windows 11, NVIDIA GeForce RTX 5090 (driver 617.42), MSYS2 llvm-mc 23.1.5, Vulkan SDK 1.4.363.0 (spirv-val).

  • python -I scripts/run_gpu_tests.py --llvm-mc <msys2>/llvm-mc.exe --filter cs_w32_lds — 9/9 PASS: all six new fixtures (mskor, atomics_incdec, atomics_rtn, minmax_f32, wrxchg_b64, wrxchg2st64_b64) plus the three pre-existing cs_w32_lds_* fixtures that match the filter. Every dump matches the expected words exactly (e.g. mskor → 0x11223344 0x11220008 0xffff0000 0xff000001 0xdeadbeef 0x5f5f5f5f 0xfeedface 0x12345678).
  • Translation stage: 9/9 translated, 9/9 spirv-val.
  • python -I tests/semantic/test_batch5_gpu_fixtures.py -v — 3/3 OK.
  • All six run as wave32 — no wave64 gates on this device.

AI-assisted (Devin); no game files.

@tupacfan04

Copy link
Copy Markdown
Contributor

APPROVE. I reproduced all six fixtures end to end on an NVIDIA RTX 5070 (driver 621.24, Vulkan SDK 1.4.363.0), independently of the author's gfx1036 run.

  • tests/semantic/test_batch5_gpu_fixtures.py 3/3; tests/test_shader_checks.py 79/79; python -I -m unittest discover -s tests/semantic -p "test_lds_*.py" 669 passed / 3 skipped; regen_fixtures.py --check, check_no_game_data.py, compileall and git diff --check clean; merge clean vs origin/main (ec34b54f).
  • Translated the six listings with --assembler python (computing each FSSM header from the .asm via compute_header); 6 shaders: 6 translated, 6 pass spirv-val.
  • Ran each with vk_compute_test.exe <spv> 1 dump at VKC_SUBGROUP_SIZE=32 under VK_LAYER_KHRONOS_validation: all six returned exactly the eight words in their headers, rc=0:
    • cs_w32_lds_mskor, _atomics_incdec, _atomics_rtn, _minmax_f32, _wrxchg_b64, _wrxchg2st64_b64.

The registration is consistent across the three places that state the words (.asm header, check.py:130+, run_gpu_tests.py:1019+), the 32-lane env is requested for every new dump, and the docs now replace the stale **Not GPU-verified.** marks on the rows they actually cover without touching unrelated rows.

No blocking issues and no nits worth changing.

AI-assisted review, no game files, no game data.

@YaBulochka

Copy link
Copy Markdown
Contributor Author

Cross-vendor check on an NVIDIA GeForce GTX 1660 SUPER (Turing, 32-wide subgroups), Linux, NVIDIA 620.70.06, main d974c88, same build: all six fixtures pass with the exact words (cs_w32_lds_m 2/2, cs_w32_lds_a 2/2, cs_w32_lds_wrxchg 2/2). The LDS CAS loops, the mskor approximation and the b64 exchanges behave identically on the NVIDIA driver, so this is no longer AMD-only evidence.

@JRamos1993

Copy link
Copy Markdown
Contributor

Tested abbe0a0 merged onto main de67135 on an RTX 5090 (driver 616.92), Windows 11, Vulkan SDK 1.4.363. The GPU test programs were built from the same tree:

  • scripts/run_gpu_tests.py: 176/223 passed, 47 skipped, 0 failed. main de67135 gives 170/217, 47 skipped, 0 failed. All 227 test shaders translate and pass spirv-val.
  • New GPU tests: cs_w32_lds_atomics_incdec PASS, cs_w32_lds_atomics_rtn PASS, cs_w32_lds_minmax_f32 PASS, cs_w32_lds_mskor PASS, cs_w32_lds_wrxchg2st64_b64 PASS, cs_w32_lds_wrxchg_b64 PASS.
  • tests/semantic/test_batch5_gpu_fixtures.py: ran 3 tests in 0.706s; OK.

AI-assisted (Claude Code).

@gertify

gertify commented Nov 23, 2026

Copy link
Copy Markdown

Tested abbe0a0 on AMD Radeon 610M (RADV RAPHAEL_MENDOCINO, gfx1036), CachyOS Linux, LEONIDA_VK_DEVICE=RADV: pass.

scripts/run_gpu_tests.py --filter cs_w32_lds: 9 translated, 9 pass spirv-val, 9/9 passed. The six new fixtures:

  • PASS cs_w32_lds_atomics_incdec 0x5 0x0 0x0 0x5 0x0 0x4 0x5 0xfffffffe
  • PASS cs_w32_lds_atomics_rtn 0x4 0x5 0x0 0x5 0x7 0xfffffffe 0x5 0x0
  • PASS cs_w32_lds_minmax_f32 0x80000000 0x0 0x3f800000 0x3f800000 0x7fc00000 0x3f800000 0x3f800000 0x3f800000
  • PASS cs_w32_lds_mskor 0x11223344 0x11220008 0xffff0000 0xff000001 0xdeadbeef 0x5f5f5f5f 0xfeedface 0x12345678
  • PASS cs_w32_lds_wrxchg_b64 0x11111111 0x88888888 0x22222222 0x44444444 0x33333333 0xcccccccc 0xdddddddd 0xeeeeeeee
  • PASS cs_w32_lds_wrxchg2st64_b64 0x11111111 0x44444444 0x55555555 0x88888888 0x33333333 0x77777777 0xaaaaaaaa 0xeeeeeeee

LEONIDA_VK_DEVICE=NoSuchDevice fails with "no Vulkan physical device matches", so the RADV device ran them. regen_fixtures.py --check is clean and test_batch5_gpu_fixtures.py ran 3 tests, OK.

AI-assisted.

@memorypressure

Copy link
Copy Markdown

Verified at head abbe0a0 merged with main 3faac55 at check time: tests/semantic/test_batch5_gpu_fixtures.py passes under unittest discover (re-run), so each new fixture's expected words agree across the .asm header, check.py and run_gpu_tests.py; the existing fixture and runner regressions stay green. Fixtures are generator-labelled, no game data. GPU execution of the six fixtures (including the claimed gfx1036 measurements) was not run here; checks were pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@Atomic258

Copy link
Copy Markdown
Contributor

Tested abbe0a0 on Windows Server 2022, CPython 3.13.12: pass

  • python -I -m unittest discover -s tests/semantic -p "test_batch5_gpu_fixtures.py" -> OK
  • GPU fixture .asm/.s additions not run (no GPU).

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. AI-assisted (Devin).

@bunbeans2-arch

Copy link
Copy Markdown

Tested the current head abbe0a0 on an AMD Radeon RX 9070 XT (RDNA4, subgroup 32..64) with AMD's Windows driver, Windows 11 23H2 (the AMD run here so far is RADV). scripts/run_gpu_tests.py --require-pass gives 208/223 passed, 15 skipped. All six new fixtures pass: cs_w32_lds_atomics_incdec, cs_w32_lds_atomics_rtn, cs_w32_lds_minmax_f32, cs_w32_lds_mskor, cs_w32_lds_wrxchg2st64_b64 and cs_w32_lds_wrxchg_b64. tests/semantic/test_batch5_gpu_fixtures.py gives 3 passed, 18 subtests passed.

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

@LukeOsland1

Copy link
Copy Markdown

Tested abbe0a0f66 on Windows 11 build 26300, NVIDIA RTX 4070 Ti SUPER, driver 610.88. I used the PR’s GPU runner with LLVM 23.1.6 and the MSVC-built harness from the tested sources. The Vulkan loader was restricted to the NVIDIA ICD.

  • cs_w32_lds_atomics_incdec — 8 expected output words matched.
  • cs_w32_lds_atomics_rtn — 8 expected output words matched.
  • cs_w32_lds_minmax_f32 — 8 expected output words matched.
  • cs_w32_lds_mskor — 8 expected output words matched.
  • cs_w32_lds_wrxchg2st64_b64 — 8 expected output words matched.
  • cs_w32_lds_wrxchg_b64 — 8 expected output words matched.

Xbox 1.0.2.1 coverage: 0 of 26,503 local shaders.rpf listings contain at least one of the following mnemonics. Static instruction counts (combining e32/e64 spellings): ds_mskor_rtn_b32 0, ds_wrxchg2st64_rtn_b64 0, ds_rsub_rtn_u32 0. The counts describe opcode presence. The GPU readback above uses the hand-written fixtures. AI-assisted with Codex.

@AnaNazzDev

Copy link
Copy Markdown

Tested f863fb36c on NVIDIA GeForce GTX 1080 (Pascal, 32-wide), driver 582.66, Windows 11 (10.0.26200): pass.

MSVC (VS 18) Vulkan test programs built from main (this PR doesn't change them), llvm-mc 21.1.8 (scripts/build_llvm_mc.ps1), SPIRV-Tools from Vulkan SDK 1.4.363.0.

run_gpu_tests.py --filter <fixture>, each fixture on its own, natively and with LEONIDA_W64_EMULATE=1:

fixture native LEONIDA_W64_EMULATE=1
cs_w32_lds_atomics_incdec PASS cs_w32_lds_atomics_incdec 0x5 0x0 0x0 0x5 0x0 0x4 0x5 0xfffffffe PASS cs_w32_lds_atomics_incdec 0x5 0x0 0x0 0x5 0x0 0x4 0x5 0xfffffffe
cs_w32_lds_atomics_rtn PASS cs_w32_lds_atomics_rtn 0x4 0x5 0x0 0x5 0x7 0xfffffffe 0x5 0x0 PASS cs_w32_lds_atomics_rtn 0x4 0x5 0x0 0x5 0x7 0xfffffffe 0x5 0x0
cs_w32_lds_minmax_f32 PASS cs_w32_lds_minmax_f32 0x80000000 0x0 0x3f800000 0x3f800000 0x7fc00000 0x3f800000 0x3f800000 0x3f800000 PASS cs_w32_lds_minmax_f32 0x80000000 0x0 0x3f800000 0x3f800000 0x7fc00000 0x3f800000 0x3f800000 0x3f800000
cs_w32_lds_mskor PASS cs_w32_lds_mskor 0x11223344 0x11220008 0xffff0000 0xff000001 0xdeadbeef 0x5f5f5f5f 0xfeedface 0x12345678 PASS cs_w32_lds_mskor 0x11223344 0x11220008 0xffff0000 0xff000001 0xdeadbeef 0x5f5f5f5f 0xfeedface 0x12345678
cs_w32_lds_wrxchg2st64_b64 PASS cs_w32_lds_wrxchg2st64_b64 0x11111111 0x44444444 0x55555555 0x88888888 0x33333333 0x77777777 0xaaaaaaaa 0xeeeeeeee PASS cs_w32_lds_wrxchg2st64_b64 0x11111111 0x44444444 0x55555555 0x88888888 0x33333333 0x77777777 0xaaaaaaaa 0xeeeeeeee
cs_w32_lds_wrxchg_b64 PASS cs_w32_lds_wrxchg_b64 0x11111111 0x88888888 0x22222222 0x44444444 0x33333333 0xcccccccc 0xdddddddd 0xeeeeeeee PASS cs_w32_lds_wrxchg_b64 0x11111111 0x88888888 0x22222222 0x44444444 0x33333333 0xcccccccc 0xdddddddd 0xeeeeeeee

Every module translated and passed spirv-val.

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

…ax, wrxchg b64)

Six wave32 fixtures for the docs/design.md rows 321, 322 and 324, each an
eight-word dump and lane 0 alone running the atomics:

- cs_w32_lds_mskor (ItsNotRexed#321): ds_mskor_b32 and ds_mskor_rtn_b32, including DATA2
  bits outside DATA being ORed in (0x11223344, mask 0x0000FFFF, DATA2 8 ->
  0x11220008) and the rtn old word.
- cs_w32_lds_atomics_incdec / _atomics_rtn (ItsNotRexed#322): ds_inc/dec/rsub_u32 at the
  DATA-1, DATA, above-DATA, 0 and 1 boundaries, the rsub wrap, and the pre-op
  word each _rtn_ form returns.
- cs_w32_lds_minmax_f32 (ItsNotRexed#322): ds_min/max_f32 and the returning forms with a
  qNaN in either operand, -0/+0 and +inf/-inf.
- cs_w32_lds_wrxchg_b64 (ItsNotRexed#324): ds_wrxchg_rtn_b64 and ds_wrxchg2_rtn_b64, the
  old pair, vdst order at *8 offsets 1 and 2, and the words written.
- cs_w32_lds_wrxchg2st64_b64 (ItsNotRexed#324): ds_wrxchg2st64_rtn_b64 at *64 offsets 1
  and 2 (0x200/0x400) over a 2 KiB LDS, with *8 markers so a wrong unit fails.

Registered in check.py (CS_DUMPS and both wave32 lists), run_gpu_tests.py
(every table and the wave64 exclusion), and regen_fixtures.py. Pinned by
tests/semantic/test_batch5_gpu_fixtures.py, which runs the same eight words
through spirv_mini_interp.

Both runners pass on the RDNA2 iGPU (gfx1036, RADV Mesa 27.0.0-devel), 8/8
words per fixture. No translator mismatch appeared.
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.

9 participants