Repository navigation
Conversation
… the next swizzled dword (measured, gfx1036) buffer_sub (the d16 loads and the 8/16-bit stores) asked buffer_address for a typed element (elem="fmt", format 1 or 7). That gives the same 1/2-byte bounds check as elem=nbytes, but a typed element gets no scratch-swizzle step, so a buffer_store_short at byte 3 wrote its high byte to the linear next dword, the next lane's. Measured natively on gfx1036 (RDNA2), wave32 and wave64, with @iLucasRT's tools/buffer_swizzle_probe.py cases: the store's high byte lands in the next swizzled dword (+4*IS), as buffer_load_ushort's does, and a local buffer_load_short_d16 case reads it from there too. buffer_sub now passes elem=nbytes, so it gets the step. tests/semantic/test_buffer_sub_dword.py: the measured case on the CPU (lane 5, IS 16) for buffer_store_short, buffer_store_short_d16_hi, buffer_load_ushort and buffer_load_short_d16. docs/design.md row updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
devnull34
left a comment
There was a problem hiding this comment.
Verified: passes all semantic and rdna2spirv CLI tests. Passing elem=nbytes in buffer_sub ensures raw buffer addressing returns the scratch swizzle step so 16-bit stores at byte 3 properly write the high byte into the next swizzled dword rather than linear adjacent lane memory.
|
Tested
AI-assisted (Claude Code). |
|
Tested 1041c6b merged onto main 3d21852 on an RTX 5090 (driver 621.24), Windows 11, Vulkan SDK 1.4.363. The GPU test programs were built from the same tree:
AI-assisted (Claude Code). |
|
Tested 1041c6b on Radeon 610M (gfx1036, RDNA2), AMD 26.11.2, Windows 11 26200: match. This is an independent native measurement on a second gfx1036, through the Windows driver path of The probe is
The two crossing cases on hardware, the same in wave32 and wave64:
One difference from your DRM run: here Semantic tests on this PR: Synthetic values only, no game files. AI-assisted (Claude Code). |
Claim: #7049 comment, the hardware side of @iLucasRT's scratch-swizzle finding. Their probe cases are their own claim and branch (
iLucasRT:buffer-sub16-swizzle-probe). This PR doesn't include them, so it doesn't conflict with their PR.What and why
In scratch swizzle (
SWIZZLE_ENABLE=1,idxen=0,ADD_TID_ENABLE=1), a 16-bit MUBUF access at byte 3 of a lane's dword reaches one byte of the next dword. The translator took two different views of which dword that is:buffer_load_sub(the plainbuffer_load_ushort/sshort) took it from the next swizzled dword (+4×IS).buffer_sub(the d16 loads and the 8/16-bit stores, rdna2spirv: 8/16-bit MUBUF loads and stores (buffer_load_ubyte/ushort/d16, buffer_store_byte/short) #1864) used the linear next dword (+4), which belongs to the next lane.Cause:
buffer_subaskedbuffer_addressfor a typed element (elem="fmt", format 1 or 7). For 1 or 2 bytes that gives the same bounds check aselem=nbytes. But a typed element never gets the scratch-swizzlestep, so the second byte stepped linearly.buffer_sub's own docstring already said "in a swizzled buffer the next dword isstepbytes on". It now passeselem=nbytes.Measured (gfx1036, RDNA2)
tools/buffer_swizzle_probe.py --oracle bothfrom @iLucasRT's branch, run throughtools/hw_oracle(DRM backend) on the Raphael iGPU (1002:13c0, gfx1036, compute engine 10.0), wave32 and wave64:buffer_load_ushort(IS 8, lane 2)buffer_store_short(IS 16, lane 5)0x54);0x18untouched0x18✗buffer_load_short_d16(a local case, same shape as the ushort one; not pushed)0xabcd285e: +4×IS, high half kept0xabcd0c5elinear ✗Every probe group with the fix: 22 of 24 match, no wave32/64 difference. The two cases left are
typed_and_atomic_x2/scratch_swz_fmt16_suppressedandscratch_swz_mtbuf_atomic_x2_and_4b_ctrl. They mismatch the same way on main, so this PR doesn't touch them. In the second, even the 4-byte typed control reads back the output fill (0xdead0000) on hardware, so the case may not be storing at all. That looks like a probe question rather than a translator one; I'll post it as a finding.Tested
Linux, Python 3.14.10,
main8575d36ed.tests/semantic/test_buffer_sub_dword.py: newScratchSwizzleCrossing, the measured case on the CPU forbuffer_store_short,buffer_store_short_d16_hi,buffer_load_ushortandbuffer_load_short_d16. 8 tests, OK.Negative control: with main's translator, 3 of those subtests fail: both stores and the d16 load.
Full
tests/semantic(5891 tests): the same two failures as main and nothing else. Those aretest_image_atomics_guardandtest_image_store_d16, already reported red on main by @dadsmallbuk1.docs/design.md: the contract row now names the measurement.test_docs_design_rowspasses.test_docs_linksfails on main and here alike (thedev-tools.mdanchor, @Unix-Epoch's finding).No game data in this PR.
The changed rule's row in the
docs/design.mdcontract table says how it was confirmed (a native gfx1036 measurement).AI-assisted (Claude Code).
🤖 Generated with Claude Code