From 367d91ef238b0cc9ae2a1afb1baa3a84f6389e0b Mon Sep 17 00:00:00 2001 From: milk4sale <53350507+milk4sale@users.noreply.github.com> Date: Mon, 23 Nov 2026 21:36:53 -0600 Subject: [PATCH] GPU fixture cs_imgatomic_ext: image_atomic_{swap,inc,dec,fmin,fmax,fcmpswap} (GPU-IMG-ATOMIC-EXT) The row for the six remaining 32-bit MIMG image atomics was CPU-checked only (tests/semantic/test_image_atomics_32.py) and said "Not GPU-verified on RDNA2". This adds the GPU fixture, judged through vk_store_test's "words" mode and check.py's STORE_WORDS like cs_imgatomic/cs_imgatomic3d: - all six ops on the 2D r32 uint image (binding 4) and the volume (binding 7); inc/dec on both sides of their wrap and with a D that is negative as a signed number; fmin/fmax with a NaN data register; fcmpswap equal, unequal, +0 against -0 and NaN; glc and non-glc - inc/dec/fmin/fmax from all 64 threads on one texel, which runs the translator's CAS loops under contention - inactive lanes held on a trap texel that must keep its fill The cases leave out what the ISA and SPIR-V leave open: NaN or denormal texels for fmin/fmax/fcmpswap and +0 against -0 for fmin/fmax. Exact on a Radeon 610M (gfx1036, RDNA2, RADV Mesa 26.2.6) and an RTX 4070 Ti (NVIDIA 620.70.06), native and LEONIDA_W64_EMULATE=1. Five planted translator faults (signed inc/dec compare, fmin/fmax exchanged, fcmpswap without the +0/-0 rule, no inactive-lane guard, no glc return from swap) each fail it on both. docs/design.md records the GPU check. AI-assisted. No game files. Co-Authored-By: Claude Opus 5.5 --- docs/design.md | 2 +- runtime/test/shaders/check.py | 11 + runtime/test/shaders/cs_imgatomic_ext.asm | 313 ++++++++++++++++++++++ 3 files changed, 325 insertions(+), 1 deletion(-) create mode 100644 runtime/test/shaders/cs_imgatomic_ext.asm diff --git a/docs/design.md b/docs/design.md index cec315722b..dd2148b95b 100644 --- a/docs/design.md +++ b/docs/design.md @@ -424,7 +424,7 @@ How the generated SPIR-V expects the runtime to work: | Half-precision coordinates for LOD queries | For `image_get_lod a16` on 2D and 2D-array images, the low and high halves of the first address VGPR supply U and V. The array layer is excluded from `OpImageQueryLod`; the selected clamped and raw LOD outputs are f32. `tests/semantic/fixtures/get_lod_a16.asm` assembles for gfx1030 and checks the query operands and output components through `tests/test_image_load_typed.py`. [AMD RDNA2 ISA, MIMG](https://gpuopen.com/download/rdna2-shader-instruction-set-architecture.pdf) | | Dynamic storage image descriptor indices | The runtime T# hash result indexes the r32ui arrays (bindings 4 and 7) used by `OpImageTexelPointer` for image atomics and the typed storage arrays (bindings 8 through 19) used by `OpImageWrite` for stores and `OpImageRead` for coherent loads. Literal T# words still go through the hash table. Emit `StorageImageArrayDynamicIndexing` and record `shaderStorageImageArrayDynamicIndexing` in the shader index when a storage array is accessed this way. Plain typed loads use sampled aliases and follow the sampled indexing rule. The same Vulkan dynamic-uniformity contract applies to storage indices. Confirmed by [Vulkan VUID 10130](https://docs.vulkan.org/spec/latest/appendices/spirvenv.html#VUID-StandaloneSpirv-StorageImageArrayDynamicIndexing-10130), the synthetic `storage_dynamic_index.asm` regression (`test_literal_storage_descriptor_and_mixed_sampled_load`, `test_storage_aliases_in_every_dimension` and `test_atomic_texel_pointers_use_storage_indices` in `tests/semantic/test_sampled_dynamic_index.py`) and `spirv-val`. | | Image atomics, size and LOD queries | `image_atomic_add/sub/and/or/xor/smin/smax/umin/umax` are `OpAtomicIAdd/ISub/And/Or/Xor/SMin/SMax/UMin/UMax` on the texel (`OpImageTexelPointer`) of an r32ui storage image, binding 4 for 2D and 7 for 3D, at the T#'s index (the view `StorageViews::r32ui` of `runtime/src/vulkan_bindless.h`). The data VGPR is the operand; with `glc` it receives the texel's previous value, without it it is not written (RDNA2 ISA, MIMG: the previous value is returned if glc is 1). `image_atomic_cmpswap` takes two data VGPRs, the new value and then the comparand (`OpAtomicCompareExchange`). A lane that EXEC turns off skips the access entirely (`OpAccessChain`, `OpImageTexelPointer`, `OpAtomic*`, and any `glc` write-back sit inside `if (active)`), leaving memory and `vdata` untouched. Two-VGPR `dmask:0x3` forms of the nine standard ops currently still operate on the low 32-bit dword as before; true 64-bit image atomics remain separate follow-up work. `image_get_resinfo` (2D, no sampler) gives, for the mip level in its address VGPR, width, height, depth (0 for 2D; a 2D array's layers minified from BASE_LEVEL, T# word 3 [15:12]) and the level count in VGPRs 0..3, with width, height and depth 0 past the last level (the size isn't queried there) (ISA: {num_mip_levels, depth, height, width} in VGPRs 3..0; `OpImageQuerySizeLod`, `OpImageQueryLevels`). `image_get_lod` (pixel shaders; 2D and 2D array, the slice ignored) gives the clamped LOD and the calculated LOD in VGPRs 0..1 (ISA: {rawLOD, clampedLOD} in VGPRs 1..0; `OpImageQueryLod`). In both, dmask keeps components and packs them into consecutive VGPRs. GPU-checked (TEST-184) on an RX 7900 XTX and a Ryzen 9 7950X3D integrated GPU (RADV, Mesa 26.3.1) and on Mesa llvmpipe, with the expected words derived by hand in each `.asm` header: `cs_imgatomic.asm` (every op on a 2D image: 0xfffffff0 tells the signed min/max from the unsigned ones, each with a case that goes the other way; cmpswap hit and miss; an op without `glc`; 63 lanes off; 64 threads adding to one texel) and `cs_imgatomic3d.asm` (six cases on a 4x4x4 volume, the three coordinates all different), through `vk_store_test words`; `cs_resinfo.asm` (a 16x4 image with five levels: levels 0, 1 and 3 in full, then dmask 0x3, 0xa and 0x8); `ps_get_lod.asm` and `ps_get_lod_array.asm` through `vk_texture_test` (calculated LOD 1 and 3 on the two-mip texture, the clamped LOD held at the last level, and at 0 by a sampler MAX_LOD of 0.25; 2 and -3 on the one-level array). Measured natively on RDNA2 (gfx1036, SHADER-388: `tools/image_query_probe.py`, 614 results in wave32 and wave64, all as follows). resinfo's depth word is 0 for a 2D image whatever T# WORD4 DEPTH holds; for a 2D array it is the layer count minified like a 3D depth, max(1, layers >> (BASE_LEVEL + level)). Past the last level, width, height and depth are 0. The level count is LAST_LEVEL - BASE_LEVEL + 1 and sizes count from BASE_LEVEL. The translator follows all three (`Gen.resinfo_words`; `cs_resinfo.asm` checks the 2D depth word and level 5 of five on RTX 5080 and Radeon Graphics, `tests/test_translate.py` the array rule). `image_get_lod`'s raw LOD includes the S#'s LOD_BIAS. Its clamped LOD is min(max(min(raw, MAX_LOD), MIN_LOD), levels - 1) under a linear mip filter (MIN_LOD wins when it is above MAX_LOD), that value rounded half up (the level read) under a point mip filter, and 0 with MIP_FILTER none: `OpImageQueryLod`'s definition. u is scaled by the width and v by the height (a 64x4 image). Unverified: the clamped LOD under a linear mip filter (the test's sampler is point-filtered, where 0.25 selects level 0), and the order of u and v in the LOD query (the test textures are square, where it makes no difference). `image_get_resinfo` on other dimensions is `Unsupported`. A host quirk the LOD test steps around: Mesa llvmpipe 26.3.1 does not apply a sampler's LOD range to `OpImageQueryLod` when its minimum and maximum are equal (0..0 gave level 1), so the second draw uses 0..0.25. | -| `image_atomic_{swap,inc,dec,fmin,fmax,fcmpswap}` | The six remaining 32-bit MIMG image atomics on 2D (binding 4) and 3D (binding 7) `r32ui` storage images (including `a16` packed coordinates and optional `glc` return), guarded by `active_b` so inactive lanes skip memory access and preserve `vdata`. `image_atomic_swap` emits `OpAtomicExchange`; `inc`/`dec`/`fmin`/`fmax`/`fcmpswap` emit `OpAtomicLoad` (valid on `OpImageTexelPointer` `Image` pointers) followed by a Device-scope `OpAtomicCompareExchange` CAS loop (`inc`: `(M >= D) ? 0 : M + 1`; `dec`: `(M == 0 \|\| M > D) ? D : M - 1`; `fmin`/`fmax`: GLSL.std.450 `NMin`/`NMax`, no float-atomic extension required; `fcmpswap`: integer IEEE-754 binary32 ordered equality on raw 32-bit words — equal iff neither is NaN and `(cur == cmp) \|\| (both ±0.0)`, preserving subnormals even on Vulkan drivers reporting `shaderDenormPreserveFloat32 = false`, exiting without writing on mismatch or NaN; native RDNA2 subnormal behavior under denormal flush is unmeasured). Source: AMD RDNA2 ISA MIMG `IMAGE_ATOMIC_*`. CPU-checked structurally (including `spirv_mini_interp.check_structure` CFG validation) by `tests/semantic/test_image_atomics_32.py` (all 6 ops on 2D and 3D images, `a16`, `glc` and non-`glc`, no `AtomicFloat` capability, rejected widths/coords/dims). **Not GPU-verified on RDNA2.** | +| `image_atomic_{swap,inc,dec,fmin,fmax,fcmpswap}` | The six remaining 32-bit MIMG image atomics on 2D (binding 4) and 3D (binding 7) `r32ui` storage images (including `a16` packed coordinates and optional `glc` return), guarded by `active_b` so inactive lanes skip memory access and preserve `vdata`. `image_atomic_swap` emits `OpAtomicExchange`; `inc`/`dec`/`fmin`/`fmax`/`fcmpswap` emit `OpAtomicLoad` (valid on `OpImageTexelPointer` `Image` pointers) followed by a Device-scope `OpAtomicCompareExchange` CAS loop (`inc`: `(M >= D) ? 0 : M + 1`; `dec`: `(M == 0 \|\| M > D) ? D : M - 1`; `fmin`/`fmax`: GLSL.std.450 `NMin`/`NMax`, no float-atomic extension required; `fcmpswap`: integer IEEE-754 binary32 ordered equality on raw 32-bit words — equal iff neither is NaN and `(cur == cmp) \|\| (both ±0.0)`, preserving subnormals even on Vulkan drivers reporting `shaderDenormPreserveFloat32 = false`, exiting without writing on mismatch or NaN; native RDNA2 subnormal behavior under denormal flush is unmeasured). Source: AMD RDNA2 ISA MIMG `IMAGE_ATOMIC_*`. CPU-checked structurally (including `spirv_mini_interp.check_structure` CFG validation) by `tests/semantic/test_image_atomics_32.py` (all 6 ops on 2D and 3D images, `a16`, `glc` and non-`glc`, no `AtomicFloat` capability, rejected widths/coords/dims). GPU-checked by `runtime/test/shaders/cs_imgatomic_ext.asm` through `vk_store_test words` (GPU-IMG-ATOMIC-EXT): all six ops on the 2D image and the volume, inc/dec on both sides of their wrap and with a D that is negative as a signed number, fmin/fmax with a NaN in the data register, fcmpswap with an equal and an unequal comparand, +0 against -0 and a NaN, `glc` and non-`glc` returns, inactive lanes held on a trap texel, and inc/dec/fmin/fmax from all 64 threads on one texel (the CAS loops under contention); every word exact on a Radeon 610M (`gfx1036`, RDNA2, RADV Mesa 26.2.6) and an RTX 4070 Ti (NVIDIA 620.70.06), natively and under `LEONIDA_W64_EMULATE=1`. Each of five planted translator faults (a signed inc/dec compare, fmin and fmax exchanged, fcmpswap without the +0/-0 rule, no inactive-lane guard, no `glc` return from swap) fails it on both. Not covered: NaN or denormal texels for fmin/fmax and fcmpswap, and +0 against -0 for fmin/fmax, where `NMin`/`NMax` and native RDNA2 may differ (native behaviour unmeasured). | | Hand-written short assembler forms | `llvm-mc` accepts `v_add_co_ci_u32 vD, src0, src1` (also `v_sub_co_ci_u32`, `v_subrev_co_ci_u32`) with the carry out and in left to VCC, and a modifier list shorter than the operands (`op_sel_hi:[0,0]`, `neg_lo:[1,0]` on a three-source op), whose missing entries are 0; it prints them as `v_add_co_ci_u32_e32 vD, vcc_lo, src0, src1, vcc_lo` and `[0,0,0]`. The GPU runner assembles through `llvm-mc -show-encoding`, so it sees the printed form; `tests/semantic/regen_fixtures.py` copies the `.asm` text as written, so the translator takes the source spelling too (it used to raise `IndexError` for these: the carry forms, `v_pk_fma_f16`, `v_fma_mix_*`). A probe of 42,000 operand and modifier variations of 302 ALU mnemonics, in the source spelling and as `llvm-mc` prints them, found no other `IndexError`, `KeyError` or `TypeError`. CPU-checked by `tests/semantic/test_short_asm_forms.py`. | | SDWA | `_sdwa` forms: each source is narrowed to `src0_sel`/`src1_sel` (BYTE_n/WORD_n, zero-extended, or sign-extended under `sext()`) **before** neg/abs and the op. A VGPR result goes to `dst_sel`, with `dst_unused` setting the other bits: PAD = 0, SEXT = sign copies above the field, PRESERVE = old bits kept. A byte or word destination with PRESERVE reads its incoming VGPR on first use. The synthetic `sdwa_bary_input.asm` checks this with two raw fragment weights, following the [LLVM SDWA destination rules](https://llvm.org/docs/AMDGPUModifierSyntax.html#dst-unused). VOPC has no `dst_sel`, and GFX10 `v_cmpx` has no written destination. **Until 2026-11-20 the selects were silently ignored.** That affected 3,826 of the 13,926 translated shaders: they passed `spirv-val` but computed wrong values. GPU-checked with `runtime/test/shaders/ps_sdwa.asm` and `ps_ops.asm` (also `v_pk_fma_f16`, `v_min3_u32`, `v_max3_i32`, `v_bfe_i32`): byte/word source selects, `sext()`, `UNUSED_PRESERVE` into WORD_1 and `UNUSED_SEXT` at BYTE_2 all match on every pixel. **Measured natively on RDNA2** (gfx1036 iGPU, `tools/hw_oracle`, the game's MODE): all 172 distinct SDWA forms of the 26,503 listings (79,307 instructions: opcode, operand kinds, sels, `sext`, neg/abs, `dst_unused`, omod), 12 operand words per source, 21,204 cases. 18,885 give the translator's word. The rest are: a 16-bit result with `dst_sel:DWORD`, where the hardware zeroes the high half and the translator keeps it (1,888, #2187); a NaN result, where the hardware keeps the input's sign and payload (826, of which 556 also fall in the first group, so the groups add up to 21,204; as in the f16 transcendentals row); `div:2` on -0, which gives +0 (1, as in the output-modifier rows); and 160 cases whose translation is undefined in SPIR-V (`FClamp`/`FDiv`/`Sqrt` on NaN, zero or negative operands). `tests/semantic/test_alu_sdwa_hw.py` replays 624 of the matching words, up to four per form. | | VOP3 output and source modifiers in the game's forms, on RDNA2 | Every distinct float VALU form in the 26,503 listings that carries `clamp`, an omod (`mul:2`/`mul:4`/`div:2`), `op_sel`/`op_sel_hi` or neg/abs: 572 forms, 1,270,932 instructions (`v_mul_legacy_f32 … clamp` alone is 147,499; `v_fma_mix_f32` has 222 forms), up to 120 random operand triples each, run natively on gfx1036 (`tools/hw_oracle`, the game's MODE) and through the translator: 542 forms, 64,802 cases (the GFX10.1-only `v_mad_f32`/`v_mad_legacy_f32`/`v_mac_f32` and `v_permlanex16` are left out). 51,761 give the translator's word. The rest are differences already on record: NaN sign and payload (5,074); f32 denormal operands or results, and a denormal intermediate that the hardware flushes before the omod or clamp (1,178; SHADER-377); an omod turning a -0 result into +0 (121; the Output modifiers rows, #1281); 1 ulp or the known sin/cos precision in `v_rcp/v_rcp_iflag/v_log/v_sin/v_cos` with an omod (56); and 6,430 whose translation is undefined in SPIR-V, mostly `FClamp` of a NaN, where the hardware gives +0 under DX10_CLAMP (#2437). 182 cases were my harness's (three distinct SGPRs, over GFX10's two-read limit). No other modifier difference. `tests/semantic/test_alu_vop3_mods_hw.py` replays 1,616 matching words, up to three per form; it fails without `clamp` (326 rows) or without the omod (237). | diff --git a/runtime/test/shaders/check.py b/runtime/test/shaders/check.py index 7b37772874..f9891fda24 100644 --- a/runtime/test/shaders/check.py +++ b/runtime/test/shaders/check.py @@ -597,6 +597,17 @@ def heap_init_env(): # 3D image atomics: the data register afterwards (sint image) and the six texels afterwards (volume) "cs_imgatomic3d": ({}, dict(enumerate([0x101, 0xDB, 0xF4, 0xCE, 0xE6, 0xFF])), {57: 0x111, 19: 3, 44: 0xF4, 6: 0xD00D, 30: 0xE6, 39: 0x10}), + # GPU-IMG-ATOMIC-EXT: swap, inc, dec, fmin, fmax and fcmpswap. The 2D cases' texels afterwards (uint image, with the + # four that all 64 threads hit at 40..43), the data registers afterwards (sint image: 2D cases at 0..20, 3D cases + # at 32..37) and the 3D cases' texels afterwards (volume) + "cs_imgatomic_ext": ({0: 0x12345678, 1: 0xABCDEF01, 2: 0, 3: 0x68, 4: 0, 5: 0x68, 6: 0x32, 7: 9, 8: 0x6D, + 9: 0x3FC00000, 10: 0xC0400000, 11: 0x40200000, 12: 0x3FC00000, 13: 0x3FC00000, + 14: 0x3FC00000, 15: 0x40490FDB, 16: 0x3FC00000, 17: 0x3F800000, 18: 0x7FC00000, + 19: 0x78, 20: 0x77, 40: 0xCC, 41: 0x4D, 42: 0x427C0000, 43: 0xC27C0000}, + {0: 0x64, 1: 0xABCDEF01, 2: 0x66, 3: 0x67, 4: 0x68, 5: 0x69, 6: 0x6A, 7: 0, 8: 0x1F4, + **dict.fromkeys(range(9, 17), 0x3FC00000), 17: 0, 18: 0x7FC00000, 19: 0x77, 20: 0x78, + 32: 0x101, 33: 0xDB, 34: 0xF4, 35: 0x3FC00000, 36: 0x3FC00000, 37: 0x3FC00000}, + {6: 0xC0400000, 19: 0xDC, 30: 0x40200000, 39: 0x40490FDB, 44: 0x64, 57: 0x0BADF00D}), # image_get_resinfo on a 16x4 image with five levels: (width, height, depth, levels) of levels 0, 1 and 3, then # width and height of level 2 and an untouched register, height and levels of level 1, the levels alone, and # level 5, past the last (2D depth 0 and the past-the-end zeros measured on RDNA2, SHADER-388) diff --git a/runtime/test/shaders/cs_imgatomic_ext.asm b/runtime/test/shaders/cs_imgatomic_ext.asm new file mode 100644 index 0000000000..e58ecbcb60 --- /dev/null +++ b/runtime/test/shaders/cs_imgatomic_ext.asm @@ -0,0 +1,313 @@ +; The six image atomics that cs_imgatomic.asm and cs_imgatomic3d.asm don't run: image_atomic_swap, inc, dec, fmin, fmax +; and fcmpswap, on the 2D r32 uint image (binding 4) and the 3D r32 uint volume (binding 7) (GPU-IMG-ATOMIC-EXT). +; RDNA2 ISA (MIMG), M = the texel before the op, D = the data register, C = the comparand (fcmpswap's second data +; register): swap writes D; inc writes (M >= D) ? 0 : M + 1 and dec (M == 0 || M > D) ? D : M - 1, both compares +; unsigned (cases 19 and 20 have a D that is negative as a signed number); fmin and fmax write the smaller / larger +; of M and D as floats; fcmpswap writes D where M equals C as floats (never with a NaN, +0 equals -0). With glc the +; data register returns M; without glc it is left alone. The cases avoid what the ISA and SPIR-V leave open: no NaN +; in memory for fmin/fmax (the ISA's compare and GLSL NMin differ there), no fmin/fmax of +0 against -0 (NMin may +; return either), and no denormals (RDNA2's flush behaviour is unmeasured). +; Run: vk_store_test cs_imgatomic_ext.spv words. The tool fills the uint image (T# 0x2000...) with M = 100 + i at +; texel i = 8y + x, the sint image (T# 0x3000...) with -2i and the volume (T# 0x5000...) with 200 + i at +; i = 16z + 4y + x. 1.5 = 0x3fc00000, 2.5 = 0x40200000, -3.0 = 0xc0400000, 2.0 = 0x40000000, 1.0 = 0x3f800000, +; pi = 0x40490fdb, NaN = 0x7fc00000. +; First, all 64 threads (no glc), each on one shared texel: inc with D = 0xffffffff on texel 40 (140 + 64 = 0xcc), +; dec with D = 0xffffffff on 41 (141 - 64 = 0x4d), fmax with D = float(t) on 42 (63.0 = 0x427c0000), fmin with +; D = -float(t) on 43 (-63.0 = 0xc27c0000); the fills there are small positive denormals as floats, below every D +; of fmax but 0.0 and above every D of fmin, so the result does not depend on them. Then every lane sets the trap: +; coordinates (2, 3, 3) and data 1 in every data register. After that only thread 0 is on, so the 63 inactive lanes +; keep the trap: an op they ran anyway would land on uint texel 26 or volume texel 62 (swap writes 1 there; the +; fills, 126 and 262, must survive), and an inc applied by every lane would show in its case. 2D case c works on +; uint texel c and stores its data register afterwards into sint texel c; "preset" is what a swap without glc +; puts in the texel first. +; c op D C glc M (preset) uint word c afterwards sint word c +; 0 swap 0x12345678 - yes 100 0x12345678 0x00000064 +; 1 swap 0xabcdef01 - no 101 0xabcdef01 0xabcdef01 +; 2 inc 102 - yes 102 0x00000000 0x00000066 +; 3 inc 200 - yes 103 0x00000068 0x00000067 +; 4 inc 50 - yes 104 0x00000000 0x00000068 +; 5 dec 200 - yes 105 0x00000068 0x00000069 +; 6 dec 50 - yes 106 0x00000032 0x0000006a +; 7 dec 9 - yes 0 (preset) 0x00000009 0x00000000 +; 8 inc 500 - no 108 0x0000006d 0x000001f4 +; 9 fmin 2.5 - yes 1.5 (preset) 0x3fc00000 0x3fc00000 +; 10 fmin -3.0 - yes 1.5 (preset) 0xc0400000 0x3fc00000 +; 11 fmax 2.5 - yes 1.5 (preset) 0x40200000 0x3fc00000 +; 12 fmax -3.0 - yes 1.5 (preset) 0x3fc00000 0x3fc00000 +; 13 fmin NaN - yes 1.5 (preset) 0x3fc00000 0x3fc00000 +; 14 fmax NaN - yes 1.5 (preset) 0x3fc00000 0x3fc00000 +; 15 fcmpswap pi 1.5 yes 1.5 (preset) 0x40490fdb 0x3fc00000 +; 16 fcmpswap pi 2.0 yes 1.5 (preset) 0x3fc00000 0x3fc00000 +; 17 fcmpswap 1.0 -0.0 yes 0 (preset) 0x3f800000 0x00000000 +; 18 fcmpswap 1.0 NaN yes NaN (preset) 0x7fc00000 0x7fc00000 +; 19 inc 0xfffffff0 - yes 119 0x00000078 0x00000077 +; 20 dec 0xfffffff0 - yes 120 0x00000077 0x00000078 +; 3D case j works on volume texel i = 16z + 4y + x (three different coordinates, so a swapped pair lands elsewhere), +; always with glc, and stores its data register afterwards into sint texel 32 + j. +; j op D C (x, y, z) i V (preset) volume word i afterwards sint word 32 + j +; 0 swap 0x0badf00d - (1, 2, 3) 57 257 0x0badf00d 0x00000101 +; 1 inc 300 - (3, 0, 1) 19 219 0x000000dc 0x000000db +; 2 dec 100 - (0, 3, 2) 44 244 0x00000064 0x000000f4 +; 3 fmin -3.0 - (2, 1, 0) 6 1.5 (preset) 0xc0400000 0x3fc00000 +; 4 fmax 2.5 - (2, 3, 1) 30 1.5 (preset) 0x40200000 0x3fc00000 +; 5 fcmpswap pi 1.5 (3, 1, 2) 39 1.5 (preset) 0x40490fdb 0x3fc00000 +; Every other word keeps its fill. +s_mov_b32 s8, 0x5000 +s_mov_b32 s9, 0x1400000 +s_mov_b32 s10, 0x55 +s_mov_b32 s11, 0x55 +s_mov_b32 s12, 0x55 +s_mov_b32 s13, 0x55 +s_mov_b32 s14, 0x55 +s_mov_b32 s15, 0x55 +s_mov_b32 s16, 0x2000 +s_mov_b32 s17, 0x1400000 +s_mov_b32 s18, 0x22 +s_mov_b32 s19, 0x22 +s_mov_b32 s20, 0x22 +s_mov_b32 s21, 0x22 +s_mov_b32 s22, 0x22 +s_mov_b32 s23, 0x22 +s_mov_b32 s24, 0x3000 +s_mov_b32 s25, 0x1500000 +s_mov_b32 s26, 0x33 +s_mov_b32 s27, 0x33 +s_mov_b32 s28, 0x33 +s_mov_b32 s29, 0x33 +s_mov_b32 s30, 0x33 +s_mov_b32 s31, 0x33 +v_mov_b32_e32 v2, 5 +v_mov_b32_e32 v1, 0 +v_mov_b32_e32 v10, -1 +image_atomic_inc v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 1 +v_mov_b32_e32 v10, -1 +image_atomic_dec v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 2 +v_cvt_f32_u32_e32 v10, v0 +image_atomic_fmax v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 3 +v_cvt_f32_u32_e32 v10, v0 +v_xor_b32_e32 v10, 0x80000000, v10 +image_atomic_fmin v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 2 +v_mov_b32_e32 v2, 3 +v_mov_b32_e32 v3, 3 +v_mov_b32_e32 v6, 2 +v_mov_b32_e32 v7, 3 +v_mov_b32_e32 v10, 1 +v_mov_b32_e32 v11, 1 +v_mov_b32_e32 v12, 1 +v_cmpx_eq_u32_e32 0, v0 +v_mov_b32_e32 v1, 0 +v_mov_b32_e32 v2, 0 +v_mov_b32_e32 v10, 0x12345678 +image_atomic_swap v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 1 +v_mov_b32_e32 v2, 0 +v_mov_b32_e32 v10, 0xabcdef01 +image_atomic_swap v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 2 +v_mov_b32_e32 v2, 0 +v_mov_b32_e32 v10, 0x66 +image_atomic_inc v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 3 +v_mov_b32_e32 v2, 0 +v_mov_b32_e32 v10, 0xc8 +image_atomic_inc v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 4 +v_mov_b32_e32 v2, 0 +v_mov_b32_e32 v10, 50 +image_atomic_inc v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 5 +v_mov_b32_e32 v2, 0 +v_mov_b32_e32 v10, 0xc8 +image_atomic_dec v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 6 +v_mov_b32_e32 v2, 0 +v_mov_b32_e32 v10, 50 +image_atomic_dec v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 7 +v_mov_b32_e32 v2, 0 +v_mov_b32_e32 v12, 0 +image_atomic_swap v12, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v10, 9 +image_atomic_dec v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 0 +v_mov_b32_e32 v2, 1 +v_mov_b32_e32 v10, 0x1f4 +image_atomic_inc v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 1 +v_mov_b32_e32 v2, 1 +v_mov_b32_e32 v12, 0x3fc00000 +image_atomic_swap v12, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v10, 0x40200000 +image_atomic_fmin v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 2 +v_mov_b32_e32 v2, 1 +v_mov_b32_e32 v12, 0x3fc00000 +image_atomic_swap v12, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v10, 0xc0400000 +image_atomic_fmin v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 3 +v_mov_b32_e32 v2, 1 +v_mov_b32_e32 v12, 0x3fc00000 +image_atomic_swap v12, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v10, 0x40200000 +image_atomic_fmax v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 4 +v_mov_b32_e32 v2, 1 +v_mov_b32_e32 v12, 0x3fc00000 +image_atomic_swap v12, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v10, 0xc0400000 +image_atomic_fmax v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 5 +v_mov_b32_e32 v2, 1 +v_mov_b32_e32 v12, 0x3fc00000 +image_atomic_swap v12, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v10, 0x7fc00000 +image_atomic_fmin v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 6 +v_mov_b32_e32 v2, 1 +v_mov_b32_e32 v12, 0x3fc00000 +image_atomic_swap v12, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v10, 0x7fc00000 +image_atomic_fmax v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 7 +v_mov_b32_e32 v2, 1 +v_mov_b32_e32 v12, 0x3fc00000 +image_atomic_swap v12, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v10, 0x40490fdb +v_mov_b32_e32 v11, 0x3fc00000 +image_atomic_fcmpswap v[10:11], v[1:2], s[16:23] dmask:0x3 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 0 +v_mov_b32_e32 v2, 2 +v_mov_b32_e32 v12, 0x3fc00000 +image_atomic_swap v12, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v10, 0x40490fdb +v_mov_b32_e32 v11, 0x40000000 +image_atomic_fcmpswap v[10:11], v[1:2], s[16:23] dmask:0x3 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 1 +v_mov_b32_e32 v2, 2 +v_mov_b32_e32 v12, 0 +image_atomic_swap v12, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v10, 0x3f800000 +v_mov_b32_e32 v11, 0x80000000 +image_atomic_fcmpswap v[10:11], v[1:2], s[16:23] dmask:0x3 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 2 +v_mov_b32_e32 v2, 2 +v_mov_b32_e32 v12, 0x7fc00000 +image_atomic_swap v12, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v10, 0x3f800000 +v_mov_b32_e32 v11, 0x7fc00000 +image_atomic_fcmpswap v[10:11], v[1:2], s[16:23] dmask:0x3 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 3 +v_mov_b32_e32 v2, 2 +v_mov_b32_e32 v10, 0xfffffff0 +image_atomic_inc v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 4 +v_mov_b32_e32 v2, 2 +v_mov_b32_e32 v10, 0xfffffff0 +image_atomic_dec v10, v[1:2], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm glc +s_waitcnt vmcnt(0) +image_store v10, v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 1 +v_mov_b32_e32 v2, 2 +v_mov_b32_e32 v3, 3 +v_mov_b32_e32 v10, 0xbadf00d +image_atomic_swap v10, v[1:3], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_3D unorm glc +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0 +v_mov_b32_e32 v7, 4 +image_store v10, v[6:7], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 3 +v_mov_b32_e32 v2, 0 +v_mov_b32_e32 v3, 1 +v_mov_b32_e32 v10, 0x12c +image_atomic_inc v10, v[1:3], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_3D unorm glc +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 1 +v_mov_b32_e32 v7, 4 +image_store v10, v[6:7], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 0 +v_mov_b32_e32 v2, 3 +v_mov_b32_e32 v3, 2 +v_mov_b32_e32 v10, 0x64 +image_atomic_dec v10, v[1:3], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_3D unorm glc +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 2 +v_mov_b32_e32 v7, 4 +image_store v10, v[6:7], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 2 +v_mov_b32_e32 v2, 1 +v_mov_b32_e32 v3, 0 +v_mov_b32_e32 v12, 0x3fc00000 +image_atomic_swap v12, v[1:3], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_3D unorm +v_mov_b32_e32 v10, 0xc0400000 +image_atomic_fmin v10, v[1:3], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_3D unorm glc +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 3 +v_mov_b32_e32 v7, 4 +image_store v10, v[6:7], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 2 +v_mov_b32_e32 v2, 3 +v_mov_b32_e32 v3, 1 +v_mov_b32_e32 v12, 0x3fc00000 +image_atomic_swap v12, v[1:3], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_3D unorm +v_mov_b32_e32 v10, 0x40200000 +image_atomic_fmax v10, v[1:3], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_3D unorm glc +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 4 +v_mov_b32_e32 v7, 4 +image_store v10, v[6:7], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_mov_b32_e32 v1, 3 +v_mov_b32_e32 v2, 1 +v_mov_b32_e32 v3, 2 +v_mov_b32_e32 v12, 0x3fc00000 +image_atomic_swap v12, v[1:3], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_3D unorm +v_mov_b32_e32 v10, 0x40490fdb +v_mov_b32_e32 v11, 0x3fc00000 +image_atomic_fcmpswap v[10:11], v[1:3], s[8:15] dmask:0x3 dim:SQ_RSRC_IMG_3D unorm glc +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 5 +v_mov_b32_e32 v7, 4 +image_store v10, v[6:7], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +s_endpgm