docs: measure integer image atomics on 32-bit surfaces on gfx1100 #7939
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7939"
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 DavidAmsellem on 2026-10-19T15:12:02Z.
What
The Image atomics entry says that image atomics on 32_SINT and 32_FLOAT surfaces "act on the raw dword through an R32_UINT storage view", with no measurement behind it. This adds one, from a gfx1100 (RX 7900 XT, RDNA3) with the hardware oracle. The 13 integer image atomics (
swap,cmpswap,add,sub,smin,umin,smax,umax,and,or,xor,incanddec) give identical results on 32_UINT, 32_SINT and 32_FLOAT T#s, and those results match a raw-dword model.Method: a 512-texel 1D T# (TYPE 8) is built in SGPRs over the oracle's
extrabytes, with one texel per lane, so no lanes contend. Each lane runs oneimage_atomic_<op> ... glc, waits, and reads the texel back withimage_load ... glc dlc. Both the returned dword and the stored dword are compared with the model, usingcoarsememory.Values: every pair of 0, 1, 0x7fffffff, 0x80000000, 0xffffffff, 1.0, -1.0, a quiet NaN, π, 5 and -5, as old texel and data: 121 rows per op and format.
cmpswapalternates a comparand equal to the old value and one equal to the data.So
addon a 32_FLOAT texel adds the bits (1.0 + 1.0 stores 0x7f000000, not 2.0).smin/smaxare signed andumin/umaxunsigned whatever the format. NaN and infinities are only bit patterns. wave32 and wave64 agree.Control: the same kernel with 16_UINT and 8_8_8_8_UINT T#s does not match. 16_UINT returns the old dword on 11 of 121 rows, because the texels are 2 bytes wide. 8_8_8_8_UINT stores 0xff for 0x7fffffff data. So the T# format is read, and the identical results on the three 32-bit formats are the hardware's answer, not an ignored format field.
gfx1100 has no float image atomics (
llvm-mc -mcpu=gfx1100rejectsimage_atomic_fmin,image_atomic_fmaxandimage_atomic_fcmpswap). thuanquang measured them on gfx1031 (RX 6700 XT, RDNA2): the integer rows match gfx1100, andfmin,fmaxandfcmpswapreturn and store the same dwords on 32_UINT, 32_SINT and 32_FLOAT (19,200 of 19,200 rows). The entry now cites that, so the float part is measured on RDNA2; the console's gfx1013 is still unmeasured, and the entry says so. The 8_8_8_8_UINT control behaves differently on the two GPUs, so the entry keeps 16_UINT as the control that shows the format is read. The 32-bit formats use the GFX11 codes 20, 21 and 22, which match GFX10. No behaviour changes.Tested
Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, AMD Radeon RX 7900 XT (gfx1100), ROCm HSA runtime through
tools/hw-oracle. Float controls on every run:ieee=0 dx10_clamp=1 denorm32=3 denorm16=3 round32=0 round16=0 fp16_overflow=0. Every op, format and wave size ran: 9,438 rows, plus 726 control rows. Documentation only:python3 tools/check_conventions.py --base upstream/mainpasses, and nothing was built.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T15:17:37Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/shader.mdL66-67Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
docs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mdImported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-19T19:08:54Z.
The same measurement on RDNA 2: RX 6700 XT (gfx1031), through the HIP runtime of AMD's Windows driver, so the ISA runs as written. A 1024-texel 1D T# (TYPE 8) built in SGPRs, one texel per lane. Each lane writes its old value with
global_store_dword ... glc, runsimage_atomic_<op> ... glc, reads the texel back withimage_load ... glc dlcand the raw dword withglobal_load_dword ... glc dlc. Your 11 values, 121 pairs per op and format,cmpswapcomparand alternating old and data, IEEE 0, wave32 and wave64:cmpswap)image_loadof the old value through the T#So gfx1031 agrees with your gfx1100 rows on the three 32-bit formats. One control differs: on gfx1031 the atomics on an 8_8_8_8_UINT T# also act on the raw dword (
addof 0x7fffffff to 0 stores 0x7fffffff), whileimage_loadthrough the same T# returns the red channel only (the 33 rows are those with an old value below 256). 16_UINT, with 2-byte texels, does not match, so the texel size is read.gfx1031 has the float image atomics, so the part the entry assumes can be measured there.
image_atomic_fmin,image_atomic_fmaxandimage_atomic_fcmpswapover 20 x 20 pairs (signed zeros, denormals, the smallest normal, ±1, π, the largest normals, infinities, quiet and signalling NaNs of both signs and with payloads), at IEEE 0 and 1, with f32 denormals flushed and kept, wave32 and wave64: every returned and stored dword is the same on 32_UINT, 32_SINT and 32_FLOAT (19,200 of 19,200 rows). So the "float results are assumed to match those measured on 32_UINT surfaces" part holds on this GPU.Those results follow the LDS float atomics rule in
shader.md, including its denormal flush. The 32-bit forms flush both operands when bit 0 of the f32 denormal field is clear, andbuffer_atomic_*andglobal_atomic_*do the same. The emulator's image, buffer and global paths don't flush: #8055.This is desktop RDNA 2, not the console's gfx1013.
Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T22:10:08Z.
@thuanquang thank you, this closes the part I could not measure on gfx1100.
I'll update the entry with your gfx1031 rows: the integer atomics match on the three 32-bit formats on both GPUs, and your
fmin,fmaxandfcmpswapresults (19,200 of 19,200 rows identical on 32_UINT, 32_SINT and 32_FLOAT) confirm the float part that the entry only assumed. It will cite your comment and still say that gfx1013 is unmeasured.Your 8_8_8_8_UINT control is a real difference between the two GPUs: on gfx1100 the atomics on that T# did not follow the raw-dword model, while on gfx1031 they do. The entry will keep only 16_UINT as the control that shows the format is read, since it differs on both.
The missing denormal flush on the image, buffer and global float atomic paths belongs in its own change, so I'll leave it to #8055.