tombox-xshader: decode MIMG pck and float-atomic opcodes, translate pck on atomic images #302
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!302
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/302/head"
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?
@QuentinDanblon on GitHub · 2026-11-23 17:07 UTC · original
QuentinDanblon:pr/mimg-pck-atomics→main· +172 −3 · 3 files · 1 commits · closed without mergingLibrary / area:
tombox-xshader, MIMG (src/rdna2/mnem.rs,src/hlsl.rs,tests/exec_mem/mimg.rs). Follows the MIMG gaps of #103 / #114.Exports changed (exports.txt rows): none
Source of the behaviour: AMD RDNA2 ISA document, section 12.16, and LLVM AMDGPU
MIMGInstructions.td(Apache-2.0) for names, numbers and semantics;tests/isa_table/gfx1013.txtagrees. No third-party code.What was actually unmapped
The 32-bit integer image atomics are already mapped on main (0x0f to 0x1c, from #147 and #195), so the BLOCKERS line "every image atomic except add and umax" is out of date. There is no 0x13 on RDNA2. What was left: the pck forms 0x02 to 0x05, 0x0a, 0x0b, and the float atomics 0x1d to 0x1f.
What this PR does
image_load_pck,image_load_pck_sgn,image_load_mip_pck,image_load_mip_pck_sgn,image_store_pck,image_store_mip_pck,image_atomic_fcmpswap,image_atomic_fmin,image_atomic_fmax.RWTexture<uint>/RWTexture<uint64_t>, so pck and pck_sgn give the same bits as the plain load/store and reuse that path, per-mip UAV views included. This rests on the assumption the translator already makes for atomic images.Refused, each with a named error
image_atomic_fcmpswap/fmin/fmax: the ISA only says the float compare "handles NaN/INF/denorm", DXIL has no float min/max image atomic, and no RDNA2-recorded results pin the NaN, signed-zero and denormal cases (the gfx1036 vectors from #195 are integer only).Tests
image_mimg_pck_on_atomic_images(groupmimg_pck): 22 cases, 6 mnemonics, R32_UINT image with 3 mips; texels carry sign bits (0x80000080, 0xffff8000, 0x0000ff80) so a wrong extension would show.image_mimg_pck_on_64bit_atomic_images(mimg_pck_64bit): 7 cases, 3 mnemonics, R32G32_UINT.image_mimg_pck_and_float_atomic_refusals: SRV, UAV without atomics, dmask 0xf, D16, the three float atomics.On
68e32b8(basef89e410, r32l): the three pass on WARP (all cases also with runtime inputs) and withTOMBOX_EXEC_HW=1on an RTX 5090. Fulltombox-xshadersuite on WARP: lib 116 passed 3 ignored,exec131 passed 2 ignored, all other targets pass. Mutations, each failing as expected then restored:_mip_pckloads ignoring the mip (12 cases fail),image_store_mip_pckwriting mip 0 (4 fail), the atomic-image condition removed (refusal test fails), the float-atomic check removed (refusal test fails).pr_gate.py --base origin/main: 0 problems.Questions for you
mnem.rs; tell me and I'll drop them.docs/BLOCKERS.md(atomic list, pck note) is now out of date; I did not edit it.cargo test -p tombox-xshaderpasses (see above)🤖 Generated with Claude Code
@omonkeyz on GitHub · 2026-11-25 13:48 UTC · original
Applied on main in
06e683f(cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.@SchmashinPrunes on GitHub · 2026-11-24 14:34 UTC · original · reviewed
I checked this on RDNA2 silicon: a gfx1036 iGPU (Ryzen 5 9600X), ROCm/HIP 5.7.1, raw wave32 kernels, so RDNA2, not gfx1013. Each kernel ran twice with identical results, and I compared against the semantics this PR implements (my own port; I didn't run the PR's code).
This checks the case the PR translates:
image_load_pckandimage_load_mip_pckon a 32-bit format return the same bits asimage_load/image_load_mip. That held for 192 of 192 cases each (R32_UINT view, a 16×4 image, levels 0..2). So reusing the plain path for 32-bit elements matches the hardware.I didn't check 64-bit images or the float atomics, and I didn't look at 8- or 16-bit formats, where pck would differ from a converting load.
(Measured with an AI assistant, Claude.)
Pull request closed