shader: support multi-store and constant-SGPR compute kernels in compute_store_aot #539

Manually merged
github merged 1 commit from gh-pr/539/head into gh-pr/539/base 2026-11-26 21:59:59 +00:00
Owner

@⁠alexander-src on GitHub · 2026-11-22 10:10 UTC · original
alexander-src:shader/compute-multi-store-aot → main · +134 −28 · 3 files · 1 commits · merged 2026-11-22 10:18 UTC

Change

Extend tools/compute_store_aot.py to lower compute kernels with multiple non-overlapping raw UAV stores and general constant SGPR values:

  • Allow multiple buffer_store_dword, buffer_store_dwordx2, buffer_store_dwordx3 and buffer_store_dwordx4 stores per invocation in source order, rejecting overlapping byte spans within the same invocation so write-order aliasing cannot slip through.
  • Track general 32-bit s_mov_b32 immediates, sign-extended 16-bit s_movk_i32 immediates and v_mov_b32[_e32|_e64] copies from tracked constant SGPRs and VGPRs while rejecting pending or non-constant sources (table, group, local).
  • Accept s_clause hints within the 6-bit field limit (<= 0x3f) and s_waitcnt vmcnt(0) or combined lgkmcnt(0) + vmcnt(0) waits.
  • Add MULTI_FIXED (numthreads(1,1,1), two stores at offsets 8 and 32) and MULTI_INDEXED (numthreads(32,1,1), stride 12 with stores at offsets 0 and 8 leaving the gap word at offset 4 untouched as sentinel) fixtures plus seven new negative controls in tests/compute_store_check.py, and update docs/experiments.md.

No shared interface changed; existing single-store HLSL output is unchanged.

Verification

Tested on Linux x64 at commit a5ac416 (based on 914d241) with Python 3 (requirements-dev.txt installed) and LLVM 23.1.4 (llvm-mc, llvm-objcopy, /usr/lib/libLLVM.so):

  • python -B tests/compute_store_check.py binary llvm-mc llvm-objcopy /usr/lib/libLLVM.so: passed (all positive fixtures, assemble/disassemble round trips, CLI check and negative controls).
  • python -B tests/form_coverage_check.py: passed.
  • python -B tests/docs_links_check.py: passed (10 Markdown files, 112 links).
  • python -B tests/bidi_controls_check.py: passed (506 tracked files).

Could not run DXC / D3D12 WARP or hardware dispatch locally on Linux (missing Windows SDK, DXC and D3D12 runtime); Windows CI runs compute_store_aot_warp and compute_store_aot_hardware via compute_check.cpp (MULTI_INDEXED uses 3 * 32 * 3 = 288 words, within the 320-word buffer limit).

Evidence and follow-up

All new fixtures (MULTI_FIXED and MULTI_INDEXED) are synthetic gfx1013 compute shaders written directly in tests/compute_store_check.py (MIT). Non-overlapping store checking assumes disjoint byte offsets per invocation; kernels that rewrite the same offset or compute data-dependent values from loads remain rejected for follow-up work.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted: yes.

**@⁠alexander-src** on GitHub · 2026-11-22 10:10 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/539) `alexander-src:shader/compute-multi-store-aot` → `main` · +134 −28 · 3 files · 1 commits · merged 2026-11-22 10:18 UTC ## Change Extend `tools/compute_store_aot.py` to lower compute kernels with multiple non-overlapping raw UAV stores and general constant SGPR values: - Allow multiple `buffer_store_dword`, `buffer_store_dwordx2`, `buffer_store_dwordx3` and `buffer_store_dwordx4` stores per invocation in source order, rejecting overlapping byte spans within the same invocation so write-order aliasing cannot slip through. - Track general 32-bit `s_mov_b32` immediates, sign-extended 16-bit `s_movk_i32` immediates and `v_mov_b32[_e32|_e64]` copies from tracked constant SGPRs and VGPRs while rejecting pending or non-constant sources (`table`, `group`, `local`). - Accept `s_clause` hints within the 6-bit field limit (`<= 0x3f`) and `s_waitcnt vmcnt(0)` or combined `lgkmcnt(0)` + `vmcnt(0)` waits. - Add `MULTI_FIXED` (`numthreads(1,1,1)`, two stores at offsets 8 and 32) and `MULTI_INDEXED` (`numthreads(32,1,1)`, stride 12 with stores at offsets 0 and 8 leaving the gap word at offset 4 untouched as sentinel) fixtures plus seven new negative controls in `tests/compute_store_check.py`, and update `docs/experiments.md`. No shared interface changed; existing single-store HLSL output is unchanged. ## Verification Tested on Linux x64 at commit `a5ac416` (based on `914d241`) with Python 3 (`requirements-dev.txt` installed) and LLVM 23.1.4 (`llvm-mc`, `llvm-objcopy`, `/usr/lib/libLLVM.so`): - `python -B tests/compute_store_check.py binary llvm-mc llvm-objcopy /usr/lib/libLLVM.so`: passed (all positive fixtures, assemble/disassemble round trips, CLI check and negative controls). - `python -B tests/form_coverage_check.py`: passed. - `python -B tests/docs_links_check.py`: passed (10 Markdown files, 112 links). - `python -B tests/bidi_controls_check.py`: passed (506 tracked files). Could not run DXC / D3D12 WARP or hardware dispatch locally on Linux (missing Windows SDK, DXC and D3D12 runtime); Windows CI runs `compute_store_aot_warp` and `compute_store_aot_hardware` via `compute_check.cpp` (`MULTI_INDEXED` uses `3 * 32 * 3 = 288` words, within the 320-word buffer limit). ## Evidence and follow-up All new fixtures (`MULTI_FIXED` and `MULTI_INDEXED`) are synthetic gfx1013 compute shaders written directly in `tests/compute_store_check.py` (MIT). Non-overlapping store checking assumes disjoint byte offsets per invocation; kernels that rewrite the same offset or compute data-dependent values from loads remain rejected for follow-up work. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted: yes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:59:56 +00:00
github manually merged commit a5ac416dc2 into gh-pr/539/base 2026-11-26 21:59:59 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.