shader: lower gfx1030 conditional atomic subtract with discarded result #1557

Merged
stan495 merged 1 commit from upstream-pr/1564 into main 2026-11-24 14:40:39 +00:00
stan495 commented 2026-11-24 14:11:50 +00:00 (Migrated from github.com)

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


Summary

Lower fixed-address unsigned buffer_atomic_csub with glc when the returned value is discarded. Preserve the upstream raw-UAV binding restrictions and reject a use of the pending or unmodelled return. The wrapping-subtract control should first differ at DWORD index 2, expected 00000000, actual c5c5c5c5.

Refs #1354. The atomic counters from #1458 are already on main.

Local check

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

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

Windows GPU validation

Tested commit b61eeb75fa83a7699e2dd41e17641621b284ec37 on Windows 11 x64 (25H2, build 26200.9974) with MSVC 19.44.35228.0 and DXC from Windows SDK 10.0.26100.0.

Backend Adapter Driver D3D12 debug layer Passed Failed Skipped
Hardware AMD Radeon RX 7900 XTX 32.0.32029.2010 Enabled 25 0 0
WARP Microsoft Basic Render Driver 10.0.26100.9818 Enabled 25 0 0

On both backends, buffer_atomic_csub matched the CPU reference across all 320 DWORDs for both the one-group and two-group dispatches. The one-group case left a positive counter and the two-group case reached zero. The D3D12 debug layer reported zero errors and warnings for both dispatches on each backend. The wrapping-subtract negative control first differed at zero-based DWORD index 2 on both backends (00000000 expected, c5c5c5c5 actual). The gfx1030 form coverage report includes buffer_atomic_csub from both fixtures.

Reproduce on Windows

From the repository root, with the development Python environment at out/pe-env:

. .\tools\dev.ps1
cmake --preset dev
cmake --build --preset dev --target offscreen_check
$env:CTEST_PARALLEL_LEVEL = '1'
$junit = Join-Path $PWD 'out/mubuf-csub.xml'
ctest --preset dev --no-tests=error -R '^compute_store_aot_(mubuf_|mimg_)' -V --output-junit $junit
.\out\pe-env\Scripts\python.exe -B tools/form_coverage.py $junit --records out/build/dev/form_coverage --gaps gfx1030 --json out/mubuf-csub-coverage.json
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6583717850 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1564). Originally posted by [stan495](https://github.com/stan495) on 2026-11-24T14:11:50Z. --- ## Summary Lower fixed-address unsigned `buffer_atomic_csub` with `glc` when the returned value is discarded. Preserve the upstream raw-UAV binding restrictions and reject a use of the pending or unmodelled return. The wrapping-subtract control should first differ at DWORD index 2, expected `00000000`, actual `c5c5c5c5`. Refs #1354. The atomic counters from #1458 are already on `main`. ## Local check The LLVM 15 assembly, disassembly and compute-container CLI regression passed at `b61eeb75fa83a7699e2dd41e17641621b284ec37`. ```sh python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ``` ## Windows GPU validation Tested commit `b61eeb75fa83a7699e2dd41e17641621b284ec37` on Windows 11 x64 (25H2, build `26200.9974`) with MSVC `19.44.35228.0` and DXC from Windows SDK `10.0.26100.0`. | Backend | Adapter | Driver | D3D12 debug layer | Passed | Failed | Skipped | | --- | --- | --- | --- | ---: | ---: | ---: | | Hardware | AMD Radeon RX 7900 XTX | `32.0.32029.2010` | Enabled | 25 | 0 | 0 | | WARP | Microsoft Basic Render Driver | `10.0.26100.9818` | Enabled | 25 | 0 | 0 | On both backends, `buffer_atomic_csub` matched the CPU reference across all 320 DWORDs for both the one-group and two-group dispatches. The one-group case left a positive counter and the two-group case reached zero. The D3D12 debug layer reported zero errors and warnings for both dispatches on each backend. The wrapping-subtract negative control first differed at zero-based DWORD index 2 on both backends (`00000000` expected, `c5c5c5c5` actual). The gfx1030 form coverage report includes `buffer_atomic_csub` from both fixtures. ### Reproduce on Windows From the repository root, with the development Python environment at `out/pe-env`: ```powershell . .\tools\dev.ps1 cmake --preset dev cmake --build --preset dev --target offscreen_check $env:CTEST_PARALLEL_LEVEL = '1' $junit = Join-Path $PWD 'out/mubuf-csub.xml' ctest --preset dev --no-tests=error -R '^compute_store_aot_(mubuf_|mimg_)' -V --output-junit $junit .\out\pe-env\Scripts\python.exe -B tools/form_coverage.py $junit --records out/build/dev/form_coverage --gaps gfx1030 --json out/mubuf-csub-coverage.json ```
upstream-sync closed this pull request 2026-11-24 15:02:01 +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!1557
No description provided.