tombox-xshader: decode and translate the FLAT/GLOBAL D16 sub-dword loads #249
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!249
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/249/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@azerioxfr on GitHub · 2026-11-23 07:22 UTC · original
azerioxfr:xshader-flat-global-d16-loads→main· +64 −4 · 3 files · 1 commits · closed without mergingLibrary / area: tombox-xshader, FLAT / GLOBAL sub-dword loads (
hlsl/global.rs)Exports changed (exports.txt rows): none
Source of the behaviour: opcodes from
tests/isa_table/gfx1013.txt(FLAT / GLOBAL 0x20..0x25). Semantics from the RDNA2 ISA descriptions, lowered like the LDS D16 reads (28f54b2) and the MUBUF D16 loads (#235).One topic, +64 / -4: 6 lines in
rdna2/mnem.rs, 18 inhlsl/global.rs, 44 lines of test.What was missing
tests/isa_table.rslistsflat_load_{ubyte,sbyte,short}_d16{,_hi}and the matchingglobal_forms under "gfx1013 opcodes not named by the decoder" (global decodes asflat_with a segment).The change
*_load_ubyte_d16/*_load_sbyte_d16(0x20 / 0x22)*_load_ubyte_d16_hi/*_load_sbyte_d16_hi(0x21 / 0x23)*_load_short_d16/_hi(0x24 / 0x25)These go through the existing
width()/global_load_exprpath, so window bounds and faults behave as forflat_load_ubyte. The loads read vdst for the kept half. The scratch segment is unchanged: the translator still refuses scratch access.Tests
New
exec_mem::global::flat_global_d16_loads: 6 mnemonics × 5 address modes, vdst preloaded with0x5a5aa5a5.--release, DXC 1.9.2609)flat_global_d16_loadsflat_global_mem(regression)exec_mem::globaltests--test isa_table/--test opcodesRun on
x86_64-pc-windows-gnu(no MSVC linker here). Integer only.cargo test -p tombox-xshader --test exec -- exec_mem::globalpassesmissingwith a note@omonkeyz on GitHub · 2026-11-23 14:08 UTC · original
Applied locally on main with your authorship kept (cherry-picked,
3b3028b); the tombox-xshader suite passes in a sandbox (exec 155/155 on WARP). It ships in the next release; this PR will be closed when that is pushed. Thanks.@omonkeyz on GitHub · 2026-11-25 13:07 UTC · original
Applied on main in
3b3028b(cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.@SchmashinPrunes on GitHub · 2026-11-24 14:34 UTC · original · approved these changes
I checked this on RDNA2 silicon: a gfx1036 iGPU (Ryzen 5 9600X), ROCm/HIP 5.7.1, raw wave32 kernels, so RDNA2, not gfx1013. Each kernel ran twice with identical results, and I compared against the semantics this PR implements (my own port; I didn't run the PR's code).
All six global forms match on 2,048 cases each:
global_load_ubyte_d16,_ubyte_d16_hi,_sbyte_d16,_sbyte_d16_hi,_short_d16and_short_d16_hi. The cases used random memory, every byte offset 0..3 (0 and 2 for the shorts) and random preloaded vdst values._hi.I checked the
global_encodings, notflat_.(Measured with an AI assistant, Claude.)
Pull request closed