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

Merged
stan495 merged 4 commits from upstream-pr/948 into main 2026-11-24 02:04:27 +00:00
stan495 commented 2026-11-23 18:17:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-23T18:17:28Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6565902693 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/948). Originally posted by [stan495](https://github.com/stan495) on 2026-11-23T18:17:28Z. --- ## 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.
upstream-sync closed this pull request 2026-11-24 06:45:32 +00:00
lambirou commented 2026-11-24 06:50:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T01:36:13Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119265078 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/948#issuecomment-7119265078). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-24T01:36:13Z. --- 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.
stan495 commented 2026-11-24 06:50:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T01:49:40Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119483763 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/948#issuecomment-7119483763). Originally posted by [stan495](https://github.com/stan495) on 2026-11-24T01:49:40Z. --- 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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!941
No description provided.