Repository navigation
Conversation
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.
@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.
@tylerstraub ran the new fixture on an NVIDIA RTX 5090 (595.99.02, Linux): all eight words. The row named llvmpipe only.
@YaBulochka on ItsNotRexed#1864: cs_w32_buffer_sub16 has the _d16_hi stores but not the plain buffer_store_byte / buffer_store_short, and docs/embedded_shaders.md names plain buffer_store_short as Box16Rehydration's blocker. Lane 0 seeds six dwords, stores bytes and shorts into them (one short at byte 3, whose high byte lands in the next dword; a byte and a short whose data has high bits set) and reads them back, also through buffer_load_ubyte / buffer_load_sshort. Passes on llvmpipe with LLVM 21 and 23; main's translator can't translate it. CPU test tests/semantic/test_buffer_store_sub_fixture.py; docs/design.md row updated.
…e base pointer (Apple M4) @sovljanskii on ItsNotRexed#1864: on an Apple M4 (MoltenVK 1.4.2) cs_w32_buffer_store_sub read 0 for every buffer_load_{u,s}short at byte 2 or 3 of a dword. The 16-bit path loaded its second dword through a second OpConvertUToPtr of the same host address (a run-time V#), which Apple's compiler mishandles; indexing the same PSB array by idx1 * index_stride (step = 4 * index_stride) reads right and keeps the scratch-swizzle layout. Patch by @sovljanskii, tested by them on the M4 (154/219, the only change cs_w32_buffer_store_sub FAIL -> PASS). Here: buffer semantic tests and swizzle suites OK, llvmpipe 147/219 0 failed, full semantic suite only main's known failures.
# Conflicts: # runtime/test/shaders/check.py # scripts/run_gpu_tests.py # tests/semantic/regen_fixtures.py
# Conflicts: # runtime/test/shaders/check.py # scripts/run_gpu_tests.py # tests/semantic/regen_fixtures.py
…atch swizzle Depends on: ItsNotRexed#1864 (buffer_store_short). A buffer_load_ushort or buffer_store_short at byte 3 of a dword also reaches one byte of the next dword. In scratch swizzle (SWIZZLE_ENABLE=1, ADD_TID_ENABLE=1, idxen=0) the translator now answers that two ways: - buffer_load_sub (main) takes the second byte from the next swizzled dword, +4*IS bytes on, as multi-dword raw accesses step (measured on gfx1036, SHADER-343); - buffer_store_short (ItsNotRexed#1864) writes it to the linear next dword, +4 bytes on, which in that mode belongs to the next lane. Neither has been measured natively. Two cases in the multi_dword_stepping group answer both on an RDNA2 GPU with `python -I tools/buffer_swizzle_probe.py --oracle both --group multi_dword_stepping`: - scratch_swz_load_ushort_cross (IS=8, lane 2): 0x285e if the second byte steps +4*IS, 0x0c5e if linear; - scratch_swz_store_short_cross (IS=16, lane 5, stride 16 so both dwords are in range): the high byte lands in dword 0x54 (+4*IS) or 0x18 (linear). Translator side today (CPU, wave32 and wave64 alike): the load gives 0x285e and the store writes 0x18. So at most one of the two can match the hardware. Tested: the probe's translator mode (24 cases, all run), --self-test and tests/test_buffer_swizzle_probe.py pass. Not run on hardware: this machine has only an RDNA3 GPU (RX 7900 XTX), whose V# swizzle fields differ from RDNA2's. No game files. AI-assisted (Claude). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ItsNotRexed#1864 is on main now, so this branch carries only the two probe cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Checked 5bfd5d7 merged onto
AI-assisted (Claude Code). |
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: BUILD-2570 (finding: #7049 (comment))
What and why
A buffer_load_ushort or buffer_store_short at byte 3 of a dword also reaches one byte of the next dword. In scratch
swizzle (SWIZZLE_ENABLE=1, ADD_TID_ENABLE=1, idxen=0) the translator now answers that two ways:
accesses step (measured on gfx1036, SHADER-343);
lane.
Neither has been measured natively. Two cases in the multi_dword_stepping group answer both on an RDNA2 GPU with
python -I tools/buffer_swizzle_probe.py --oracle both --group multi_dword_stepping:dword 0x54 (+4*IS) or 0x18 (linear).
Translator side today (CPU, wave32 and wave64 alike): the load gives 0x285e and the store writes 0x18. So at most
one of the two can match the hardware.
Tested
Tested: the probe's translator mode (24 cases, all run), --self-test and tests/test_buffer_swizzle_probe.py pass.
Not run on hardware: this machine has only an RDNA3 GPU (RX 7900 XTX), whose V# swizzle fields differ from RDNA2's.
No game files.
The branch is merged with main 0c46fa1, where #1864 (buffer_store_short) has landed. Measuring it and fixing the
translator is claimed separately as SHADER-1137.
AI-assisted: yes (Claude)
Checklist
docs/design.md, with how it was confirmed. (No new translator rule in this PR.)