compute: lower 3D and NSA typed image atomics #3338

Manually merged
github merged 1 commit from github-bot/gh-3336 into main 2026-11-29 08:39:24 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-11-28 10:49 UTC · original
Leyukaka:compute-image-atomic-3d-nsa → main · +185 −11 · 6 files · 1 commits · merged 2026-11-29 08:36 UTC

Part of #3226.

Typed uint image atomics in the direct compute path (src/gfx1013_direct_compute.inl, image_atomic) accepted only a 2D image with a contiguous address. Two forms are added:

  • A 3D image (dim:SQ_RSRC_IMG_3D). It is bound as a RWTexture3D<uint> UAV, with x, y and z passed to atomicBinOp / atomicCompareExchange. The cache records it as tex3d (src/direct_compute_cache.cpp), and the runtime binds a D3D12_UAV_DIMENSION_TEXTURE3D view for it (src/startup_stubs/d3d12_compute_dispatch.inl).
  • An address given as a one-word NSA list ([vX, vY], or [vX, vY, vZ] for 3D): y and z are read from the VGPRs named in the NSA word.

NSA forms with more than one extra address word, cube and array dimensions keep unsupported typed 2D image atomic operands.

Tests (Windows 11, RTX 5080, SDK 10.0.26100 DXC, Release, main 3926a289 plus this commit):

  • native_image_atomic_3d_nsa_controls compiles a 3D image_atomic_add, a 2D NSA image_atomic_umax, and a 3D NSA image_atomic_cmpswap. It checks the atomic call, the RWTexture3D/RWTexture2D handle properties and the coordinate and data VGPRs. NSA with two extra words, cube and 2D array stay refused.
  • On main the 3D program is refused with unsupported typed 2D image atomic operands.
  • native_image_atomic_3d_nsa_hardware passes: the 2D NSA umax over 336 texture words and the 3D add over 1,168 words of a three-mip volume. native_image_atomic_3d_nsa_warp reports a capability skip (77). tests/compute_check.cpp gains the 3D atomic texture case it uses.
  • ctest -R "native_|startup_compute|compile_dxil|salu": 529 of 531. The two failures were the new control, which passes after a fix to the test's coordinate tracing (not rerun in the full selection), and native_scalar_lds_hardware, which fails as on main.
  • 882 captured compute requests, compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests: 250 to 252. The added programs are the two above, 8,564 dispatches in the issue's run. None is lost, and the existing output is byte-identical.

Not covered: no source mutations were run; the 3D cmpswap case is checked in DXIL only; the tex3d uint manifest line and its runtime reader are not exercised by a test.

**@⁠Leyukaka** on GitHub · 2026-11-28 10:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3336) `Leyukaka:compute-image-atomic-3d-nsa` → `main` · +185 −11 · 6 files · 1 commits · merged 2026-11-29 08:36 UTC Part of #3226. Typed uint image atomics in the direct compute path (`src/gfx1013_direct_compute.inl`, `image_atomic`) accepted only a 2D image with a contiguous address. Two forms are added: - A 3D image (`dim:SQ_RSRC_IMG_3D`). It is bound as a `RWTexture3D<uint>` UAV, with x, y and z passed to `atomicBinOp` / `atomicCompareExchange`. The cache records it as `tex3d` (`src/direct_compute_cache.cpp`), and the runtime binds a `D3D12_UAV_DIMENSION_TEXTURE3D` view for it (`src/startup_stubs/d3d12_compute_dispatch.inl`). - An address given as a one-word NSA list (`[vX, vY]`, or `[vX, vY, vZ]` for 3D): y and z are read from the VGPRs named in the NSA word. NSA forms with more than one extra address word, cube and array dimensions keep `unsupported typed 2D image atomic operands`. Tests (Windows 11, RTX 5080, SDK 10.0.26100 DXC, Release, `main` `3926a289` plus this commit): - `native_image_atomic_3d_nsa_controls` compiles a 3D `image_atomic_add`, a 2D NSA `image_atomic_umax`, and a 3D NSA `image_atomic_cmpswap`. It checks the atomic call, the `RWTexture3D`/`RWTexture2D` handle properties and the coordinate and data VGPRs. NSA with two extra words, cube and 2D array stay refused. - On `main` the 3D program is refused with `unsupported typed 2D image atomic operands`. - `native_image_atomic_3d_nsa_hardware` passes: the 2D NSA `umax` over 336 texture words and the 3D `add` over 1,168 words of a three-mip volume. `native_image_atomic_3d_nsa_warp` reports a capability skip (77). `tests/compute_check.cpp` gains the 3D atomic texture case it uses. - `ctest -R "native_|startup_compute|compile_dxil|salu"`: 529 of 531. The two failures were the new control, which passes after a fix to the test's coordinate tracing (not rerun in the full selection), and `native_scalar_lds_hardware`, which fails as on `main`. - 882 captured compute requests, `compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests`: 250 to 252. The added programs are the two above, 8,564 dispatches in the issue's run. None is lost, and the existing output is byte-identical. Not covered: no source mutations were run; the 3D `cmpswap` case is checked in DXIL only; the `tex3d uint` manifest line and its runtime reader are not exercised by a test.
Typed uint image atomics now accept a 3D image, bound as a
RWTexture3D<uint> UAV (the cache records it as tex3d), with x, y and z
passed to atomicBinOp / atomicCompareExchange, and a 2D image whose
address is an NSA list of two VGPRs. NSA forms with more than one extra
address word, cube and array dimensions keep the existing refusal.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 10:52:20 +00:00
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-29 05:03 UTC · original

Open for review at cdfc5264 (CI green, no conflict with main 212d4b5f). A reviewer can check native_image_atomic_3d_nsa_controls for the DXIL shape and native_image_atomic_3d_nsa_hardware on a hardware adapter; the 3D cmpswap case is covered in DXIL only.

**@⁠Leyukaka** on GitHub · 2026-11-29 05:03 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3336#issuecomment-7251024686) Open for review at `cdfc5264` (CI green, no conflict with `main` `212d4b5f`). A reviewer can check `native_image_atomic_3d_nsa_controls` for the DXIL shape and `native_image_atomic_3d_nsa_hardware` on a hardware adapter; the 3D `cmpswap` case is covered in DXIL only.
github manually merged commit aff3b1addf into main 2026-11-29 08:39:24 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.