Skip to content

rdna2spirv: scratch_load_* and scratch_store_* as per-lane private memory, GPU-checked - #2914

Open
Vonsek wants to merge 6 commits into
ItsNotRexed:mainfrom
Vonsek:feat/scratch-private
Open

Vonsek wants to merge 6 commits into
ItsNotRexed:mainfrom
Vonsek:feat/scratch-private

Conversation

@Vonsek

@Vonsek Vonsek commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Lucas · project thread

Claimed in the coordination issue as: #2716 (comment)

What and why

Every scratch_load_* / scratch_store_* raised Unsupported. They now translate to a per-invocation private memory:

  • Each invocation gets a Private array of SCRATCH_DWORDS = 256 dwords (1 KiB), zero at the start. No lane sees another's data and nothing touches device memory; FLAT_SCRATCH and the driver's scratch ring are not read. Address = vaddr (unless off) + saddr (unless off) + the signed 12-bit instruction offset.
  • Dword and 2/3/4-dword accesses may start at any byte address (measured: byte granular, across dword boundaries). ubyte/sbyte/ushort/sshort, the _d16/_d16_hi loads and store_byte/short (+ _d16_hi) go one byte at a time, so only the addressed bytes change.
  • A store past the array is dropped and a load past it reads 0. lds, tfe and _addtid forms, 64-bit/pair address operands and vaddr together with saddr (the assembler rejects it for gfx1036) stay Unsupported. The buffer forms with a scratch V# are the existing swizzled-addressing rule and address real memory.
  • The size is a fixed cap, not read from the shader: the scratch size lives in the driver's ring setup, not in the shader binary (SCRATCH_EN is 0 in every compute shader of the corpus, per docs/design.md).

Measured on the Radeon (gfx1036, driver 26.10.1), with raw kernels through tools/hw_oracle. This PR now also extends the launcher: asm.Kernel(..., scratch=BYTES) (GFX10 raw kernels, Windows HIP launcher) writes the private segment size into the descriptor and metadata and starts the body after the usual FLAT_SCR setup; tests/test_hw_oracle.py has text tests and a hardware test. Results, wave32 and wave64 identical:

  • 32 and 64 lanes store different values to one scratch address and each reads its own back (private per lane).
  • v, s, offset (negative too) and offset-only addressing as implemented. vaddr + saddr in one instruction does not assemble, so it is refused here instead of summed (it was summed in the first version).
  • Unaligned dwords/dwordx2 are byte granular (a dword at 0x41 is bytes 0x41..0x44). The first version aligned them down; fixed here, with cs_w32_scratch_unaligned.asm holding the measured words.
  • Every byte, short and d16 load and store form gives the words the translator gives; a masked lane neither stores nor loads (a load keeps vdst).
  • The declared private segment size is not a bound: with 4, 64, 256 and 1024 bytes declared a lane stores and reads back at 0x2000 (8 KiB); unwritten scratch reads 0 up to 0x100000; reads at 0x1000000 and up, or at a negative address, return 0xFFFFFFFF (faulting reads). The translator's array stops at 1 KiB (a shader using more reads 0 and loses stores) and does not model the faulting reads; both are documented in the docs/design.md row as limits of this choice. I did not probe stores beyond 8 KiB (they could land in other memory).

tests/semantic/spirv_mini_interp.py now accepts Private variables (they behave like Function ones there).

Tested

  • tests/semantic/test_scratch.py: all forms and address combinations, neighbouring bytes, d16, out of range, inactive lanes, refusals, and the fixture's lane-0 twin. On main 7 of its 9 tests error with Unsupported; with the fix all pass.
  • GPU fixtures cs_w32_scratch.asm and cs_w32_scratch_unaligned.asm; cs_w32_scratch.asm (hand-derived words in its header): 32 lanes store different values to the same scratch address and each reads back its own (out[0] = 32; a shared word would give one), then dword/x2/x4, byte, short and sign-extending loads on lane 0. On main translation fails. With the fix, 8/8 words exact on the NVIDIA GeForce RTX 5080 (driver 616.92) and the AMD Radeon RDNA2 iGPU (driver 26.10.1), each selected with LEONIDA_VK_DEVICE.
  • Negative controls (each reverted): scratch_load_sbyte not sign extending fails the fixture on both GPUs (out[5] 0xab) and the tests; indexing the array with a constant fails it on both GPUs (out[1] 0xbeef0000) and the tests.
  • python -m unittest discover -s tests/semantic: 4147 tests OK (3 skipped); regen_fixtures.py --check, tests/test_shader_checks.py and tests/test_hw_oracle.py (with the hardware test) pass. Negative control for the unaligned path: shifting by 0 instead of the byte offset fails cs_w32_scratch_unaligned on both GPUs (out[0] 0x87868180) and the tests.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • The new translator rule is in the contract table of docs/design.md, with how it was confirmed and what is not measured.

AI-assisted.

…mory

A Private array of 256 dwords per invocation; dword, byte, short and d16 forms; out of range stores are dropped and
loads read 0 (hardware behaviour not measured). GPU fixture cs_w32_scratch on an RTX 5080 and the Radeon RDNA2 iGPU,
semantic tests (red on main), design.md row.

AI-assisted.
@tupacfan04

Copy link
Copy Markdown
Contributor

Code read of 67be0e41 (I didn't run it). The lowering looks careful:

  • Inactive lanes skip both stores and loads (the OpPhi keeps vdst).
  • Every dword of a multi-dword access is bounds-checked on its own.
  • Byte and short accesses go a byte at a time, so a short across a dword boundary works, and _d16_hi stores take bits 16 and up.
  • Sign extension is applied to the assembled value.
  • scratch_store / _d16 loads are added to the three register-use scans, so liveness stays right.

The part I'd question is the fixed SCRATCH_DWORDS = 256 (1 KiB per lane). Compiler-generated scratch is mostly register spills and dynamically indexed private arrays, and a spill-heavy shader can easily need more than 1 KiB per lane. Above 1 KiB, stores are silently dropped and loads read 0, so an over-size shader translates cleanly and computes wrong values with no hint. Two ways to make that visible:

  • Size the array from what the program asks for. The scratch size the hardware allocates is in the shader's register state (SCRATCH_EN plus the per-wave scratch size; the FSSM header may carry it, as it does RSRC2 for LDS), or at least from the largest constant offset used. Record it in the index, the way lds_bytes is.
  • Or refuse (Unsupported) when a constant scratch address is known to be past the array, and count the shaders with scratch over the corpus, so the 1 KiB choice is backed by a number.

AI-assisted review (Claude Code).

@Marukooh

Copy link
Copy Markdown
Contributor

Tested 67be0e41 on CachyOS Linux, RTX 5070 Ti, NVIDIA 620.73.04. The synthetic cs_w32_scratch fixture translated, passed spirv-val, and matched all eight expected output words through scripts/run_gpu_tests.py with the existing Vulkan harness. The lane-isolation counter is 32/32 and the byte/short, sign-extension and dword-vector checks all match. All nine scratch semantic tests passed. AI-assisted, synthetic inputs only.

@bobcatchris

Copy link
Copy Markdown
Contributor

Tested 67be0e4 on Apple M2 (Mac14,3), macOS 26.4 (25E246), MoltenVK 1.4.2 (direct), subgroup 4..32, llvm-mc 23.1.6, Python 3.13.18: could not be judged here.

python -I scripts/run_gpu_tests.py --filter cs_w32_scratch --build runtime/build/linux: 1 shader translated, 1 pass spirv-val; 0/1 passed, 1 skipped — SKIP (the device can't run this shader at 32 lanes on request). This is the known MoltenVK 32-lane pinning limitation on this machine, not a pass or a failure of the patch; the M2 cannot validate this wave32 fixture.

Build note: full build fails on AppleClang 17 at vk_pipeline_check.cpp:567 (BUILD-822, fixed by open PR #2927); GPU binaries built, so the translation/skip result above is valid. Head fetched unchanged into a separate worktree; no rebase/edit/push. Synthetic shader only; no game files.

AI-assisted.

@Rainmaker33

Copy link
Copy Markdown

Tested 67be0e4 on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass.

The PR's diff applied cleanly to main 77444fa. VS 2022, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8; harness programs from a CMake build of main; overlay layers off.

@UNYTIX

UNYTIX commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Independent check on an AMD Radeon RX 7800 XT (gfx1101, driver 32.0.32029.2010, Windows 11) — tested 67be0e41, and again with origin/main (77444fa0) merged into it.

Pass on the words. cs_w32_scratch translates (1 shaders: 1 translated, 1 pass spirv-val), spirv-val --target-env vulkan1.2 exits 0, and vk_compute_test ... 1 dump gives

out[0..7] = 32 84281096 151653132 286370577 3203334144 4294967211 48879 4294950639

8/8 equal to the words in check.py / run_gpu_tests.py, both at the device default wave size and with VKC_SUBGROUP_SIZE=32 (compute subgroup size: 32). This is RDNA3, a third family next to the RTX 5080 and the RDNA2 iGPU in the description.

Red on main: the same listing (tests/semantic/fixtures/disasm/cs_w32_scratch.s) through origin/main's translator gives 1 shaders: 0 translated, with the error naming scratch_store_dword.

Also on this tree: test_scratch.py 9 tests OK, regen_fixtures.py --check rc 0, tests/test_shader_checks.py 69 OK, tests/test_run_gpu_tests.py 34 OK.


One finding: the GPU fixture does not discriminate private from shared memory. Changing only the storage class the translator emits (OpTypePointer Private → Workgroup for %scratch_arr and %uint, and %scratch as Workgroup, nothing else) gives the same eight words on this GPU, out[0] = 32. So out[0] does not show here that "a shared word would give one": with no barrier between the store and the load, the driver's compiler appears to forward each lane's store into its own load, so the pair never has to reach memory at all. (Words 1..7 run with EXEC = 1, so they don't test isolation either.)

One s_barrier between s_waitcnt_vscnt null, 0x0 and scratch_load_dword makes it bite, with the expected words unchanged:

translation of the same listing out[0]
this PR (Private) 32
this PR with s_barrier (Private) 32
shared (Workgroup) variant 32
shared (Workgroup) variant with s_barrier 1

So with the barrier the fixture really measures per-lane isolation (and it then passes on this GPU), without it it would pass for a shared array too. Suggest adding that barrier to cs_w32_scratch.asm — the hand-derived words stay exactly as they are.

Not covered by this check: the out-of-range and combined vaddr+saddr assumptions (the row still calls them unmeasured, which is right), and the _d16 forms, which run only in the semantic tests.

@Etoile-Bleu

Copy link
Copy Markdown
Contributor

Tested 67be0e4 (on top of ec8ec4c) on NVIDIA GeForce RTX 5070 Ti, driver 621.24, Windows 11 (10.0.26200), Vulkan SDK 1.4.363.0: pass.

  • python -I tests/semantic/test_scratch.py: 9/9; python -m unittest discover -s tests/semantic: 4146 tests OK; regen_fixtures.py --check, test_shader_checks.py and test_shader_meta.py pass.
  • python -I scripts/run_gpu_tests.py (llvm-mc 21.1.8 built with scripts/build_llvm_mc.ps1, runtime built with MSVC/Ninja): 144/190 passed, 0 failed, 46 skipped. cs_w32_scratch gives all 8 words exact (0x20 0x5060708 0x90a0b0c 0x1111ab11 0xbeef0000 0xffffffab 0xbeef 0xffffbeef), so 32 lanes storing to the same scratch address each read back their own value on a 32-wide subgroup.
  • I also read the translator diff: scratch_address, scratch_mem and the three register analyses (read_before_write_vgprs, interp_ij_analysis, reg_reads_writes) are updated consistently. I found nothing to change.

This is a second GPU/driver for the fixture (the PR tested an RTX 5080 and an RDNA2 iGPU). No game files used. Run with AI assistance.

@javdc

javdc commented Nov 22, 2026

Copy link
Copy Markdown

Tested 67be0e4 on Steam Deck LCD (Van Gogh, RADV Mesa 26.2.0-devel, SteamOS 3.9.5, kernel 7.2.7-valve2-2-neptune-72-g31504582a073): pass.

Commands run (from the PR worktree, against the existing runtime/build on ec8ec4c9):

  • python3 -I tests/semantic/test_scratch.py -> 9/9 OK
  • python3 -I scripts/run_gpu_tests.py --build /home/deck/opencode/Leonida/runtime/build --filter scratch -> 1/1 passed (cs_w32_scratch)
  • python3 -I scripts/run_gpu_tests.py --build /home/deck/opencode/Leonida/runtime/build -> 176/190 passed, 14 skipped, 0 failed

The 14 skips are the expected D3D12-owned fixtures and ps_w64x_readlane on this RADV device (cannot require a 64-wide fragment subgroup); no failures. Total increased by 1 vs the 175/189 baseline due to the new cs_w32_scratch fixture.

AI-assisted (OpenCode).

… on gfx1036

The launcher change gives a raw kernel private memory (descriptor, metadata, FLAT_SCR prologue). Measured on an RDNA2
iGPU: private per lane, unaligned dwords are byte granular (now implemented), the declared size is not a bound, vaddr
and saddr together do not assemble (now refused). cs_w32_scratch_unaligned holds the measured words.

AI-assisted.
@romanchuchlovaf-cloud

romanchuchlovaf-cloud commented Nov 22, 2026 •

Copy link
Copy Markdown

Tested e510ed3 (updated: was 67be0e4) on NVIDIA GeForce GTX 1660 SUPER (Turing, TU116), NVIDIA 32.0.16.2124, Vulkan 1.4.357, Windows 11 IoT Enterprise LTSC 10.0.26100, compute subgroup 32..32, LEONIDA_W64_EMULATE=1: pass.

What I ran, from this branch, test programs rebuilt from the same commit (cmake -S runtime -B runtime/build-win -G Ninja -DLEONIDA_BUILD_WINDOWS_RUNTIME=OFF -DVulkan_INCLUDE_DIR=<Vulkan-Headers>, MSVC 19.44, no Vulkan SDK; tools: llvm-mc 23.1.6 with the AMDGPU target, spirv-as/spirv-val built from SPIRV-Tools):

  • --filter scratch → 2/2 passed: cs_w32_scratch 0x20 0x5060708 0x90a0b0c 0x1111ab11 0xbeef0000 0xffffffab 0xbeef 0xffffbeef, and the newer cs_w32_scratch_unaligned 0x85848382 0x94939291 0x8483 0xbbccddc0 0xc7c6c5aa 0x1111d1d0 0x22221111 0xdbda2222.
  • Whole suite on e510ed3: 176/191 passed, 15 skipped, 0 failed. Same machine, same tools, origin/main (1628210, which this branch now merges): 174/189 passed, 15 skipped, 0 failed — the two scratch fixtures are the only difference, no regression. The 15 skips are the usual ones: the 14 fixtures that d3d12_*_test owns (cs_buf_counter, cs_buf_typed, cs_m4_fill, cs_m4_indirect, ps_m2, ps_m2_array, ps_m2_uoff, ps_m3, ps_m3_post, ps_m3_query, ps_m15, vs_m2, vs_m3, vs_m15) and ps_w64x_readlane (needs a 64-wide fragment subgroup; this device is 32..32).
  • pytest tests/semantic/test_scratch.py → 10 passed, 11 subtests passed.

This is a 32-wide card, so all of it ran through the wave64 emulation path; the private-memory lowering is per-invocation and does not depend on the subgroup size, but the fixtures do exercise it under emulation here.

Not covered by this run: the hardware questions the PR lists (out-of-range scratch, vaddr + saddr, more than 1 KiB per lane). No AMD GPU here — tools/hw_oracle on Windows needs the AMD HIP runtime — so the 0899d77 gfx1036 measurements are not mine; I only re-ran the synthetic path on NVIDIA.

@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):

No problems found. ctest on the RTX 4080 SUPER: 129/129 passed. Intel UHD 770 ctest: only the two known base failures, d3d12_descriptor (fixed by #2948) and d3d12_subgroup (fixed by #2934).
Fixtures cs_w32_scratch and cs_w32_scratch_unaligned: PASS on both RTX 4080 SUPER and Intel UHD 770 with identical output.

@2-CD

2-CD commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Windows + GPU check: RTX 5080 + RTX 3070 Ti (NVIDIA 621.01) and AMD Radeon 610M iGPU (Ryzen 9 9950X3D, driver 32.0.13018.6), Windows 11, MSVC RelWithDebInfo/Ninja, Python 3.12, llvm-mc (AMDGPU) + spirv-as/val for the new fixtures. Tested head e510ed3 (PR currently conflicts with main).

  • python -m unittest discover -s tests/semantic: OK (4100+ tests incl. the new test_scratch.py, 4 skipped).
  • tests/test_hw_oracle.py (extended here): OK (1 skipped).
  • Clean build incl. the new cs_w32_scratch / cs_w32_scratch_unaligned fixtures.
  • Full ctest -C RelWithDebInfo -j 6: 125/125 on the RTX 5080 and 125/125 on the iGPU (the four window-showing present/swapchain tests excluded from the loops; the new scratch fixtures ran as part of the corpus).
  • The PR's dirty merge state is a rebase conflict, not a build or test failure: everything built and passed as-is.

Synthetic fixtures only, no game files. AI-assisted (opencode); runs on my machine.

tools/rdna2spirv.py

AI-assisted.
@Yourrespawn

Copy link
Copy Markdown
Contributor

Tested ce4ff9b8 on NVIDIA GeForce RTX 4080 (Ada, subgroup 32..32), driver 617.14, Vulkan API 1.4.351, Windows 11 Pro 10.0.26200: pass.

  • Both new fixtures on real hardware: cs_w32_scratch PASS (dword/dwordx4, the 0xbeef0000/0xbeef load-widening and sign-extension words, out-of-bounds read of 0, off+saddr combination) and cs_w32_scratch_unaligned PASS (byte and short stores at unaligned offsets — 0x85848382, 0xbbccddc0 — only the addressed bytes change)
  • run_gpu_tests.py: 155/201 passed, 0 failed, 46 skipped (native wave64, expected on this 32-lane GPU)
  • Semantic suite: 7332 OK, 1 expected failure (Python 3.12.10)

Per-lane private memory (1 KiB per invocation, no FLAT_SCRATCH ring) works end to end on NVIDIA, including the byte-granular cases that go one byte at a time.

AI-assisted (ZCode agent): builds and runs executed by a coding agent on this machine.

docs/design.md
runtime/test/shaders/check.py
scripts/run_gpu_tests.py
tests/semantic/regen_fixtures.py
tests/test_hw_oracle.py
tools/hw_oracle/asm.py
tools/rdna2spirv.py

AI-assisted.
@Kev-Ball

Copy link
Copy Markdown

Tested 09cf737d 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 fixtures through scripts/run_gpu_tests.py --build runtime/build/linux --filter <fixture> --require-pass. Both shaders translated and passed Vulkan SPIR-V validation. GPU readback passed:

  • cs_w32_scratch — 0x20 0x5060708 0x90a0b0c 0x1111ab11 0xbeef0000 0xffffffab 0xbeef 0xffffbeef.
  • cs_w32_scratch_unaligned — 0x85848382 0x94939291 0x8483 0xbbccddc0 0xc7c6c5aa 0x1111d1d0 0x22221111 0xdbda2222.

AI-assisted verification with synthetic inputs.

docs/design.md
tools/rdna2spirv.py

AI-assisted.
@junaydirfan

Copy link
Copy Markdown

Tested 2f8bcac9 merged into main 98fa503f on Linux (CachyOS, kernel 7.3.5), llvm-mc 23.1.5, LEONIDA_W64_EMULATE=1, test programs built from main (this PR changes no C++): pass.

GPU driver run_gpu_tests.py main
Intel Raptor Lake-S iGPU (Xe-LP), subgroup 8..32 Mesa ANV 26.3.1 188/219 passed, 31 skipped, 0 failed 186/217
RTX 4080 Laptop GPU (Ada), subgroup 32 NVIDIA 620.73.04 203/219 passed, 16 skipped, 0 failed 201/217

New in this PR:

  • cs_w32_scratch: Intel PASS, 0x20 0x5060708 0x90a0b0c 0x1111ab11 0xbeef0000 0xffffffab 0xbeef 0xffffbeef; RTX 4080 PASS, 0x20 0x5060708 0x90a0b0c 0x1111ab11 0xbeef0000 0xffffffab 0xbeef 0xffffbeef
  • cs_w32_scratch_unaligned: Intel PASS, 0x85848382 0x94939291 0x8483 0xbbccddc0 0xc7c6c5aa 0x1111d1d0 0x22221111 …; RTX 4080 PASS, 0x85848382 0x94939291 0x8483 0xbbccddc0 0xc7c6c5aa 0x1111d1d0 0x22221111 …

Every other test has the same result as on main on both GPUs.

@jimokulou2-ops

Copy link
Copy Markdown

Tested 2f8bcac merged onto main 98fa503 (clean merge) on AMD Radeon RX 9070 XT (RDNA4), AMD 26.11.2 (32.0.32029.2010, LLPC, Vulkan 1.4.359), Windows 11 Pro 26300: pass.

  • Test programs built from main with llvm-mingw (the PR doesn't touch the runtime C++), llvm-mc 23.1.6 (conda-forge), Vulkan SDK 1.4.363.0, LEONIDA_VK_DEVICE=9070.
  • scripts/run_gpu_tests.py, full suite: 204/219 passed, 15 skipped, 0 failed; 223 shaders translated, 223 pass spirv-val. main 98fa503 on the same machine: 202/217, the same 15 skipped. The only difference is the 2 new tests:
    • cs_w32_scratch: PASS 0x20 0x5060708 0x90a0b0c 0x1111ab11 0xbeef0000 0xffffffab 0xbeef 0xffffbeef
    • cs_w32_scratch_unaligned: PASS 0x85848382 0x94939291 0x8483 0xbbccddc0 0xc7c6c5aa 0x1111d1d0 0x22221111 0xdbda2222
  • tests/semantic/test_scratch.py: 10 OK; pytest tests/test_hw_oracle.py: 47 passed, 8 skipped.
  • tests/semantic/regen_fixtures.py --check: clean.

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

@lunarminus

Copy link
Copy Markdown

Tested 2f8bcac9 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 is a fast-forward: 2f8bcac9 already contains d0835dd9 (it merges main 0db7fed5), so the tree tested is 2f8bcac9 itself. git diff 0db7fed5 2f8bcac9 is the 13 files of this PR, no C++. The Vulkan test programs were built from a tree whose runtime/ (except runtime/test/shaders) is identical to 2f8bcac9.
  • scripts/run_gpu_tests.py, full suite: 204/219 passed, 15 skipped, 0 failed both native and with LEONIDA_W64_EMULATE=1; 223 shaders translated, 223 pass spirv-val.
    • cs_w32_scratch: PASS 0x20 0x5060708 0x90a0b0c 0x1111ab11 0xbeef0000 0xffffffab 0xbeef 0xffffbeef (both modes)
    • cs_w32_scratch_unaligned: PASS 0x85848382 0x94939291 0x8483 0xbbccddc0 0xc7c6c5aa 0x1111d1d0 0x22221111 0xdbda2222 (both modes)
    • --filter scratch --require-pass: 2/2 in both modes, same words.
  • Per test against d0835dd9 without the PR (196/210 passed, 14 skipped, both modes): every test in both runs has the same PASS/SKIP result, in both modes. Besides the two scratch fixtures, 7 tests are new compared to that run: cs_smem_sconst_off, ps_far_branch, ps_sample_c, ps_sample_c_b, ps_texture_b_cl and ps_texture_cl (PASS) and ps_m2_literal (SKIP, run by d3d12_m2_textured_test). They were added by main between d0835dd9 and 0db7fed5, not by this PR.
  • tests/semantic/test_scratch.py: 10 OK. regen_fixtures.py --check (LEONIDA_AMD_CLANG=clang 23.1.5): rc 0. tests/test_shader_checks.py: 79 OK. tests/test_run_gpu_tests.py: 41 OK. pytest tests/test_hw_oracle.py: 46 passed, 9 skipped; the two new scratch= text tests pass, the new hardware test test_scratch_memory_is_private_per_lane_and_byte_granular is skipped (it needs a GFX10 render node; this is gfx1103).
  • python -m unittest discover -s tests/semantic: 6255 tests, 3 failures and 2 errors, all in test_loop_ballot_barrier.py (test_divergent_loop_wave64_emulate_and_native_cs for 3 emulate modes; test_nested_divergent_loops_emulate and test_bug4b_loop_carried_split_sgpr_pair_ballot raise Unsupported SPIR-V op OpFunctionCall in the test's interpreter). main 0db7fed5 without this PR gives the same 3 failures and 2 errors in that file, and the PR does not change it, so they don't come from this PR.
  • Not checked: the cs_w32_scratch.asm at this head still has no s_barrier between s_waitcnt_vscnt null, 0x0 and scratch_load_dword v3, v1, off (lines 23-24), the barrier suggested earlier in this thread. I did not run the Private/Workgroup control on RADV, so I can't say whether out[0] tells them apart on this GPU.

Synthetic fixtures only, no game files.

AI-assisted (Claude Code).

@gertify

gertify commented Nov 23, 2026

Copy link
Copy Markdown

Tested 2f8bcac on Intel UHD 630 (CFL GT2, subgroup 8..32), Mesa 25.2.8 ANV, Ubuntu 24.04, LEONIDA_VK_DEVICE=Intel: pass.

  • scripts/run_gpu_tests.py --filter scratch: 2 shaders: 2 translated, 2 pass spirv-val; 2/2 passed.
    • PASS cs_w32_scratch 0x20 0x5060708 0x90a0b0c 0x1111ab11 0xbeef0000 0xffffffab 0xbeef 0xffffbeef
    • PASS cs_w32_scratch_unaligned 0x85848382 0x94939291 0x8483 0xbbccddc0 0xc7c6c5aa 0x1111d1d0 0x22221111 0xdbda2222
      With LEONIDA_VK_DEVICE=NoSuchDevice both fail with "no Vulkan physical device matches", so the Intel device ran them.
  • Full suite: 156/219 passed, 61 skipped. The two failures are cs_fmt_int_narrow and cs_signed_zero_nan, which main 3faac55 also fails on this machine (154/217 passed, 61 skipped there); the two extra passes are the new scratch fixtures.
  • tests/semantic test_scratch: 10 tests, OK. tests/test_hw_oracle.py: 47 tests, OK, 3 skipped (the on-hardware class needs a GFX10 node). regen_fixtures.py --check: clean.

AI-assisted.

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.