shader: lower gfx1030 fixed-address integer atomic reductions #1354

Manually merged
github merged 1 commit from gh-pr/1354/head into gh-pr/1354/base 2026-11-26 23:00:38 +00:00
Owner

@⁠stan495 on GitHub · 2026-11-24 09:00 UTC · original
stan495:codex/gfx1030-mubuf-atomic-reductions → main · +178 −0 · 5 files · 1 commits · merged 2026-11-24 09:31 UTC

Summary

  • Lower one fixed-address non-returning gfx1030 32-bit buffer_atomic_add/sub/and/or/xor/smin/umin/smax/umax operation to the matching HLSL raw UAV interlocked operation. Use modular arithmetic for subtraction and the matching signedness overload for min/max.
  • Require a verified descriptor and data VGPR, DWORD-aligned immediate, zero scalar offset, and off. Refuse glc, indexed access, and any additional UAV operation. The tested lane guard selects different numbers of contending threads.
  • Compare every output word against an independent reduction reference, and exercise LLVM 15 assembly, disassembly, and the compute-container CLI.

Validation

Commit tested 07f0d40b34329e4955b283cd82151ff9aa6554a9.

cmake --build --preset dev --target offscreen_check
$env:CTEST_PARALLEL_LEVEL = '2'
ctest --preset dev --no-tests=error -R '^compute_store_aot_' -V --output-junit "$PWD/out/compute-store-07f0d40b.xml"
python -B tools/form_coverage.py out/compute-store-07f0d40b.xml --records out/build/dev/form_coverage --gaps gfx1030 --json out/compute-store-07f0d40b.json
python -B tests/form_coverage_check.py
python -B tests/docs_links_check.py

48 passed, 0 failed, 0 capability skips. The passing WARP and hardware fixtures both record all nine new forms. Windows build 26300.9974, WARP on Microsoft Basic Render Driver (10.0.26100.9818), and hardware on Intel Arc B390 (32.0.101.8509). The debug layer was unavailable on both. The dispatches execute translated DXIL. The wrong-operation and signedness mutants fail at word 1, including add vs. sub (eec30576 expected, 9cc88614 actual) and signed vs. unsigned min (a434c802 expected, 2434c800 actual).

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

Passed on Ubuntu 22.04.5 with LLVM 15.0.7. Coverage and docs self-checks passed.

The D16 load, formatted-store, and atomic-reduction fixture modes all passed on both adapters from the simulated integration bed1478a361de258dcad11bbf9bc8446cf2427bb, with #1343, #1346, and this branch applied in order.

git diff --check and git merge-tree --write-tree refs/remotes/origin/main HEAD passed, with main at c4966c6439b2747831d160a346d8f466ff094b25.

**@⁠stan495** on GitHub · 2026-11-24 09:00 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1354) `stan495:codex/gfx1030-mubuf-atomic-reductions` → `main` · +178 −0 · 5 files · 1 commits · merged 2026-11-24 09:31 UTC ## Summary - Lower one fixed-address non-returning gfx1030 32-bit `buffer_atomic_add/sub/and/or/xor/smin/umin/smax/umax` operation to the matching HLSL raw UAV interlocked operation. Use modular arithmetic for subtraction and the matching signedness overload for min/max. - Require a verified descriptor and data VGPR, DWORD-aligned immediate, zero scalar offset, and `off`. Refuse `glc`, indexed access, and any additional UAV operation. The tested lane guard selects different numbers of contending threads. - Compare every output word against an independent reduction reference, and exercise LLVM 15 assembly, disassembly, and the compute-container CLI. ## Validation Commit tested `07f0d40b34329e4955b283cd82151ff9aa6554a9`. ```powershell cmake --build --preset dev --target offscreen_check $env:CTEST_PARALLEL_LEVEL = '2' ctest --preset dev --no-tests=error -R '^compute_store_aot_' -V --output-junit "$PWD/out/compute-store-07f0d40b.xml" python -B tools/form_coverage.py out/compute-store-07f0d40b.xml --records out/build/dev/form_coverage --gaps gfx1030 --json out/compute-store-07f0d40b.json python -B tests/form_coverage_check.py python -B tests/docs_links_check.py ``` 48 passed, 0 failed, 0 capability skips. The passing WARP and hardware fixtures both record all nine new forms. Windows build `26300.9974`, WARP on Microsoft Basic Render Driver (`10.0.26100.9818`), and hardware on Intel Arc B390 (`32.0.101.8509`). The debug layer was unavailable on both. The dispatches execute translated DXIL. The wrong-operation and signedness mutants fail at word 1, including add vs. sub (`eec30576` expected, `9cc88614` actual) and signed vs. unsigned min (`a434c802` expected, `2434c800` actual). ```sh python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ``` Passed on Ubuntu 22.04.5 with LLVM 15.0.7. Coverage and docs self-checks passed. The D16 load, formatted-store, and atomic-reduction fixture modes all passed on both adapters from the simulated integration `bed1478a361de258dcad11bbf9bc8446cf2427bb`, with #1343, #1346, and this branch applied in order. `git diff --check` and `git merge-tree --write-tree refs/remotes/origin/main HEAD` passed, with main at `c4966c6439b2747831d160a346d8f466ff094b25`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:00:33 +00:00
github manually merged commit 07f0d40b34 into gh-pr/1354/base 2026-11-26 23:00:38 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 09:22 UTC · original · reviewed

Technical peer-review at commit 07f0d40b34329e4955b283cd82151ff9aa6554a9.

Verification

  • Linux / LLVM-19:
    • git diff --check origin/main...HEAD: clean.
    • tests/docs_links_check.py: passed (16 Markdown files, 300 links).
    • tests/bidi_controls_check.py: passed (1119 tracked files).
    • tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: passed.
    • tests/rdna2_tools_check.py: passed (138 tests, 18 skipped).
    • tests/form_coverage_check.py: passed.
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): 2/2 passed (compute_store_aot_mubuf_reduction_{warp,hardware}) in 4.61s.
    • Release /O2 (--preset release): 2/2 passed in 4.53s.

Code Review Notes

  • tools/compute_store_aot.py: Properly enforces cpu == "gfx1030", raw u0 (stride is None and output_format is None), off, zero scalar offset, 4-byte aligned offset <= 4095, verified s[base:base+3] descriptor at lgkmcnt(0), known data VGPR (src <= 255), and sole UAV store/atomic (stores / atomic_reduction mutual exclusion).
  • DXIL lowering: Modular subtraction ((0u - word)) with InterlockedAdd and signedness selection (int + asint(word) for smin/smax, uint otherwise) match the Interlocked* overloads cleanly.
  • Tests: Negative controls cover glc, idxen, non-zero scalar offset, unaligned/out-of-range offsets, unaligned/unwaited descriptor, unknown data VGPR, duplicate/mixed UAV ops, non-gfx1030, and structured stride; the GPU fixture exercises multi-group lane contention and wrong-op/wrong-signedness mutations.
**@⁠tedin7** on GitHub · 2026-11-24 09:22 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1354#pullrequestreview-6036613713) · **reviewed** Technical peer-review at commit `07f0d40b34329e4955b283cd82151ff9aa6554a9`. ### Verification - **Linux / LLVM-19**: - `git diff --check origin/main...HEAD`: clean. - `tests/docs_links_check.py`: passed (16 Markdown files, 300 links). - `tests/bidi_controls_check.py`: passed (1119 tracked files). - `tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so`: passed. - `tests/rdna2_tools_check.py`: passed (`138` tests, `18` skipped). - `tests/form_coverage_check.py`: passed. - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: 2/2 passed (`compute_store_aot_mubuf_reduction_{warp,hardware}`) in `4.61s`. - **Release `/O2` (`--preset release`)**: 2/2 passed in `4.53s`. ### Code Review Notes - **`tools/compute_store_aot.py`**: Properly enforces `cpu == "gfx1030"`, raw `u0` (`stride is None and output_format is None`), `off`, zero scalar offset, 4-byte aligned `offset <= 4095`, verified `s[base:base+3]` descriptor at `lgkmcnt(0)`, known data VGPR (`src <= 255`), and sole UAV store/atomic (`stores` / `atomic_reduction` mutual exclusion). - **DXIL lowering**: Modular subtraction (`(0u - word)`) with `InterlockedAdd` and signedness selection (`int` + `asint(word)` for `smin`/`smax`, `uint` otherwise) match the `Interlocked*` overloads cleanly. - **Tests**: Negative controls cover `glc`, `idxen`, non-zero scalar offset, unaligned/out-of-range offsets, unaligned/unwaited descriptor, unknown data VGPR, duplicate/mixed UAV ops, non-`gfx1030`, and structured stride; the GPU fixture exercises multi-group lane contention and wrong-op/wrong-signedness mutations.
This discussion has been locked. Commenting is limited to contributors.
No description provided.