emu: implement all 16 RDNA 2 MIMG image_atomic_* instructions #309
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!309
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-309"
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?
@Lewandox on GitHub · 2026-11-26 02:07 UTC · original
Lewandox:feat/rdna2-mimg-image-atomics→main· +557 −16 · 5 files · 2 commits · merged 2026-11-26 11:03 UTCSummary
Implements all 16 RDNA 2
MIMGimage_atomic_*2D instructions in both the reference interpreter and the HLSL recompiler, plus the corresponding 32-bit and 64-bit integer image formats (FORMAT_32_UINT,FORMAT_32_SINT,FORMAT_32_32_UINT,FORMAT_32_32_SINT), bringingrdna2_exec.coverage()from1,285/1,490to1,301/1,490(+16 instructions):image_atomic_swap,image_atomic_cmpswapimage_atomic_add,image_atomic_subimage_atomic_smin,image_atomic_umin,image_atomic_smax,image_atomic_umaximage_atomic_and,image_atomic_or,image_atomic_xorimage_atomic_inc,image_atomic_decimage_atomic_fcmpswap,image_atomic_fmin,image_atomic_fmaxDetails
PrototypeScarlett/emu/rdna2_image.py:ATOMIC_OPS,ATOMIC_CMPSWAP_OPS,ATOMIC_FORMATS_32,ATOMIC_FORMATS_64, andFORMAT_32_UINT/FORMAT_32_SINT/FORMAT_32_32_UINT/FORMAT_32_32_SINT(TEXEL_BYTES).glcbit (bit 13) ininstruction_fields().atomic_width(name, dmask)validatingdmask(0x1/0x3for 32/64-bit atomics;0x3/0xFforcmpswap/fcmpswap) and updatedaddress_count()(2VGPRs in 2D) andcheck_instruction().PrototypeScarlett/emu/rdna2_exec_image.py:image_atomic_*execution reusingemu.rdna2_exec_atomic.operation(kind, width), enforcing format/width compatibility,glcreturn-old behavior (leavingvdatauntouched whenglc=0and preservingcmpVGPRs), out-of-bounds guards (no memory write,0returned whenglc=1), and safevdata/vaddroverlap.32_UINT,32_SINT,32_32_UINT,32_32_SINT) totexel()and_store_texel().PrototypeScarlett/emu/rdna2_hlsl_image.py:ImageAtomic32()HLSL helper using nativeRWByteAddressBufferInterlocked*forswap,cmpswap,add,sub,umin,umax,and,or,xor, and a boundedInterlockedCompareExchangeCAS loop forsmin,smax,inc,dec,fcmpswap,fmin, andfmaxmatching IEEE NaN/±0semantics bit-for-bit withrdna2_exec_atomic.py, followed byAllMemoryBarrierWithGroupSync().Untranslatable(matching SM 6.0RWByteAddressBuffer32-bit atomic limits).tests/test_rdna2_image_atomic.py&tests/test_rdna2_exec.py:@gpuparity tests for all 16 instructions.test_untranslated_instruction_is_namedintests/test_rdna2_exec.pyto useimage_sample_b(sinceimage_atomic_swapis now supported).Verification
python -m pytest -q: 1352 passed, 322 skipped (0 failed, includingtest_readme_sync.py;@gputests skip locally becausedxc/anyxboxx_gpu_run.exeare not installed on this host).ruff check --select W605,F,E9 PrototypeScarlett tests tools: All checks passed!rdna2_exec.coverage():(1301, 1490)Clean-room note
All encodings and semantics are based solely on public AMD RDNA 2 ISA documentation, LLVM
MIMGInstructions.td, and synthetic tests. No proprietary game or SDK files were used.