shader: return old values from private LDS word updates #878

Merged
stan495 merged 1 commit from upstream-pr/885 into main 2026-11-23 16:11:33 +00:00
stan495 commented 2026-11-23 15:49:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-23T15:49:23Z.


Scope

Lower ds_add_rtn_u32, ds_sub_rtn_u32, ds_and_rtn_b32, ds_or_rtn_b32 and ds_xor_rtn_b32 using the private-word update model introduced in #878. Each instruction captures the original operands, returns the old LDS word in the destination VGPR, and updates the private word. The existing checks require zero offset, initialization, a verified private address, full EXEC, and an immediate s_waitcnt lgkmcnt(0).

Verification

Tested daf87ee on Windows 11 25H2 (10.0.26200.9974) with the D3D12 debug layer enabled. Hardware used an AMD Radeon RX 7900 XTX (driver 32.0.32029.2010). WARP used the 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_private|ds_route|guard_read)_(warp|hardware)$|^compute_store_aot_warp$' -V

7 passed, 0 failed, 0 skipped. The five synthetic kernels each issue two returning updates. The first destination aliases the data VGPR and the second aliases the address VGPR. Both backends matched the CPU reference across the full UAV for one and three groups. Passing LDS dispatches reported zero debug errors and warnings. All five mutants returning the updated value differed at word 0. All five mutants preserving the return value but dropping the second update differed at word 2. For addition, the first mutant produced 40000011 instead of fffffff0, and the second produced 40000011 instead of c0000014.

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

Passed with LLVM 15.0.7 on WSL Ubuntu 24.04. The gfx1030 Wave32 binaries decoded to the expected DS forms and produced the same HLSL as source assembly through both the direct and CLI paths. The coverage records include all five new forms.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6563102351 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/885). Originally posted by [stan495](https://github.com/stan495) on 2026-11-23T15:49:23Z. --- ## Scope Lower `ds_add_rtn_u32`, `ds_sub_rtn_u32`, `ds_and_rtn_b32`, `ds_or_rtn_b32` and `ds_xor_rtn_b32` using the private-word update model introduced in #878. Each instruction captures the original operands, returns the old LDS word in the destination VGPR, and updates the private word. The existing checks require zero offset, initialization, a verified private address, full EXEC, and an immediate `s_waitcnt lgkmcnt(0)`. ## Verification Tested `daf87ee` on Windows 11 25H2 (10.0.26200.9974) with the D3D12 debug layer enabled. Hardware used an AMD Radeon RX 7900 XTX (driver 32.0.32029.2010). WARP used the 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_private|ds_route|guard_read)_(warp|hardware)$|^compute_store_aot_warp$' -V ``` 7 passed, 0 failed, 0 skipped. The five synthetic kernels each issue two returning updates. The first destination aliases the data VGPR and the second aliases the address VGPR. Both backends matched the CPU reference across the full UAV for one and three groups. Passing LDS dispatches reported zero debug errors and warnings. All five mutants returning the updated value differed at word 0. All five mutants preserving the return value but dropping the second update differed at word 2. For addition, the first mutant produced `40000011` instead of `fffffff0`, and the second produced `40000011` instead of `c0000014`. ```sh python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ``` Passed with LLVM 15.0.7 on WSL Ubuntu 24.04. The gfx1030 Wave32 binaries decoded to the expected DS forms and produced the same HLSL as source assembly through both the direct and CLI paths. The coverage records include all five new forms.
upstream-sync closed this pull request 2026-11-24 06:45:14 +00:00
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!878
No description provided.