Skip to content

GPU fixtures: the six remaining 2D image atomics - #4981

Open
YaBulochka wants to merge 1 commit into
ItsNotRexed:mainfrom
YaBulochka:docs/contract-gaps
Open

YaBulochka wants to merge 1 commit into
ItsNotRexed:mainfrom
YaBulochka:docs/contract-gaps

Conversation

@YaBulochka

Copy link
Copy Markdown
Contributor

The 2D image atomics row still had six ops with no GPU fixture: image_atomic_swap, _inc, _dec, _fmin, _fmax and _fcmpswap. cs_imgatomic covers the other six; this adds the rest in one vk_store_test dump.

runtime/test/shaders/cs_imgatomic_ext.asm runs each op on its own texel 0-7 of an r32ui 2D storage image and writes the returned old word into the matching texel of a second sint image, so one read checks both memory and the glc return. The cases include:

  • swap with 0xdeadbeef;
  • inc from 200 with a bound of 101 (101 < 200 -> 102) and dec from 102 with a bound of 100 (102 > 100 -> 100);
  • fmin(2.0, 1.0), fmax(1.0, 3.0);
  • fcmpswap hit (1.0 -> 2.0) and miss (leaves 0x6a);
  • fmin(NaN, 2.0) returning the NaN bits as the old value.

Float texels are seeded by a preceding swap so the comparator input is a normal value, not the harness fill.

Measured on the RDNA2 iGPU (gfx1036, RADV RAPHAEL_MENDOCINO, Mesa 27.0.0-devel), exact:

uint:   deadbeef 00000066 00000064 3f800000 40400000 40000000 0000006a 40000000
sint:   00000064 00000065 00000066 40000000 3f800000 3f800000 0000006a 7fc00000
volume: unchanged

run_gpu_tests.py --filter cs_imgatomic_ext is 1/1; the full iGPU run is 203 passed, 15 skipped, 0 failed; build.py translates and validates all 243 shaders. The new test_imgatomic_ext_fixture.py models all words independently from the ISA and checks the six lowering shapes; regen_fixtures --check and the docs row-shape tests pass.

Docs: row 391 (image atomics) now names this fixture and the measured result; the subnormal-flush caveat stays because the fixture deliberately does not exercise it. No translator change.

@SphyserX

SphyserX commented Nov 23, 2026 •

Copy link
Copy Markdown

Tested 24cc3da on Arch Linux (in a VM), Mesa llvmpipe (LLVM 23.1.5, subgroup 8), runtime built from main 3faac55: pass.

  • run_gpu_tests.py --filter cs_imgatomic: 3 of 3 pass, including cs_imgatomic_ext ("all 64 words of the uint image, the sint image and the volume exact"), so llvmpipe agrees with your gfx1036 words.
  • pytest tests/semantic/test_imgatomic_ext_fixture.py: 4 passed, 8 subtests. regen_fixtures.py --check: exit 0.
  • Expected words read against the ISA: inc 101 with bound 200 → 102, dec 102 with bound 100 → 100 (the bound, since 102 > 100), and fmin(NaN, 2.0) stores 2.0 and returns the NaN as the old value. All three match the dump. (The PR text says "inc from 200 with a bound of 101", but the .asm runs image_atomic_inc with DATA 200 on the fill value 101, and the dump returns 101 as the old value. So the fixture is right and only the sentence is swapped.)

@gertify

gertify commented Nov 23, 2026

Copy link
Copy Markdown

Tested 24cc3da on Intel UHD 630 (CFL GT2), Mesa 25.2.8 ANV, Ubuntu 24.04, LEONIDA_VK_DEVICE=Intel: pass.

  • scripts/run_gpu_tests.py --filter cs_imgatomic_ext: PASS cs_imgatomic_ext, all 64 words of the uint image, the sint image and the volume exact; 1/1 passed. The same command with LEONIDA_VK_DEVICE=NoSuchDevice fails with "no Vulkan physical device matches", so the pass ran on the Intel device.
  • tests/semantic test_imgatomic_ext_fixture.py: Ran 4 tests, OK. regen_fixtures.py --check: clean.

AI-assisted.

@Atomic258

Copy link
Copy Markdown
Contributor

Independent check — pass, including a live GPU fixture run on NVIDIA.

Environment: Windows 11, MSVC 19.44 (RelWithDebInfo, Ninja), NVIDIA GeForce RTX 5090 (driver 617.42), Vulkan SDK 1.4.363.0, native Windows llvm-mc (LLVM 21.1.8 + AMDGPU, built via scripts/build_llvm_mc.ps1), LEONIDA_VK_DEVICE="rtx 5090", LEONIDA_VK_VALIDATION=1. Synthetic fixtures only, no game files.

CPU side:

  • python -m unittest discover -s tests/semantic -p "test_imgatomic*" → 4/4 (independent ISA-derived model agrees with check.py's stated words; translated fixture contains the six required lowerings)
  • compileall clean on the touched Python files

GPU side (the part most checks can't do):

  • Built vk_store_test, vk_sandbox, vk_compute_test, vk_harness targets only — all compile/link clean
  • python -I scripts/run_gpu_tests.py --llvm-mc <native llvm-mc> --build runtime/build --filter cs_imgatomic_ext → 1/1 passed: "all 64 words of the uint image, the sint image and the volume exact"; the fixture translated 1/1 and passed spirv-val

This exercises the six remaining 2D image atomics (image_atomic_{swap,inc,dec,fmin,fmax,fcmpswap}) end-to-end on the newest NVIDIA arch — coverage the fixture list previously lacked.

AI-assisted (Devin).

@kotekompotek

Copy link
Copy Markdown

Independent Windows CPU verification on 24cc3da3:

  • python tests/semantic/test_imgatomic_ext_fixture.py -v: 4/4 OK

@abnalstlll-byte abnalstlll-byte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at \24cc3da3. Tested on Windows 11 with AMD RDNA2 iGPU (gfx1036):

  • \python -m unittest discover -s tests/semantic -p test_imgatomic_ext_fixture.py\ -> 4 passed, OK (0.052s).
  • \python -m unittest tests/test_docs_design_rows.py\ -> 4 passed, OK.
  • Verified all 16 expected texel/returned words in \check.py\ against RDNA2 ISA MIMG atomics (including \ cmpswap\ hit/miss and \ min(NaN, 2.0) -> 2.0).
  • Inspected \cs_imgatomic_ext.asm\ and confirmed \ ests/semantic/fixtures/disasm/cs_imgatomic_ext.s\ is present and clean.
  • \git diff --check\ clean. No game files. AI-assisted review (Gemini).

@Atomic258

Copy link
Copy Markdown
Contributor

Tested 24cc3da on Windows Server 2022, CPython 3.13.12: pass

  • python -I -m unittest discover -s tests/semantic -p "test_imgatomic_ext_fixture.py" -> Ran 4 tests, OK

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. AI-assisted (Devin).

@bunbeans2-arch

Copy link
Copy Markdown

Tested the current head 24cc3da on an AMD Radeon RX 9070 XT (RDNA4, subgroup 32..64) with AMD's Windows driver, Windows 11 23H2 (the GPU runs here so far are RADV). scripts/run_gpu_tests.py --require-pass gives 203/218 passed, 15 skipped. cs_imgatomic_ext passes: "all 64 words of the uint image, the sint image and the volume exact".

AI-assisted (Claude Code). No game files.

@jordi-vancuijlenborg-vinci

Copy link
Copy Markdown

Tested 24cc3da3 on Windows 11 build 26200 with an NVIDIA GeForce RTX 3080 (driver 621.01, Vulkan 1.4.357, subgroup size 32). Built the Vulkan test tools from the same revision with LLVM-MinGW 23.1.6.

python -I scripts/run_gpu_tests.py --filter cs_imgatomic_ext.asm --require-pass passed with 192/192 exact output words, 64 each for the unsigned integer image, signed integer image, and volume. The shader passed spirv-val, and all four focused semantic tests passed. Synthetic fixture only. AI-assisted.

@LukeOsland1

Copy link
Copy Markdown

Tested 2d2358c5e7 on Windows 11 build 26300, NVIDIA RTX 4070 Ti SUPER, driver 610.88. I used the PR’s GPU runner with LLVM 23.1.6 and the MSVC-built harness from the tested sources. The Vulkan loader was restricted to the NVIDIA ICD.

  • cs_imgatomic_ext — all 64 words of the uint image, the sint image and the volume exact.

Xbox 1.0.2.1 coverage: 0 of 26,503 local shaders.rpf listings contain at least one of the following mnemonics. Static instruction counts (combining e32/e64 spellings): image_atomic_fmin 0, image_atomic_fmax 0, image_atomic_fcmpswap 0, image_atomic_swap 0. The counts describe opcode presence. The GPU readback above uses the hand-written fixture. AI-assisted with Codex.

cs_imgatomic runs add/sub/and/or/xor/smin/smax/umin/umax and cmpswap; swap, inc, dec, fmin, fmax and
fcmpswap had CPU checks only. The new fixture runs all six on texels 0-7 of vk_store_test's r32 uint image
(fcmpswap a hit and a miss, fmin with a NaN and 2.0, fmax, unsigned inc/dec bounds) and stores each returned
old word in the same texel of the r32 sint image, so one 8-word readback checks the texel and the glc return.

check.py states the sixteen words, the .asm header derives them from the ISA, regen_fixtures.py makes the
disasm copy for tests/semantic/test_imgatomic_ext_fixture.py, which re-derives the words independently and
checks the header, check.py and the six lowerings (five swaps, CAS loops, NMin/NMax, the word-wise
fcmpswap equality). docs/design.md drops the row's "Not GPU-verified on RDNA2".

GPU: AMD Ryzen 5 9600X iGPU (gfx1036, RADV Mesa 27.0.0-devel, driver 26.99.99).
run_gpu_tests.py: 203 passed, 15 skipped, 0 failed (218 shaders).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants