Repository navigation
rdna2spirv: 8/16-bit MUBUF loads and stores (buffer_load_ubyte/ushort/d16, buffer_store_byte/short) - #1864
rdna2spirv: 8/16-bit MUBUF loads and stores (buffer_load_ubyte/ushort/d16, buffer_store_byte/short)#1864LouisRiverstone wants to merge 3 commits into
Conversation
c1aca23 to
f49e92c
Compare
|
Tested f49e92c on NVIDIA GeForce GTX 1660 (Turing, TU116, subgroup 32..32), driver 620.73.04 (proprietary, Vulkan 1.4.357), Arch Linux (kernel 6.18): pass, no regression. Native build of runtime/ from this head (Ninja, RelWithDebInfo, clang 23.1.5), llvm-mc 23.1.5, SPIRV-Tools v2026.4.
The PR adds no GPU fixture, so the new loads and stores are covered only by the semantic tests here. AI-assisted run (Claude). Synthetic programs only, no game files involved. |
|
Tested f49e92c on Linux 6.8 (Python 3.12.3, CPU only, semantic interpreter): pass.
Extra 1, linear buffer against a byte model: 700 random cases over all fourteen ops (496 loads, 204 stores). Each one draws 24 random buffer bytes, a byte offset 0-21 split at random between Extra 2, the swizzled path, which the PR's tests do not reach: a literal V# with SWIZZLE_ENABLE, stride 0, INDEX_STRIDE 0 and 1, offsets 0-11, for Not checked here: nothing on a GPU, and the out-of-range d16 result is unmeasured, as the description already says. A swizzled V# with a non-zero stride or AI-assisted review. |
|
Thanks for the implementation! I ran the focused semantic tests on Linux and got 6/6 for I noticed the new MUBUF operations do not yet have a dedicated GPU fixture. Is anyone already working on one? If not, I would be interested in a separate synthetic GPU test on RX 7600/RADV, initially covering sign extension and preservation of neighboring bytes. It would depend on this PR and use no game files. AI-assisted. |
|
Corpus check on my own 1.0.2.1 package (26,503 shaders disassembled with llvm-mc 21, gfx1013), comparing this PR's head with its own base, not with today's
AI-assisted (Claude Code). |
|
Tested All 119 GPU dispatches matched the expected values from For example, I used the PR’s translator unchanged and a local copy of AI-assisted |
Static review — PR #1864Branch: buffer-sub-dword (head of PR #1864) What it does
Reviewer recommendationApprove (static review + CPU tests). The implementation matches the documented semantics: per-byte access granularity, dword-crossing exactness, merge stores with atomic and/or, bounds per access size, d16 half keep/combine, inactive-lane skipping. All 6 tests / 119 subtests pass; compileall clean. Note: PR is marked CONFLICTING on GitHub — the author needs to rebase on Not GPU-verified (the PR itself notes this; 8/16-bit MUBUF has no RDNA2 desktop part coverage per the design doc). CPU test results
AI-assisted. Reviewed with Claude Code. |
|
Tested
No game data. AI-assisted. |
|
Checked on the 52 What only this PR provides for the builder is AI-assisted. |
|
Package check of
This unblocks TEST-376, which runs the three rehydration programs on a GPU against the CPU reference in #2205. GitHub currently shows this PR as conflicting with AI-assisted. Windows 11, SPIRV-Tools 2026.4. |
|
hey @LouisRiverstone, this went conflicting after the round-39 merges, so i rebased it onto main heads-up, there was a semantic conflict git didn't flag: main now has its own
plus one extra commit (mine, drop it if you don't want it): GPU fixture results on the rebased head
not checked: AMD hardware, d16 out-of-range on real RDNA2 (your "not measured" note still stands). AI-assisted (Claude Code). TL;DR: rebased onto main on my fork. Fixed a hidden name clash with main's |
… rule (buffer_store_short) left (PROC-120) Recounted with main 4947579 on the 1.0.2.1 package (counts only): 52/52 unpack, 42 clean and 10 with invalid words in the disassembly, 51 translate and pass spirv-val. The four rules embedded_shaders.md listed are three since 427c137 (ItsNotRexed#1968); Box16Rehydration stops at buffer_store_short (ItsNotRexed#1864). d3d12_vulkan.md and the docs index quoted 41/42 and four rules in seven places. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Rebased on |
f49e92c to
b62516c
Compare
…esn't go stale (review nit) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Update docs/embedded_shaders.md §4 and §5 and related references in docs/d3d12_vulkan.md to reflect current main: 51 of 52 XboxBvhBuilder.dll compute shaders now translate and pass spirv-val since ItsNotRexed#1871 (GFX10_FORMAT_8_UINT) and ItsNotRexed#1968 (427c137: global_atomic_fmax/fmin and buffer_load_ushort) landed. Only Box16Rehydration remains blocked, awaiting buffer_store_short (ItsNotRexed#1864). Claim: ItsNotRexed#2300 (comment)
Update docs/embedded_shaders.md §4 and §5 and related references in docs/d3d12_vulkan.md to reflect current main: 51 of 52 XboxBvhBuilder.dll compute shaders now translate and pass spirv-val since #1871 (GFX10_FORMAT_8_UINT) and #1968 (427c137: global_atomic_fmax/fmin and buffer_load_ushort) landed. Only Box16Rehydration remains blocked, awaiting buffer_store_short (#1864). Claim: #2300 (comment)
…ed; the M6 row's count The merge round took this PR's first commit and ItsNotRexed#2503, which say the same thing, so section 4 carried both: the then/now table and, after a stray table row, the bullet list and a second blocker table. Keep the table (now without 'open' after ItsNotRexed#1864) and drop the repeat. d3d12_vulkan.md's M6 milestone row still said 42 pass and four rules left.
b62516c to
130dd56
Compare
|
Rebased onto
|
|
Tested |
|
Tested
No game files. AI-assisted (Claude Code). |
buffer_load_{u,s}byte_d16[_hi], buffer_load_short_d16[_hi] and
buffer_store_byte/short[_d16_hi] (BUFFER_SUB16): one 16-bit half of vdata
is loaded or stored, the other kept; bounds checked at the access's own
size; stores merge each byte with atomic and/or. The plain
buffer_load_{u,s}byte / {u,s}short are main's buffer_load_sub; the tests
check them too. Fixes Box16Rehydration's buffer_store_short.
130dd56 to
e154905
Compare
|
Tested e154905 on Windows 11, Python 3.12.10 (CPU/semantic check only, no GPU, no game files): pass.
AI-assisted review (Gemini). |
@caua-an asked on ItsNotRexed#1864 for a dedicated GPU fixture. Lane 0 seeds three dwords and loads into a register holding 0xBEEF1234, so each of the six d16 loads (ubyte/sbyte/short, low and high half) shows the half it writes, the half it keeps and sbyte's sign extension; buffer_store_byte_d16_hi and buffer_store_short_d16_hi take bits 23:16 / 31:16. Passes on llvmpipe with LLVM 21 and 23; main's translator can't translate it. Registered in check.py, run_gpu_tests.py and regen_fixtures.py; tests/semantic/ test_buffer_sub16_fixture.py runs it on the CPU. docs/design.md row points at it.
|
@caua-an asked earlier whether these MUBUF ops would get a dedicated GPU fixture, and now they have one:
Real-GPU runs are welcome. |
|
Tested The new wave32 fixture
The signed byte loads extended 0xaa to 0xffaa in either destination half, while the unsigned loads produced 0x00aa. The byte and short stores also preserved their neighboring bytes. The shader passed spirv-val. This was a filtered run of the new fixture. AI-assisted verification. |
@tylerstraub ran the new fixture on an NVIDIA RTX 5090 (595.99.02, Linux): all eight words. The row named llvmpipe only.
|
Thanks @tylerstraub. That's the fixture's first real-GPU run: all eight words, including |
|
Tested
As a control, the base translator at AI-assisted (Codex). |
|
Thanks @CryingLaughing (RTX 4080, LLVM 23, GPU-assisted validation). The base translator stopping at |
|
Independent run of head
Both GPUs return the same words, bit for bit: The base translator ( One gap for the M6 claim: the fixture has the Note: the PR branch is 8 commits behind |
The 8/16-bit MUBUF loads and stores raised
Unsupported: all fourteen ofbuffer_load_ubyte,sbyte,ushort,sshort, the_d16/_d16_hiloads, andbuffer_store_byte/shortwith their_d16_hiforms. These are the byte-address-buffer accesses compiled HLSL uses for sub-dword data. This is the MUBUF counterpart of #1666 (global).Semantics (RDNA2 ISA, MUBUF):
buffer_load_{u,s}byteand{u,s}shortzero- or sign-extend to 32 bits._d16loads write one 16-bit half ofvdata(_hiwrites the high one; a byte is zero- or sign-extended to 16 bits) and keep the other half.buffer_store_byte/shortwrite the low 8/16 bits ofvdata;_d16_hiwrites its high half.Implementation:
Gen.buffer_sub.buffer_address's, including swizzle.buffer_address(elem="fmt")with format 1 or 7, as for a typed element of that size. A byte load at the last byte ofnum_recordsis in range; a short there is not.stepbytes on, selected at run time.read_before_write_vgprscounts a d16 load'svdataas read.Tests:
tests/semantic/test_buffer_sub_dword.py, compute shaders inspirv_mini_interpwith a raw (OOB_SELECT 3) V#:num_recordsedgeWithout the change the file fails (119 errors, 1 failure); with it, 6/6 pass.
python -I -m unittest discover -s tests/semantic: 1573 tests OK (2 skipped). That includes #1720's merge-order check on every module.docs/design.md: new row after "Buffer bounds checking".Tested on CPU only (semantic interpreter); no GPU run. No game files.
AI-assisted (Claude Code): I reviewed and ran the change and the tests.