Repository navigation
compute: lower more typed 2D image atomics in direct compute - #3271
Conversation
The direct compute typed 2D image atomic path of R0Y00#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 R0Y00#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.
R0Y00
left a comment
There was a problem hiding this comment.
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.
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.
|
Thanks for testing it. Pushed
AI-assisted. |
R0Y00
left a comment
There was a problem hiding this comment.
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.
Part of #2935 and #3224, as claimed there. Target branch
main. Extends #3162.Change (
src/gfx1013_direct_compute.inl). The direct compute typed 2D image atomic path of #3162 handlesimage_atomic_cmpswap,_addand_umax. It now also lowers these to DXILAtomicBinOp, on the sameRWTexture2D<uint>binding:AtomicBinOpimage_atomic_swap(0x0f)image_atomic_umin(0x15)image_atomic_and(0x18)image_atomic_or(0x19)image_atomic_xor(0x1a)image_atomic_sminand_smaxstay refused, because signed min/max is not verified on this R32_UINT binding. My claim on direct compute: untranslated compute shaders of a start-up run ranked by dispatches, with first refusals on main #3224 listed them, but they are left out here.sub,inc,decand 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
maine8dd89edplus this commit.native_image_atomic_binops_{controls,warp,hardware}reuses the shader: lower typed 2D image atomics in direct Compute DXIL #3162 fixture (native_image_atomic_check.py):atomicBinOpwith 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;native_image_atomic_*tests.main'scompile_dxil, the controls stop at "direct image opcode or descriptor modifiers".orto the Xor code fails the controls;uminto UMax or to Exchange fails the hardware readback.ctest -R "native_|startup_compute|compile_dxil|image"passes 532 of 533.native_scalar_lds_hardwarefails as onmain.Measured with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests, base and change both onmaine8dd89ed.image_atomic_or(3) and_umin(1). No program that compiled before stops compiling.AI-assisted.