shader: lower ds_write_*_d16_hi and ds_read_{u8,i8}_d16* in native compute #3786
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3786
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3784"
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?
@R0D4X on GitHub · 2026-12-01 21:52 UTC · original
R0D4X:shader/native-lds-d16-subdword→main· +68 −23 · 5 files · 3 commits · merged 2026-12-03 15:03 UTCRefs #3226, #2935
Summary
Completes the GFX10 D16 sub-DWORD LDS family alongside
ds_read_u16_d16/ds_read_u16_d16_hi(0xa6,0xa7) ingfx1013_compute_irand the direct C++ compute frontend:0xa0(ds_write_b8_d16_hi): writes(v[data0] >> 16) & 0xffto LDS byte address.0xa1(ds_write_b16_d16_hi): writes(v[data0] >> 16) & 0xffffto even LDS halfword address (skipping odd effective addresses, matchingds_write_b16).0xa2(ds_read_u8_d16) /0xa3(ds_read_u8_d16_hi): zero-extends 1 LDS byte to 16 bits into the low/high half ofv[dst], preserving the untouched 16-bit half.0xa4(ds_read_i8_d16) /0xa5(ds_read_i8_d16_hi): sign-extends 1 LDS byte to 16 bits into the low/high half ofv[dst], preserving the untouched 16-bit half.Changes
src/gfx1013_compute_ir.handsrc/gfx1013_compute_ir.cpp:bool store_d16_hitoLocalDataAccessand decode0xa0..0xa5indecode_local_data.v[data0]right by 16 bits inlower_ldswhenstore_d16_hiis set; mask signedfieldto 16 bits and clear the full 16-bit destination half (~(0xffffu << bit)) whenread_d16is set.src/gfx1013_direct_compute.inl:0xa6/0xa7DXIL bit-for-bit unchanged).tests/native_lds_subword_read_check.py:0xa2..0xa5alongside0xa6,0xa7,0x39..0x3c; update the unsupported-opcode refusal control from0xa2(162) to0xa8(168).0xa2,0xa3,0xa4,0xa5(including sign-extension of0xb3->0xffb3with preserved high/low halves),0xa0(ds_write_b8_d16_hi),0xa1(ds_write_b16_d16_hi), and the odd-offset skip control for0xa1.Verification
f4882407(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), Microsoft Basic Render Driver (10.0.26100.9818), D3D12 debug layer enabled (debug_errors=0 debug_warnings=0).Commands and results
dev(Debug): 92/92 Passed (89/89 gfx1013_compute_ir_*unit + mutation tests PASS;native_lds_subword_read_controlsPASS;native_lds_subword_read_hardwarePASS in 3.92 s on RTX 5080, all 10 cases × 336 texture words matched;native_lds_subword_read_warpSkipped (77) —shader wave32 fixture requires SM 6.6, WaveOps, and a 32-lane wave).release(/O2):gfx1013_compute_ir_all(83/83) Passed,native_lds_subword_read_controlsPassed,native_lds_subword_read_hardwarePassed (3.72 s on RTX 5080),native_lds_subword_read_warpSkipped (77).Fail-first / mutation control
Disabling
if (op.store_d16_hi)insrc/gfx1013_direct_compute.inland rebuildingcompile_dxilfailsnative_lds_subword_read_hardware(exit 8) on the0xa0case (expected=654300a2 actual=654300c0).Pure-Python checks
Scope note
This verifies source-built gfx1013 LDS subword compute fixtures through
compile_dxilandoffscreen_checkon the RTX 5080 and WARP; it does not establish full-title startup or frame rate.AI-assisted.
@R0Y00 on GitHub · 2026-12-02 01:55 UTC · original
The reviewed head passed Windows and Linux CI, but GitHub reports a merge conflict against current main. Please rebase and retain the
LocalDataAccessdefault initializers from #3796 when addingstore_d16_hi. Please rerun the subword LDS controls on the new head.@R0Y00 on GitHub · 2026-12-03 01:08 UTC · original · reviewed
Independently tested
c49f0cdewith MSVC Debug, Windows 11 build 26300. ctest --preset dev --no-tests=error -j 1 -V -R "^(native_lds_subword_(read|store)_(controls|warp|hardware)|gfx1013_compute_ir_all)$": 5 passed, 2 capability skips, 0 failures. RTX 4060 Laptop (616.56) matched 4,704 texture words across the read and store fixture cases. WARP reported skip 77 for both wave32 draws, with the debug layer enabled. Git still reports a single conflict in gfx1013_compute_ir.h; please retain the existing default initializers and rerun this selection after resolving it.@R0Y00 on GitHub · 2026-12-03 07:15 UTC · original
I tested
c49f0cdeagainstmain29bb2aed, keeping the initializedLocalDataAccessfields and addingbool store_d16_hi = false. MSVC Debug built both targets. The RTX 4060 Laptop read and store fixtures passed, and both WARP fixtures reported capability skip 77. The two compiler controls failed for the same reason:0xa8is rejected by the instruction decoder (unknown gfx1013 opcode 168) before reaching the LDS lowering assertion. I verified a replacement control on the trial tree: use recognized0x22and expectunsupported local DS opcode 34, passingdata0=1in the read fixture and retaining the store fixture’s existing data operand. Both compiler controls then passed. Please keep that negative-control coverage when rebasing.c49f0cdebdto1e0604e5a6@R0D4X on GitHub · 2026-12-03 14:07 UTC · original
Rebased onto
upstream/main(e7277aa4) at1e0604e5:src/gfx1013_compute_ir.hretaining allLocalDataAccessdefault initializers and addingbool store_d16_hi = false;.tests/native_lds_subword_read_check.py(0x22,{'data0': 1}) andtests/native_lds_subword_store_check.py(0x22,{}) to expectunsupported local DS opcode 34.Verification (
1e0604e5)10.0.26300.9974), MSVC19.44.35230(Debug), Windows SDK / DXC10.0.26100.0, NVIDIA GeForce RTX 5080 (10de:2c02, driver32.0.16.2140), Microsoft Basic Render Driver (10.0.26100.9818), D3D12 debug layer enabled.ctest --preset dev --no-tests=error -j 1 -V -R '^(native_lds_subword_(read|store)_(controls|warp|hardware)|gfx1013_compute_ir_all)$': 5 passed, 2 skipped (77), 0 failed (gfx1013_compute_ir_all,native_lds_subword_read_controls,native_lds_subword_read_hardware,native_lds_subword_store_controls,native_lds_subword_store_hardwarepassed;native_lds_subword_read_warpandnative_lds_subword_store_warpskipped 77 on WARP for lacking 32-lane waves).@R0Y00 on GitHub · 2026-12-03 14:24 UTC · original · requested changes
Independent MSVC Debug run on
1e0604e5, Windows 11 build 26300:ctest --preset dev --no-tests=error -j 1 -V -R '^(native_lds_subword_(read|store)_(controls|warp|hardware)|gfx1013_compute_ir_all)$'yielded 5 passes and 2 wave32 capability skips on inbox WARP 10.0.26100.9818. RTX 4060 Laptop 32.0.16.1656 passed. The revised 0x22 diagnostics are now covered.The committed store fixture still only runs 0x1e and 0x1f. I temporarily disabled the high-half right shift in the direct lowering and the committed hardware test still passed. Please add coverage for 0xa0 and 0xa1 using different low/high halves, including an odd-address refusal/no-write case for 0xa1. In a local extension of the existing oracle I added 0xa0 at offset 4 and 0xa1 at offsets 4 and 5 and compared the source shifted right by 16. The unmodified compiler matched all 336 words in each new case on RTX. This pins the new behavior with the existing source-built fixture.
@R0D4X on GitHub · 2026-12-03 14:39 UTC · original
Added
0xa0(ds_write_b8_d16_hi) and0xa1(ds_write_b16_d16_hi) coverage totests/native_lds_subword_store_check.pyinfb75dc98:(0xa0, 4, 255, True),(0xa1, 4, 65535, True), and(0xa1, 5, 65535, True)(odd-address no-write control) toCASESusingDATA = 0x91a2b3c0(distinct low/high halves).lshr i32 ..., 16shift incheck_shape()(controls) and compared against((DATA | lane) >> 16)inhardware().if (op.store_d16_hi)right-shift insrc/gfx1013_direct_compute.inlfails bothnative_lds_subword_store_controlsandnative_lds_subword_store_hardware.Verification (
fb75dc98)10.0.26300.9974), MSVC19.44.35230(Debug), Windows SDK / DXC10.0.26100.0, NVIDIA GeForce RTX 5080 (10de:2c02, driver32.0.16.2140), Microsoft Basic Render Driver (10.0.26100.9818), D3D12 debug layer enabled.ctest --preset dev --no-tests=error -j 1 -V -R '^(native_lds_subword_(read|store)_(controls|warp|hardware)|gfx1013_compute_ir_all)$': 5 passed, 2 skipped (77), 0 failed (RTX 5080 matched all 336 texture words on0x1e,0x1foffsets 4/5,0xa0offset 4,0xa1offsets 4/5, and contended0x1e; WARP skipped 77 for lacking 32-lane waves).@R0Y00 on GitHub · 2026-12-03 15:03 UTC · original · approved these changes
Re-reviewed
fb75dc98. The C++ register defaults are retained and the store fixture now includes 0xa0/0xa1, deliberately different high and low halves, and the odd halfword offset. Windows 11 build 26300, MSVC Debug:ctest --preset dev --no-tests=error -j 1 -V -R '^(native_lds_subword_(read|store)_(controls|warp|hardware)|gfx1013_compute_ir_all)$'reported 5 passes and 2 four-lane WARP capability skips (10.0.26100.9818). RTX 4060 Laptop 32.0.16.1656 matched 336 texture words in each of the three new cases. Temporarily disabling the high-half shift now fails the lshr 16 IR assertion. Restoring the compiler passes again. This resolves my coverage request.