shader: lower private LDS qword counters and conditional exchange #948

Manually merged
github merged 4 commits from gh-pr/948/head into gh-pr/948/base 2026-11-26 22:30:26 +00:00
Owner

@⁠stan495 on GitHub · 2026-11-23 18:17 UTC · original
stan495:codex/gfx1030-ds-inc-u64 → main · +76 −4 · 3 files · 4 commits · merged 2026-11-24 02:04 UTC

Scope

Lower unsigned qword increment and decrement with and without returning the original pair, plus conditional exchange gated independently by bit 31 of each source dword.

Depends on #942. Review this batch with git diff 9926b9f6 8b477a4c.

Verification

Tested 8b477a4c on Windows 11 25H2 (10.0.26200.9974) with the D3D12 debug layer enabled. Hardware used AMD Radeon RX 7900 XTX (32.0.32029.2010). WARP used Microsoft Basic Render Driver (10.0.26100.9818).

cmake --build --preset dev --target offscreen_check
$env:XBOX2WINDOWS_ADAPTER = '7900 XTX'
ctest --preset dev --no-tests=error -R '^compute_store_aot_(lds_qword|lds_private|ds_route|guard_read)_(warp|hardware)$|^compute_store_aot_warp$' -V

9 passed, 0 failed, 0 skipped. Both backends compared all 320 UAV words. Omitting a counter update changed word 0. Forcing the conditional high-dword store changed word 1, where the source sign bit was clear.

python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1

LLVM 15.0.7 round trips reproduced the same HLSL as text translation. Coverage records include all five new forms.

**@⁠stan495** on GitHub · 2026-11-23 18:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/948) `stan495:codex/gfx1030-ds-inc-u64` → `main` · +76 −4 · 3 files · 4 commits · merged 2026-11-24 02:04 UTC ## Scope Lower unsigned qword increment and decrement with and without returning the original pair, plus conditional exchange gated independently by bit 31 of each source dword. Depends on #942. Review this batch with `git diff 9926b9f6 8b477a4c`. ## Verification Tested `8b477a4c` on Windows 11 25H2 (10.0.26200.9974) with the D3D12 debug layer enabled. Hardware used AMD Radeon RX 7900 XTX (32.0.32029.2010). WARP used Microsoft Basic Render Driver (10.0.26100.9818). ```powershell cmake --build --preset dev --target offscreen_check $env:XBOX2WINDOWS_ADAPTER = '7900 XTX' ctest --preset dev --no-tests=error -R '^compute_store_aot_(lds_qword|lds_private|ds_route|guard_read)_(warp|hardware)$|^compute_store_aot_warp$' -V ``` 9 passed, 0 failed, 0 skipped. Both backends compared all 320 UAV words. Omitting a counter update changed word 0. Forcing the conditional high-dword store changed word 1, where the source sign bit was clear. ```sh python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ``` LLVM 15.0.7 round trips reproduced the same HLSL as text translation. Coverage records include all five new forms.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:30:25 +00:00
github manually merged commit b63a8aa553 into gh-pr/948/base 2026-11-26 22:30:26 +00:00
Author
Owner

@⁠lambirou on GitHub · 2026-11-24 01:36 UTC · original

Coordination from #1120 per the maintainer: our branch independently implements the four qword inc/dec forms and will stay open while #948 CI runs. Independent RX 9060 XT evidence: WARP and hardware 320 words per case, 0 mismatches, mutants for >= vs >, signed high-word compare, missing old==0 clamp and old-pair return. One case our fixture does not yet exercise is a strictly-below-limit decrement with a zero low word (borrow into the low dword); I can keep that as a focused test contribution if #948 does not cover it. No code or table copied.

**@⁠lambirou** on GitHub · 2026-11-24 01:36 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/948#issuecomment-7119265078) Coordination from #1120 per the maintainer: our branch independently implements the four qword inc/dec forms and will stay open while #948 CI runs. Independent RX 9060 XT evidence: WARP and hardware 320 words per case, 0 mismatches, mutants for >= vs >, signed high-word compare, missing old==0 clamp and old-pair return. One case our fixture does not yet exercise is a strictly-below-limit decrement with a zero low word (borrow into the low dword); I can keep that as a focused test contribution if #948 does not cover it. No code or table copied.
Author
Owner

@⁠stan495 on GitHub · 2026-11-24 01:49 UTC · original

Thanks @⁠lambirou for the independent RX 9060 XT results and for adding the borrow check in #1120. The #948 fixture already exercises a below-limit decrement with a zero low dword in both ds_dec_u64 and ds_dec_rtn_u64. In the second workgroup, 0x00000001_00000000 is below the limit 0x00000001_00000008 and decrements to 0x00000000_ffffffff. The returning form also checks the original pair.

I reran the qword test on WARP at 30504257 and saw the mutant flag the wrong high dword. If #948 lands, would you be up for adding that targeted negative control to the existing fixture in a small follow-up PR? That would let us check for a missing high-word borrow directly.

**@⁠stan495** on GitHub · 2026-11-24 01:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/948#issuecomment-7119483763) Thanks @⁠lambirou for the independent RX 9060 XT results and for adding the borrow check in #1120. The #948 fixture already exercises a below-limit decrement with a zero low dword in both `ds_dec_u64` and `ds_dec_rtn_u64`. In the second workgroup, `0x00000001_00000000` is below the limit `0x00000001_00000008` and decrements to `0x00000000_ffffffff`. The returning form also checks the original pair. I reran the qword test on WARP at `30504257` and saw the mutant flag the wrong high dword. If #948 lands, would you be up for adding that targeted negative control to the existing fixture in a small follow-up PR? That would let us check for a missing high-word borrow directly.
This discussion has been locked. Commenting is limited to contributors.
No description provided.