shader: lower gfx1030 image atomic arithmetic and bitwise operations #1478
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1485"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T12:45:47Z.
Summary
Lower non-returning gfx1030
image_atomic_add,image_atomic_sub,image_atomic_and,image_atomic_or, andimage_atomic_xorto typed D3D12 UAV operations. This profile accepts one unguarded operation withdmask:0x1, one 32-bit value, contiguous 32-bit XY coordinates, and a caller-declared in-bounds scalarR32_UINT2D UAV at mip zero. It checks descriptor provenance and readiness and rejects unverified forms and flags. Subtraction uses modular negation of the add operand. Min/max, exchange, floating-point atomics and returned values are not part of this PR.This is the arithmetic and bitwise slice of the fork prototype stan495/Xbox2Windows#11. The MSAA parent, #1444, is already in main.
Verification
Tested clean head
a8815ee61e771fdad7bae1768e212b451ca19744.CTest: 21 passed, 0 failed, 0 skipped. Each adapter ran all five operations plus a contended add, each at one and two group counts. The CPU reference checks all 336 words across three mips, including unwritten texels. The subtract-as-add negative control first differs at mip 0, word 32:
7fffffdfexpected,80000001actual. Rejection controls include an unready descriptor, wrong format or mip, unsupported mask, bad registers, flags, and a second atomic. Both passing atomic fixture records contain exactly the five new gfx1030 mnemonics; the compute run covers 17/111 MIMG mnemonics in the RDNA2 reference.Windows 11 build
26300.9974; Intel Arc B39032.0.101.8509; Microsoft WARP10.0.26100.9818. Debug layer unavailable on both backends.LLVM 15 assembly, disassembly and synthetic-container CLI round trips passed.
git diff --check origin/main...HEADpassed.git merge-tree --write-tree origin/main HEADpassed against6df679bf979d21b1be32d6b5ac1513bebd82d6a8. This merge simulation is separate from the test run.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T13:04:46Z.
Review: COMMENTED
Peer review of PR #1485 (
a8815ee61e771fdad7bae1768e212b451ca19744).Code & Diff Audit
tools/compute_store_aot.py):R32_UINTSRV (image_msaa) fromR32_UINTUAV (image_atomic) by removingR32_UINTfromIMAGE_FORMATSand gatingimage_atomicongfx1030,image_uav_mip == 0,guard_span is None, and no priorstores.dmask:0x1, 8-bit VGPR indices (<= 255), contiguous 32-bit X/Y coordinates (y == x + 1), scalarR32_UINTRWTexture2D<uint>, and 8-dword descriptor provenance/readiness (pending.intersectioncheck).add,sub(via modular0u - value),and,or,xortoInterlocked{Add,And,Or,Xor}(outputData[uint2(x, y)], value);.tests/compute_check.cpp,tests/compute_store_check.py):tests/compute_check.cppaddstexture_atomic_uint_flag(1u << 25), checksD3D12_FORMAT_SUPPORT2_UAV_ATOMIC_ADD | D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS, and enforcesmip == 0.tests/compute_store_check.pycovers all 5 ops at 1 and 2 thread groups plus contendedadd, verifies all 336 texels across 3 mips against a CPU reference, includes asubnegative control (mip=0 word=32 expected=7fffffdf actual=80000001), and tests rejection diagnostics for bad masks, registers, descriptors, flags, dimensions, multiple atomics, and mismatched bindings.tests/docs_links_check.py,tests/bidi_controls_check.py, andgit diff --check origin/main...HEADall pass on Linux. Title-neutral.Win2025 Verification
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
a8815ee61e771fdad7bae1768e212b451ca19744:--preset dev):cmake --build --preset dev --target offscreen_check -- -j 6):22.21s(configure1.76s)ctest --preset dev -R '^(compute_store_aot_mimg_atomic_integer_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' --parallel 4 --no-tests=error --output-on-failure): 7/7 passed (3.75s:compute_tables_warp0.05s,compute_root_hardware0.06s,compute_root_warp0.05s,compute_tables_hardware0.07s,offscreen_capability_table_self_test0.03s,compute_store_aot_mimg_atomic_integer_warp3.58s,compute_store_aot_mimg_atomic_integer_hardware3.62s)/O2(--preset release):cmake --build --preset release --target offscreen_check -- -j 6):23.28s(configure1.82s)ctest --preset release -R '^(compute_store_aot_mimg_atomic_integer_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' --parallel 4 --no-tests=error --output-on-failure): 7/7 passed (3.95s:compute_tables_warp0.05s,compute_root_hardware0.05s,compute_tables_hardware0.06s,offscreen_capability_table_self_test0.03s,compute_root_warp0.06s,compute_store_aot_mimg_atomic_integer_hardware3.69s,compute_store_aot_mimg_atomic_integer_warp3.80s)