feat(shader): implement 64-bit image_atomic_inc and image_atomic_dec #16952
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16952"
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 boykopovar/AnyPS5. Originally posted by r614 on 2026-11-08T01:07:17Z.
What
64-bit
image_atomic_incandimage_atomic_dec(MIMG opcodes 0x1b and 0x1c with a two-dword data mask) threw64-bit ImageAtomicInc32 is not implemented. They now translate to newImageAtomicInc64/ImageAtomicDec64IR opcodes. Those run as a 64-bit compare-and-swap loop through the existingAtomicUpdateTypedon the R64_UINT texel pointer that the other 64-bit image atomics use.Semantics, from the RDNA 2 ISA descriptions of
IMAGE_ATOMIC_INCandIMAGE_ATOMIC_DEC(unsigned compares, old value returned):mem = mem >= data ? 0 : mem + 1mem = (mem == 0 || mem > data) ? data : mem - 1These are the rules the repo already applies to the 64-bit buffer, global and LDS forms (
BufferAtomicInc64,SharedAtomicInc64and theirDecpairs). The new opcodes sit inside theImageAtomicSwap64..ImageAtomicCmpSwap64range, soIsImageAtomic64Opcode, the Int64ImageEXT capability and the storage-view selection apply unchanged.The debt entry in
docs/dev/debt/shader.mdis cut so it no longer lists 64-bit inc/dec as throwing. The 64-bit float atomics and other accesses to the same image still throw.Tested
NVIDIA GeForce RTX 5090, driver 610.88 (32.0.16.1088), Windows 11 Pro 26200. Built with WinLibs GCC 15.2.0, Release, on
main0f147e329f.agc_driver_image_atomics64gainsimage_atomic_incandimage_atomic_decblocks in its hand-assembled shader (rows 11 and 12;0xf06c2308and0xf0702308). They check the returned and stored value for the 12 edge pairs and the random inputs on 32_32 UINT, SINT and FLOAT.>instead of>=, and if dec wraps to 0 instead ofdata.mainand this branch,ctest --test-dir build -R ^agc_driver_image_atomics -Vran withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1(Vulkan SDK 1.4.363.1):was not found but was requested by env var VK_INSTANCE_LAYERS.VK_LOADER_DEBUG=layershows the validation layer inserted.VUID-lines, so the change adds no validation errors.agc_driver_image_atomics,_bitwise,_float,shader_ir_use_rewrite,shader_memory_decoder_tolerance,agc_ir_reclaim,ir_dump_memory,shader_scan,progress_reportandprogress_report_inputs.python3 tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.pyfinds no open PR with the same exports or new files. It could not compare 29 PRs that conflict withmain. I checked their diffs by hand: none adds 64-bit image inc/dec.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T21:14:21Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation and test additions inspected support merging.
What I ran
Reviewed head
9f494d21fc2d9d7688c6fc3b8bcf2e82403b9282using the prepared diff and the pinned repository reader. No tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I read every changed file listed in the manifest.
files.jsonwas unavailable through the reader, so excluded-file details could not be confirmed. I did not run tests or independently verify the author-reported hardware and CI results.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T03:27:52Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation and added edge case coverage look sound based on the source reviewed.
What I ran
Reviewed head
52b292d27312f29fe487bbf87859eac0bedbe0b7using the prepared diff and pinned repository reader. No tests or builds were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Did not run the tests, build, GPU validation, or convention checks reported in the PR description. No changed files were excluded: all eight changed files listed in the manifest were included and read. The separately requested
files.jsonwas not available through the reader; the reader listing confirmed the eight changed files and their inclusion.To get this to a good state
Nothing is required.