Repository navigation
Conversation
…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.
|
Code read of
The part I'd question is the fixed
AI-assisted review (Claude Code). |
|
Tested |
|
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.
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. |
|
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
|
|
Independent check on an AMD Radeon RX 7800 XT (gfx1101, driver 32.0.32029.2010, Windows 11) — tested Pass on the words. 8/8 equal to the words in Red on Also on this tree: One finding: the GPU fixture does not discriminate private from shared memory. Changing only the storage class the translator emits ( One
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 Not covered by this check: the out-of-range and combined |
|
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.
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. |
|
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
The 14 skips are the expected D3D12-owned fixtures and 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.
|
Tested What I ran, from this branch, test programs rebuilt from the same commit (
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, |
|
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). |
|
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).
Synthetic fixtures only, no game files. AI-assisted (opencode); runs on my machine. |
tools/rdna2spirv.py AI-assisted.
|
Tested
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.
|
Tested Ran the PR’s synthetic fixtures through
AI-assisted verification with synthetic inputs. |
docs/design.md tools/rdna2spirv.py AI-assisted.
|
Tested
New in this PR:
Every other test has the same result as on |
|
Tested
No game files. AI-assisted (Claude Code). |
|
Tested
Synthetic fixtures only, no game files. AI-assisted (Claude Code). |
|
Tested 2f8bcac on Intel UHD 630 (CFL GT2, subgroup 8..32), Mesa 25.2.8 ANV, Ubuntu 24.04, LEONIDA_VK_DEVICE=Intel: pass.
AI-assisted. |
Requested by Lucas · project thread
Claimed in the coordination issue as: #2716 (comment)
What and why
Every
scratch_load_*/scratch_store_*raisedUnsupported. They now translate to a per-invocation private memory:SCRATCH_DWORDS= 256 dwords (1 KiB), zero at the start. No lane sees another's data and nothing touches device memory;FLAT_SCRATCHand the driver's scratch ring are not read. Address =vaddr(unlessoff) +saddr(unlessoff) + the signed 12-bit instruction offset.ubyte/sbyte/ushort/sshort, the_d16/_d16_hiloads andstore_byte/short(+_d16_hi) go one byte at a time, so only the addressed bytes change.lds,tfeand_addtidforms, 64-bit/pair address operands andvaddrtogether withsaddr(the assembler rejects it for gfx1036) stayUnsupported. The buffer forms with a scratch V# are the existing swizzled-addressing rule and address real memory.SCRATCH_ENis 0 in every compute shader of the corpus, perdocs/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.pyhas text tests and a hardware test. Results, wave32 and wave64 identical:v,s, offset (negative too) and offset-only addressing as implemented.vaddr+saddrin one instruction does not assemble, so it is refused here instead of summed (it was summed in the first version).cs_w32_scratch_unaligned.asmholding the measured words.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 thedocs/design.mdrow as limits of this choice. I did not probe stores beyond 8 KiB (they could land in other memory).tests/semantic/spirv_mini_interp.pynow 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. Onmain7 of its 9 tests error withUnsupported; with the fix all pass.cs_w32_scratch.asmandcs_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. Onmaintranslation 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 withLEONIDA_VK_DEVICE.scratch_load_sbytenot 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.pyandtests/test_hw_oracle.py(with the hardware test) pass. Negative control for the unaligned path: shifting by 0 instead of the byte offset failscs_w32_scratch_unalignedon both GPUs (out[0]0x87868180) and the tests.Checklist
docs/design.md, with how it was confirmed and what is not measured.AI-assisted.