shader: lower private LDS subword accesses in compute #859

Merged
stan495 merged 1 commit from upstream-pr/865 into main 2026-11-23 14:53:56 +00:00
stan495 commented 2026-11-23 14:41:23 +00:00 (Migrated from github.com)

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


Scope

Extend the thread-private gfx1030 LDS word added in #857 with ds_write_b8, ds_write_b16, ds_read_u8, ds_read_i8 and ds_read_i16. Partial stores capture the low source bits and preserve the rest of the initialized word. Byte offsets are 0–3 and halfword offsets are 0 or 2. The existing 32×1×1 group, verified local_x << 2 address, full EXEC, explicit allocation and immediate s_waitcnt lgkmcnt(0) checks apply.

Verification

Tested commit 0c609b6 on Windows 11 25H2 (10.0.26200.9974), with the D3D12 debug layer enabled. The hardware run used AMD Radeon RX 7900 XTX (driver 32.0.32029.2010) and the WARP run used Microsoft Basic Render Driver (10.0.26100.9818). No debug errors or warnings in the passing LDS dispatches.

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. On each backend the six subword variants compare the complete 320-word UAV for one-group and three-group dispatches. All six full-write mutants mismatch at word 0 (for example, 42abcd70 expected and 12340070 observed), and all six zero-extension mutants mismatch at word 50 (byte ffffff80 vs 00000080, halfword ffff8000 vs 00008000). The form-coverage records include all five added forms.

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

Passed with LLVM 15.0.7 in WSL Ubuntu 24.04. Each new case preserves the DS instruction spellings, and decoded and CLI translation reproduce the HLSL from the source assembly. The D3D12 readbacks measure the translated shader against the CPU reference.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6561779791 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/865). Originally posted by [stan495](https://github.com/stan495) on 2026-11-23T14:41:23Z. --- ## Scope Extend the thread-private gfx1030 LDS word added in #857 with `ds_write_b8`, `ds_write_b16`, `ds_read_u8`, `ds_read_i8` and `ds_read_i16`. Partial stores capture the low source bits and preserve the rest of the initialized word. Byte offsets are 0–3 and halfword offsets are 0 or 2. The existing 32×1×1 group, verified `local_x << 2` address, full EXEC, explicit allocation and immediate `s_waitcnt lgkmcnt(0)` checks apply. ## Verification Tested commit `0c609b6` on Windows 11 25H2 (10.0.26200.9974), with the D3D12 debug layer enabled. The hardware run used AMD Radeon RX 7900 XTX (driver 32.0.32029.2010) and the WARP run used Microsoft Basic Render Driver (10.0.26100.9818). No debug errors or warnings in the passing LDS dispatches. ```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. On each backend the six subword variants compare the complete 320-word UAV for one-group and three-group dispatches. All six full-write mutants mismatch at word 0 (for example, `42abcd70` expected and `12340070` observed), and all six zero-extension mutants mismatch at word 50 (byte `ffffff80` vs `00000080`, halfword `ffff8000` vs `00008000`). The form-coverage records include all five added forms. ```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 in WSL Ubuntu 24.04. Each new case preserves the DS instruction spellings, and decoded and CLI translation reproduce the HLSL from the source assembly. The D3D12 readbacks measure the translated shader against the CPU reference.
upstream-sync closed this pull request 2026-11-24 06:45:09 +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!859
No description provided.