compute: lower more typed 2D image atomics in direct compute #3273

Manually merged
github merged 2 commits from github-bot/gh-3271 into gh-pr/3271/base 2026-11-28 04:42:34 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-11-28 04:14 UTC · original
Leyukaka:image-atomic-binops → main · +158 −7 · 4 files · 2 commits · merged 2026-11-28 04:42 UTC

Part of #2935 and #3226, as claimed there. Target branch main. Extends #3164.

Change (src/gfx1013_direct_compute.inl). The direct compute typed 2D image atomic path of #3164 handles image_atomic_cmpswap, _add and _umax. It now also lowers these to DXIL AtomicBinOp, on the same RWTexture2D<uint> binding:

MIMG op DXIL AtomicBinOp
image_atomic_swap (0x0f) Exchange (8)
image_atomic_umin (0x15) UMin (6)
image_atomic_and (0x18) And (1)
image_atomic_or (0x19) Or (2)
image_atomic_xor (0x1a) Xor (3)
  • The operand checks, the EXEC guard and the GLC return of the old value are the existing ones.
  • image_atomic_smin and _smax stay refused, because signed min/max is not verified on this R32_UINT binding. My claim on #3226 listed them, but they are left out here.
  • sub, inc, dec and the float atomics stay refused too, with "direct image opcode or descriptor modifiers".

Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on main e8dd89ed plus this commit.

  • New native_image_atomic_binops_{controls,warp,hardware} reuses the #3164 fixture (native_image_atomic_check.py):
    • the controls check that each new op compiles to atomicBinOp with its code, that the operand refusals (dim, dmask, coordinate, flags and two address-flag encodings) still apply, and that the refused ops keep their message;
    • the readback checks every texture word against a CPU reference. It covers distinct and contended texels, GLC on and off, and a sparse EXEC.
  • Inbox WARP reports the capability skip. On the RTX both tests pass, as do the existing native_image_atomic_* tests.
  • With main's compile_dxil, the controls stop at "direct image opcode or descriptor modifiers".
  • Mutation checks by hand:
    • mapping or to the Xor code fails the controls;
    • mapping umin to UMax or to Exchange fails the hardware readback.
  • On a full build, ctest -R "native_|startup_compute|compile_dxil|image" passes 532 of 533. native_scalar_lds_hardware fails as on main.

Measured with compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests, base and change both on main e8dd89ed.

  • Local capture of 2,689 requests: 751 to 757 compile.
  • The 882 requests of #3226: 237 to 241, which adds 12,848 dispatches.
  • Every newly compiled program stopped at "direct image opcode or descriptor modifiers". In the 882 requests, these are image_atomic_or (3) and _umin (1). No program that compiled before stops compiling.
  • Counts and instruction shape only.

AI-assisted.

**@⁠Leyukaka** on GitHub · 2026-11-28 04:14 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3271) `Leyukaka:image-atomic-binops` → `main` · +158 −7 · 4 files · 2 commits · merged 2026-11-28 04:42 UTC Part of #2935 and #3226, as claimed there. Target branch `main`. Extends #3164. **Change** (`src/gfx1013_direct_compute.inl`). The direct compute typed 2D image atomic path of #3164 handles `image_atomic_cmpswap`, `_add` and `_umax`. It now also lowers these to DXIL `AtomicBinOp`, on the same `RWTexture2D<uint>` binding: | MIMG op | DXIL `AtomicBinOp` | |---|---| | `image_atomic_swap` (0x0f) | Exchange (8) | | `image_atomic_umin` (0x15) | UMin (6) | | `image_atomic_and` (0x18) | And (1) | | `image_atomic_or` (0x19) | Or (2) | | `image_atomic_xor` (0x1a) | Xor (3) | - The operand checks, the EXEC guard and the GLC return of the old value are the existing ones. - `image_atomic_smin` and `_smax` stay refused, because signed min/max is not verified on this R32_UINT binding. My claim on #3226 listed them, but they are left out here. - `sub`, `inc`, `dec` and the float atomics stay refused too, with "direct image opcode or descriptor modifiers". **Tests.** The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on `main` `e8dd89ed` plus this commit. - New `native_image_atomic_binops_{controls,warp,hardware}` reuses the #3164 fixture (`native_image_atomic_check.py`): - the controls check that each new op compiles to `atomicBinOp` with its code, that the operand refusals (dim, dmask, coordinate, flags and two address-flag encodings) still apply, and that the refused ops keep their message; - the readback checks every texture word against a CPU reference. It covers distinct and contended texels, GLC on and off, and a sparse EXEC. - Inbox WARP reports the capability skip. On the RTX both tests pass, as do the existing `native_image_atomic_*` tests. - With `main`'s `compile_dxil`, the controls stop at "direct image opcode or descriptor modifiers". - Mutation checks by hand: - mapping `or` to the Xor code fails the controls; - mapping `umin` to UMax or to Exchange fails the hardware readback. - On a full build, `ctest -R "native_|startup_compute|compile_dxil|image"` passes 532 of 533. `native_scalar_lds_hardware` fails as on `main`. **Measured** with `compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests`, base and change both on `main` `e8dd89ed`. - Local capture of 2,689 requests: 751 to 757 compile. - The 882 requests of #3226: 237 to 241, which adds 12,848 dispatches. - Every newly compiled program stopped at "direct image opcode or descriptor modifiers". In the 882 requests, these are `image_atomic_or` (3) and `_umin` (1). No program that compiled before stops compiling. - Counts and instruction shape only. AI-assisted.
The direct compute typed 2D image atomic path of #3162 (cmpswap, add,
umax) now also lowers image_atomic_swap, _umin, _and, _or and _xor to
DXIL AtomicBinOp Exchange, UMin, And, Or and Xor on the same
RWTexture2D<uint> binding, with the same operand checks, EXEC guard and
GLC return of the old value. image_atomic_smin and _smax stay refused,
because signed min/max is not verified on this R32_UINT binding; sub,
inc, dec and the float atomics stay refused too.

New test native_image_atomic_binops (controls, WARP, hardware) reuses
the #3162 fixture: each new op compiles to atomicBinOp with its code,
the operand refusals still apply, and the refused ops keep "direct
image opcode or descriptor modifiers". The readback covers distinct and
contended texels, GLC on and off, and a sparse EXEC.

AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 04:22:06 +00:00
native-image-atomics now lists swap, umin, and, or and xor with their
AtomicBinOp codes, keeps signed min/max outside the verified scope, and
links the binary-operation fixture.

AI-assisted.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-28 04:24 UTC · original · requested changes

Independent review of 47df6e154b014a165f3c21cbc21f2e8446c83313. The new opcode mapping uses the existing typed 2D UAV operand checks, EXEC guard and GLC return path. The DXIL/refusal controls passed. All 20 new hardware cases matched 336 words each, including contended and distinct texels with GLC on and off. The adjacent add/umax/compare-and-swap fixture also passed and its intentional missing-GLC controls produced readback mismatches.

Release commands:

cmake --build --preset release --target compile_dxil offscreen_check
ctest --preset release --no-tests=error --output-on-failure -V -R '^native_image_atomic_(binops_)?(controls|warp|hardware)$'

Four passed, two capability skips, zero failures. Windows 11 26200.9974, SDK/DXC 10.0.26100.0, RTX 4060 Laptop GPU driver 32.0.16.1656, WARP 10.0.26100.9818. The D3D12 debug layer was enabled and WARP exposed four lanes, below the wave32 requirement.

Before merge, please update docs/experiments/native-image-atomics.md. Its opening still lists the original three direct Compute operations. Add the five now verified on the fixed R32_UINT 2D UAV, and link the new fixture in the reproduction section. Keep signed min/max outside the verified scope.

**@⁠R0Y00** on GitHub · 2026-11-28 04:24 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3271#pullrequestreview-6095795363) · **requested changes** Independent review of `47df6e154b014a165f3c21cbc21f2e8446c83313`. The new opcode mapping uses the existing typed 2D UAV operand checks, EXEC guard and GLC return path. The DXIL/refusal controls passed. All 20 new hardware cases matched 336 words each, including contended and distinct texels with GLC on and off. The adjacent add/umax/compare-and-swap fixture also passed and its intentional missing-GLC controls produced readback mismatches. Release commands: ```powershell cmake --build --preset release --target compile_dxil offscreen_check ctest --preset release --no-tests=error --output-on-failure -V -R '^native_image_atomic_(binops_)?(controls|warp|hardware)$' ``` Four passed, two capability skips, zero failures. Windows 11 `26200.9974`, SDK/DXC `10.0.26100.0`, RTX 4060 Laptop GPU driver `32.0.16.1656`, WARP `10.0.26100.9818`. The D3D12 debug layer was enabled and WARP exposed four lanes, below the wave32 requirement. Before merge, please update `docs/experiments/native-image-atomics.md`. Its opening still lists the original three direct Compute operations. Add the five now verified on the fixed `R32_UINT` 2D UAV, and link the new fixture in the reproduction section. Keep signed min/max outside the verified scope.
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-28 04:27 UTC · original

Thanks for testing it. Pushed 703d6cae, docs only. docs/experiments/native-image-atomics.md now:

  • lists swap, umin, and, or and xor next to add, umax and cmpswap on the fixed 2D R32_UINT UAV, with their AtomicBinOp codes (Exchange 8, UMin 6, And 1, Or 2, Xor 3);
  • keeps signed smin/smax outside the verified scope, together with sub, inc, dec and the float atomics;
  • links tests/native_image_atomic_binops_check.py in the reproduction section, with what it checks. The existing ctest -R '^native_image_atomic_' command already selects it.
  • says the binary-operation fixture passed on an RTX 5080 (driver 32.0.16.2101), and keeps the earlier RTX 4070 sentence for the two original fixtures.

AI-assisted.

**@⁠Leyukaka** on GitHub · 2026-11-28 04:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3271#issuecomment-7234054423) Thanks for testing it. Pushed `703d6cae`, docs only. `docs/experiments/native-image-atomics.md` now: - lists swap, umin, and, or and xor next to add, umax and cmpswap on the fixed 2D `R32_UINT` UAV, with their `AtomicBinOp` codes (Exchange 8, UMin 6, And 1, Or 2, Xor 3); - keeps signed `smin`/`smax` outside the verified scope, together with sub, inc, dec and the float atomics; - links `tests/native_image_atomic_binops_check.py` in the reproduction section, with what it checks. The existing `ctest -R '^native_image_atomic_'` command already selects it. - says the binary-operation fixture passed on an RTX 5080 (driver 32.0.16.2101), and keeps the earlier RTX 4070 sentence for the two original fixtures. AI-assisted.
github-bot changed target branch from main to gh-pr/3271/base 2026-11-28 04:42:33 +00:00
github manually merged commit 703d6cae03 into gh-pr/3271/base 2026-11-28 04:42:34 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-28 04:41 UTC · original · approved these changes

Re-reviewed 703d6cae. The documentation lists the five new operations and links the fixture, while keeping signed min/max explicitly refused. The only change from the previously tested head is that Markdown file. The docs-link check passed (640 links), and the focused Release suite again reported four passes and two inbox WARP wave32 capability skips. RTX 4060 Laptop readback and the DXIL/refusal controls passed. The requested change is resolved.

**@⁠R0Y00** on GitHub · 2026-11-28 04:41 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3271#pullrequestreview-6095851549) · **approved these changes** Re-reviewed `703d6cae`. The documentation lists the five new operations and links the fixture, while keeping signed min/max explicitly refused. The only change from the previously tested head is that Markdown file. The docs-link check passed (640 links), and the focused Release suite again reported four passes and two inbox WARP wave32 capability skips. RTX 4060 Laptop readback and the DXIL/refusal controls passed. The requested change is resolved.
This discussion has been locked. Commenting is limited to contributors.
No description provided.