shader: lower global_load_*_d16 in native compute #3783
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3783"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by R0D4X on 2026-12-01T21:43:40Z.
Refs #3224, #2935
Summary
Lowers the six GFX10 D16 sub-DWORD GLOBAL load instructions (
global_load_{ubyte,sbyte,short}_d16{,_hi}, opcodes0x20..0x25) in the direct C++ compute frontend (src/gfx1013_compute_native.cpp,src/gfx1013_direct_compute.inl), reusingglobal_subdword_loadfor alignment, cross-DWORD halfword extraction, and 32-bit wrap guards while preserving the untouched 16-bit half ofv_dst.Changes
src/gfx1013_compute_native.cpp:0x20..0x25alongside0x08..0x0binsubdword_loaddecoding.s.clear_spills(256 + i.dst)) for allglobal_load_*sub-DWORD and D16 variants.src/gfx1013_direct_compute.inl:global_subdword_loadto supportd16(low half) andd16_hi(high half): readold_dstbeforevector_write, apply the 32-bit wrap guard to the loaded value (so a wrapped lane zeroes only the target 16-bit half), mask to 16 bits, and merge into the low or high half ofold_dst.tests/native_global_subdword_d16_load_check.py,tests/cmake/native_global_subdword_d16_load.cmake, andtests/checks/python-linux/native-global-subdword-d16-load.txt:encodingscheck verifying exact RDNA 2 disassembly of all 6 opcodes and reference-model wrap/sign-extension invariants (registered in Linux CI).native_global_subdword_d16_load_hardware): 28 cases per lane across 64 lanes (1,792 32-bit outputs) covering all 6 opcodes, non-zero untouched half preservation, sign-extension on negative bytes (0x80,0xaa,0xff), cross-DWORD halfwords (addr & 3 == 3), 32-bit wrap guards, chained low+high loads into one VGPR, self-aliasing (v_dst == v_addr), and both root SRV and root UAV bases.tests/native_global_subdword_load_check.py:global_load_ubyte_d16(0x20) andglobal_load_short_d16(0x24) from the unsupported-opcode refusal list while keeping byte/short stores (0x18,0x1a), atomics (0x32), and all other refusal controls intact.Verification
c59fddae(based onmain158ef794)10.0.26300.9974), MSVC19.44.35230, Windows SDK / DXC10.0.26100.0, NVIDIA GeForce RTX 5080 (10de:2c02, driver32.0.16.2140).Commands and results
dev(Debug): 4/4 Passed (native_global_subdword_d16_load_encodings,native_global_subdword_d16_load_hardware0.48 s,native_global_subdword_load_encodings,native_global_subdword_load_hardware1.19 s).release(/O2): 4/4 Passed (native_global_subdword_d16_load_encodings,native_global_subdword_d16_load_hardware0.56 s,native_global_subdword_load_encodings,native_global_subdword_load_hardware1.19 s).Fail-first / mutation control
Mutating the preserved-high-half mask (
4294901760->0) insrc/gfx1013_direct_compute.inland rebuildingcompile_dxil+native_store_replayfailsnative_global_subdword_d16_load_hardware(exit 8) with readback mismatches ([(2072, '0x0', '0xabcd0000'), (2073, '0xaa', '0xaafa00aa'), ...]).Pure-Python checks
Scope note
This verifies source-built gfx1013 compute fixtures through
compile_dxilandnative_store_replay --directon the RTX 5080; it does not establish full-title startup or frame rate.AI-assisted.