Skip to content

GPU fixture cs_imgstore_cube: image_store on dim:SQ_RSRC_IMG_CUBE (GPU-CUBE-STORE) - #335

Merged
aslan2142 merged 1 commit into
ProjectLeonida:mainfrom
milk4sale:gpu-test/cube-store
Nov 24, 2026
Merged

aslan2142 merged 1 commit into
ProjectLeonida:mainfrom
milk4sale:gpu-test/cube-store

Conversation

@milk4sale

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: GPU-CUBE-STORE (#14 (comment))

Depends on: none. It builds on #44 (DOC-CUBE-STORE, merged), whose "Typed image stores" row said a cube store was "not GPU-verified: no GPU fixture covers a cube store yet". It touches vk_store_test.cpp, check.py, run_gpu_tests.py and test_shader_checks.py, which #213 also changes. The two don't overlap in meaning (#213 keeps 2D-array storage at bindings 11/12/13 and adds 26-28 for 1D arrays), but whichever lands second may need a textual rebase.

What and why

The translator writes image_store ... dim:SQ_RSRC_IMG_CUBE through a six-layer 2D-array storage view (bindings 11/12/13 for float/uint/sint, coordinates (x, y, face)), as the runtime binds a cube UAV (runtime/src/vulkan_bindless.h). Until now only tests/semantic/test_image_cube_store_glc.py checked that, on the CPU. This adds the GPU fixture:

  • runtime/test/shaders/cs_imgstore_cube.asm: three T#s (FORMAT 56 rgba8 unorm, 20 r32 uint, 21 r32 sint; word3 TYPE = 0xB, SQ_RSRC_IMG_CUBE). 64 threads each store to their texel on all six faces, with per-face values so a wrong layer shows: rgba8 (x/7, y/7, face/5, 1), uint 100 + 1000·face + 8y + x, sint -(1000·face + 8y + x).
  • vk_store_test cs_imgstore_cube.spv cube: three cube-compatible 8x8 images of six layers, each bound through a six-layer VK_IMAGE_VIEW_TYPE_2D_ARRAY storage view at index 1-3 of bindings 11/12/13. All six layers are read back and every texel of every face is checked. The other modes are unchanged: they keep their 8 bindings and do not create the cube images.
  • scripts/run_gpu_tests.py and runtime/test/shaders/check.py run it the way they run cs_imgstore. tests/test_shader_checks.py counts the seventh vk_store_test case and fakes its output.
  • docs/design.md, "Typed image stores": the cube sentence names the fixture and the GPUs it passed on, replacing "not GPU-verified".

Tested

On main 1c7f5b510 plus this commit, CachyOS (kernel 7.3.3), llvm-mc 23.1.4, SPIRV-Tools v2026.4, GCC 16.2.1:

GPU Driver cs_imgstore_cube native LEONIDA_W64_EMULATE=1
NVIDIA RTX 4070 Ti (Ada, subgroup 32) 620.70.06 PASS: 0/0/0 bad of 384 texels each PASS
Radeon 610M, Ryzen 9 7900X iGPU (gfx1036, RDNA2) RADV Mesa 26.2.6 PASS PASS
  • Negative control: the same fixture with the face held at 0 translates and passes spirv-val, and fails on both GPUs (rgba8 320 bad, uint 384, sint 384). Face 4 texel (5,3) reads 182 109 204 255 / 4129 / -4029 in the passing runs, as the fixture predicts.
  • cs_imgstore still passes on both GPUs, native and emulated.
  • scripts/run_semantic_tests.py tests/semantic: 463 files, 6,075 tests, 0 failed. ctest: 70/70 (2 skipped as on main). node --test tests/test_viewer_streaming.cjs: 57/57.
  • python -I tests/test_*.py for every standard-library test file: all pass except test_rdna2_decode.py, which fails the same way on main here (llvm-mc 23.1.4 prints op_sel:[0,1] where the decoder gives op_sel:[0,1,0,0]). The 30 pytest-based test files were not run (pytest is not installed on this machine).
  • Not run under the Khronos validation layer: it isn't installed here.
  • scripts/check_no_game_data.py on the new fixture: clean.

AI-assisted: yes (Claude Code)

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. (No new rule: this GPU-confirms the existing cube store row.)

🤖 Generated with Claude Code

@Sangonapou

Copy link
Copy Markdown
Contributor

Tested 6b2440b on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, subgroup 32..32), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300): pass

Runtime built at this head with scripts\build_runtime.ps1 (MSVC 19.51, VS Build Tools 2026); llvm-mc 23.1.6 (conda-forge), SPIRV-Tools 2026.4, Vulkan SDK 1.4.363.0. No game files.

…U-CUBE-STORE)

The "Typed image stores" contract row said a cube storage image was
CPU-checked only (test_image_cube_store_glc.py) and that no GPU fixture
covered it. This adds one:

- runtime/test/shaders/cs_imgstore_cube.asm: rgba8 unorm, r32 uint and
  r32 sint T#s (word3 TYPE = SQ_RSRC_IMG_CUBE); 64 threads store to every
  texel of all six faces, with per-face values so a wrong layer shows.
- vk_store_test "cube": three cube-compatible 8x8 six-layer images bound
  as six-layer 2D-array storage views at bindings 11/12/13, as the
  runtime binds a cube UAV; checks every texel of every layer.
- run_gpu_tests.py and check.py run it; test_shader_checks.py counts it.
- docs/design.md: the row names the fixture and the GPUs it passes on.
  Builds on ProjectLeonida#44, which rewrote that row.

Passes on an RTX 4070 Ti (NVIDIA 620.70.06) and a Radeon 610M (gfx1036,
RADV Mesa 26.2.6), native and LEONIDA_W64_EMULATE=1. The same fixture
with the face held at 0 fails on both (320/384/384 bad texels).

AI-assisted. No game files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trigger337

Copy link
Copy Markdown
Contributor

Tested b94936b on AMD Radeon RX 6900 XT (RADV NAVI21 / GFX1030, Mesa 26.2.5, Linux 7.3.1 CachyOS, Vulkan 1.4.328, subgroup 32..64): pass.

Discrete desktop RDNA2 verification:

  • runtime/build/linux/vk_store_test built cleanly via cmake --build runtime/build/linux --target vk_store_test.
  • python3 scripts/run_gpu_tests.py --build runtime/build/linux --filter cs_imgstore_cube --require-pass: PASS native and with LEONIDA_W64_EMULATE=1.
  • python3 scripts/run_gpu_tests.py --build runtime/build/linux --filter cs_imgstore --require-pass: 2/2 passed (cs_imgstore, cs_imgstore_cube).
  • Unit & semantic tests:
    • python3 -m unittest discover -s tests/semantic -p test_image_cube_store_glc.py: 9/9 passed.
    • python3 -I tests/test_shader_checks.py: 87/87 passed.
  • scripts/check_no_game_data.py: clean. No game files.

AI-assisted: yes
agent: yes

@dpalacios69

Copy link
Copy Markdown
Contributor

Independent verification of PR head b94936b (GPU-CUBE-STORE) on a GPU not covered yet: NVIDIA GeForce GTX 1660 SUPER (Turing TU116, PCI 10de:21c4), driver 620.70.06 (proprietary), Vulkan 1.4.357, Fedora Linux 44, subgroup 32..32. Built from the PR head, CMake + Ninja, 153/153 targets.

Results

  • cs_imgstore_cube: PASS native and with LEONIDA_W64_EMULATE=1, 20/20 and 20/20 repeated runs. Also PASS on llvmpipe (LLVM 22.1.8). spirv-val --target-env vulkan1.3 is clean; spirv-dis shows the three Arrayed=1 2D storage images at bindings 11/12/13, as the PR describes.
  • Full run_gpu_tests.py: 258/258 translated and pass spirv-val; native 198/249 passed (49 skipped), W64 230/249 (17 skipped). Both are +1 over the baseline measured on this card at 21625bc (197/248, 229/248); the only 2 failures are the known AMD Radeon 780M (RDNA3 iGPU, driver 26.10.2): cs_imgload_tfe and cs_imgload_d16_tfe fail on main - the tfe fetch status VGPR is read but never written #31 pair. ctest 69/69 (2 skipped). tests/test_shader_checks.py 87/87.
  • Rebased onto current main (14b5825) in a scratch copy: merges cleanly (no conflict with D3D-78: Support Texture1D, Texture1DArray and Texture3D UAVs #213), builds, and the same results hold (259/259 translate, native 199/250, W64 231/250).
  • The fixture has teeth. Three local mutations, each caught: a changed expected value in cube mode (FAIL, 320 bad texels), two faces swapped in the .asm (FAIL), and one image_store deleted (FAIL).
  • vk_store_test built with clang++ -fsanitize=address,undefined: 0 ASan errors, 0 UBSan reports (leak detection off).

Two small notes on the harness (not blockers)

  1. vk_store_test.cpp:120-121 skips cleanly when shaderStorageImageWriteWithoutFormat is missing, but cube mode never queries vkGetPhysicalDeviceFormatProperties (STORAGE_IMAGE_BIT for rgba8 unorm, r32 uint, r32 sint) or vkGetPhysicalDeviceImageFormatProperties with CUBE_COMPATIBLE; on a device without that support CHECK(vkCreateImage(...)) (around :320) aborts instead of skipping (exit 77). Probably fine for desktop GPUs; worth a guard for the odd driver.
  2. The harness never calls vkDestroy*/vkFreeMemory (same on main, so not new): with leak detection on, ASan reports ~290 KB held by the NVIDIA driver at exit.

CI failures on this PR (linux-gpu-tools, stdlib-tests-linux, macos, macos-python, windows, check) did not reproduce locally for the Linux ones on the PR's code; I did not run the macOS or Windows jobs. Not run: the Vulkan validation layer (not installed here) and a second llvm-mc version.

No game data. AI-assisted.

@aslan2142

Copy link
Copy Markdown
Collaborator

Tested 0d27fdc merged locally onto main 1504c1a: cs_imgstore_cube passes everywhere, and nothing else changes state.

Devices: RADV, Mesa 26.3.1, Linux:

  • AMD Radeon RX 7900 XTX (RDNA3, gfx1100);
  • Ryzen 9 7950X3D iGPU (RDNA2, gfx1036);
  • llvmpipe.

New fixture, 10 runs each with run_gpu_tests.py --filter cs_imgstore_cube --require-pass:

  • 10/10 natively and 10/10 with LEONIDA_W64_EMULATE=1 on all three devices, 0 bad for all three cube images;
  • the validation layer, with sync validation on, reports nothing on either AMD GPU.

Regressions, main vs main + #335:

  • Full run_gpu_tests.py on both GPUs, native and emulated: 232/250 → 233/251. The only change is the new PASS.
  • Every existing vk_store_test fixture keeps its state.
  • tests/test_shader_checks.py and tests/semantic/test_image_cube_store_glc.py pass on both trees.

CI: this head's checks are still queued on GitHub, so I ran the Linux jobs locally. They give the same result on both trees. The only failures are already on main:

AI-assisted (Claude Code, Claude Opus 5.5).

@aslan2142
aslan2142 merged commit 98a977b into ProjectLeonida:main Nov 24, 2026
3 of 6 checks passed
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.

5 participants