shader: lower gfx1030 fixed-address atomic counters #1451

Merged
stan495 merged 1 commit from upstream-pr/1458 into main 2026-11-24 13:32:58 +00:00
stan495 commented 2026-11-24 11:52:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T11:52:38Z.


Summary

Lower non-returning gfx1030 buffer_atomic_inc, buffer_atomic_dec, and the _x2 forms with compare-exchange retry for the existing fixed-address raw UAV profile. The fixtures cover above-limit values, 32-bit wrap, and 64-bit borrow across DWORDs. An omitted retry first differs at DWORD index 2 for inc, expected 00000000, actual c5c5c5c5.

Refs #1354. The fixed-address atomic-exchange groundwork from #1384 is on main.

Local check

The LLVM 15 assembly, disassembly and compute-container CLI regression passed at 22458aea02b54b5b6ac040a63881aa7ae8dda1d6.

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

Independent GPU validation requested

Please run the translated DXIL tests from a Windows dev build and post the tested SHA, adapter, driver, Windows build, debug-layer status, pass/fail/skip counts and the first mismatch if present. The tests compare all 320 DWORDs at one and two groups. The WARP and physical adapter results for this head are pending.

cmake --preset dev
cmake --build --preset dev --target offscreen_check
$env:CTEST_PARALLEL_LEVEL = '1'
ctest --preset dev --no-tests=error -R '^compute_store_aot_(mubuf_|mimg_)' -V --output-junit out/mubuf-counter.xml
.\out\pe-env\Scripts\python.exe -B tools/form_coverage.py out/mubuf-counter.xml --records out/build/dev/form_coverage --gaps gfx1030 --json out/mubuf-counter-coverage.json
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6581140882 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1458). Originally posted by [stan495](https://github.com/stan495) on 2026-11-24T11:52:38Z. --- ## Summary Lower non-returning gfx1030 `buffer_atomic_inc`, `buffer_atomic_dec`, and the `_x2` forms with compare-exchange retry for the existing fixed-address raw UAV profile. The fixtures cover above-limit values, 32-bit wrap, and 64-bit borrow across DWORDs. An omitted retry first differs at DWORD index 2 for `inc`, expected `00000000`, actual `c5c5c5c5`. Refs #1354. The fixed-address atomic-exchange groundwork from #1384 is on `main`. ## Local check The LLVM 15 assembly, disassembly and compute-container CLI regression passed at `22458aea02b54b5b6ac040a63881aa7ae8dda1d6`. ```sh python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ``` ## Independent GPU validation requested Please run the translated DXIL tests from a Windows dev build and post the tested SHA, adapter, driver, Windows build, debug-layer status, pass/fail/skip counts and the first mismatch if present. The tests compare all 320 DWORDs at one and two groups. The WARP and physical adapter results for this head are pending. ```powershell cmake --preset dev cmake --build --preset dev --target offscreen_check $env:CTEST_PARALLEL_LEVEL = '1' ctest --preset dev --no-tests=error -R '^compute_store_aot_(mubuf_|mimg_)' -V --output-junit out/mubuf-counter.xml .\out\pe-env\Scripts\python.exe -B tools/form_coverage.py out/mubuf-counter.xml --records out/build/dev/form_coverage --gaps gfx1030 --json out/mubuf-counter-coverage.json ```
tedin7 commented 2026-11-24 13:00:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:31:18Z.

Review: COMMENTED


Dual-platform review of PR #1458 at commit 22458aea02b54b5b6ac040a63881aa7ae8dda1d6:

Code & Scope Audit

  • tools/compute_store_aot.py adds inc and dec to MUBUF_ATOMIC_METHODS (CompareExchange / CompareExchange64) and lowers non-returning fixed-address buffer_atomic_inc/dec and _x2 using a [allow_uav_condition] do { ... } while (observed != expected); CAS retry loop seeded with observed = 0u (0ull).
  • Wrap predicates (expected >= limit ? 0 : expected + 1 for inc; expected == 0 || expected > limit ? limit : expected - 1 for dec) handle above-limit initial values, 0, and UINT32_MAX/UINT64_MAX limits without overflow or underflow.
  • Existing sole-UAV-operation, fixed-address (off), glc-clear, and descriptor/offset alignment checks apply.
  • tests/compute_store_check.py tests 32-bit and 64-bit cases across 1 and 2 wave32 groups, including a negative control (while (observed != expected) -> while (false)) that verifies failure at word=2.

Verification

  • Linux (llvm-mc-19, llvm-objcopy-19, libLLVM-19.so):
    • python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: passed.
    • git diff --check origin/main...HEAD: passed.
    • python3 -B tests/docs_links_check.py: passed (16 Markdown files, 326 links).
    • python3 -B tests/bidi_controls_check.py: passed (1190 files).
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): cmake --build --preset dev --target offscreen_check -- -j 6 (10.99s); ctest --preset dev -R '^compute_store_aot_mubuf_counter' --parallel 4 --no-tests=error --output-on-failure: 4/4 passed (3.61s).
    • Release /O2 (--preset release): cmake --build --preset release --target offscreen_check -- -j 6 (7.95s); ctest --preset release -R '^compute_store_aot_mubuf_counter' --parallel 4 --no-tests=error --output-on-failure: 4/4 passed (3.67s).
  • Not run: physical GPU execution (this VM only has D3D12 WARP).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6039225789 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1458#pullrequestreview-6039225789). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T12:31:18Z. **Review:** COMMENTED --- Dual-platform review of PR #1458 at commit `22458aea02b54b5b6ac040a63881aa7ae8dda1d6`: ### Code & Scope Audit - `tools/compute_store_aot.py` adds `inc` and `dec` to `MUBUF_ATOMIC_METHODS` (`CompareExchange` / `CompareExchange64`) and lowers non-returning fixed-address `buffer_atomic_inc`/`dec` and `_x2` using a `[allow_uav_condition] do { ... } while (observed != expected);` CAS retry loop seeded with `observed = 0u` (`0ull`). - Wrap predicates (`expected >= limit ? 0 : expected + 1` for `inc`; `expected == 0 || expected > limit ? limit : expected - 1` for `dec`) handle above-limit initial values, `0`, and `UINT32_MAX`/`UINT64_MAX` limits without overflow or underflow. - Existing sole-UAV-operation, fixed-address (`off`), `glc`-clear, and descriptor/offset alignment checks apply. - `tests/compute_store_check.py` tests 32-bit and 64-bit cases across 1 and 2 wave32 groups, including a negative control (`while (observed != expected)` -> `while (false)`) that verifies failure at `word=2`. ### Verification - **Linux (`llvm-mc-19`, `llvm-objcopy-19`, `libLLVM-19.so`)**: - `python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so`: passed. - `git diff --check origin/main...HEAD`: passed. - `python3 -B tests/docs_links_check.py`: passed (16 Markdown files, 326 links). - `python3 -B tests/bidi_controls_check.py`: passed (1190 files). - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: `cmake --build --preset dev --target offscreen_check -- -j 6` (`10.99s`); `ctest --preset dev -R '^compute_store_aot_mubuf_counter' --parallel 4 --no-tests=error --output-on-failure`: **4/4 passed** (`3.61s`). - **Release `/O2` (`--preset release`)**: `cmake --build --preset release --target offscreen_check -- -j 6` (`7.95s`); `ctest --preset release -R '^compute_store_aot_mubuf_counter' --parallel 4 --no-tests=error --output-on-failure`: **4/4 passed** (`3.67s`). - **Not run**: physical GPU execution (this VM only has D3D12 WARP).
thepatrickworld commented 2026-11-24 13:00:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T12:31:36Z.


Independent GPU validation

Measured 22458aea merged onto 06e2ff78 (my merge 81cb7632, tree 8b4901a2, working tree clean). Nothing below is a code change.

Environment

  • Windows 11 25H2, build 26200.9974
  • DXC 1.9.2602.17 (10.0.26100.0 user-mode)
  • hardware: AMD Radeon RX 9070 XT vendor=1002 device=7550, driver 32.0.32029.2010
  • warp: Microsoft Basic Render Driver vendor=1414 device=008c, driver 10.0.26100.9818
  • preset dev (Debug), debug_layer=unavailable — see the limitation below

Commands

ctest --preset dev --no-tests=error -R "^compute_store_aot_mubuf_counter(-x2)?_(hardware|warp)$" -V
ctest --preset dev --no-tests=error -R "^compute_store_aot_mubuf" -V

Observed

Four entries, three runs each: 12 passed, 0 failed, 0 skipped.

compute_store_aot_mubuf_counter_hardware      Passed  2.36 / 2.13 / 2.08 s
compute_store_aot_mubuf_counter-x2_hardware   Passed  2.18 / 2.09 / 2.10 s
compute_store_aot_mubuf_counter_warp          Passed  1.65 / 1.63 / 1.62 s
compute_store_aot_mubuf_counter-x2_warp       Passed  1.64 / 1.64 / 1.62 s

On the physical adapter, both inc and dec, scalar and _x2, print:

adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550
driver=32.0.32029.2010
groups=1 compared_words=320 mismatches=0
groups=2 compared_words=320 mismatches=0

The while (false) mutant control inside the fixture is asserted and was caught on both backends, so the pass is not a silent no-op.

Regression

^compute_store_aot_mubuf, the whole buffer-atomic and format family: 26 passed, 0 failed, 0 skipped.

Limits

  • One physical adapter, one driver. The debug layer is not installed here (0x887a002d, SDK component missing; the Graphics Tools optional feature is absent and its install is refused from a remote session with 0x80070005), so the run says nothing about D3D12 API validation — only that the readbacks match.
  • The counter sits at DWORD 2 of a 320-DWORD buffer: the wrap and 64-bit borrow paths are exercised there, but an atomic at the end of a buffer is not.

AI-assisted; runs executed locally on the adapter above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7131561519 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1458#issuecomment-7131561519). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-24T12:31:36Z. --- ### Independent GPU validation Measured `22458aea` merged onto `06e2ff78` (my merge `81cb7632`, tree `8b4901a2`, working tree clean). Nothing below is a code change. **Environment** - Windows 11 25H2, build 26200.9974 - DXC 1.9.2602.17 (`10.0.26100.0` user-mode) - hardware: `AMD Radeon RX 9070 XT vendor=1002 device=7550`, driver `32.0.32029.2010` - warp: `Microsoft Basic Render Driver vendor=1414 device=008c`, driver `10.0.26100.9818` - preset `dev` (Debug), `debug_layer=unavailable` — see the limitation below **Commands** ```powershell ctest --preset dev --no-tests=error -R "^compute_store_aot_mubuf_counter(-x2)?_(hardware|warp)$" -V ctest --preset dev --no-tests=error -R "^compute_store_aot_mubuf" -V ``` **Observed** Four entries, three runs each: 12 passed, 0 failed, 0 skipped. ``` compute_store_aot_mubuf_counter_hardware Passed 2.36 / 2.13 / 2.08 s compute_store_aot_mubuf_counter-x2_hardware Passed 2.18 / 2.09 / 2.10 s compute_store_aot_mubuf_counter_warp Passed 1.65 / 1.63 / 1.62 s compute_store_aot_mubuf_counter-x2_warp Passed 1.64 / 1.64 / 1.62 s ``` On the physical adapter, both `inc` and `dec`, scalar and `_x2`, print: ``` adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550 driver=32.0.32029.2010 groups=1 compared_words=320 mismatches=0 groups=2 compared_words=320 mismatches=0 ``` The `while (false)` mutant control inside the fixture is asserted and was caught on both backends, so the pass is not a silent no-op. **Regression** `^compute_store_aot_mubuf`, the whole buffer-atomic and format family: **26 passed, 0 failed, 0 skipped**. **Limits** - One physical adapter, one driver. The debug layer is not installed here (`0x887a002d`, SDK component missing; the Graphics Tools optional feature is absent and its install is refused from a remote session with `0x80070005`), so the run says nothing about D3D12 API validation — only that the readbacks match. - The counter sits at DWORD 2 of a 320-DWORD buffer: the wrap and 64-bit borrow paths are exercised there, but an atomic at the end of a buffer is not. _AI-assisted; runs executed locally on the adapter above._
upstream-sync closed this pull request 2026-11-24 14:02:46 +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!1451
No description provided.