Repository navigation
Conversation
…-SOFFSET-BOUNDS) No test ran a buffer atomic with a non-zero scalar offset: all 57 buffer_atomic_* instructions in the tests and the GPU fixtures pass 0 there. The three atomic lowerings (32-bit integer, float min/max, 64-bit _x2) each hand their operands to the shared address code on their own, so dropping the operand in any of them went unnoticed. Add one test that addresses the element through soffset only and checks the documented raw bound on both sides of the limit for each lowering. Test only; the translator is unchanged. The test passes on main. With soffset dropped at the three atomic call sites, the translator suite (470 files, 6,169 tests) fails in this test only, in all 6 of its subtests. On the branch the suite has 0 failing files, and of the other Python test files only tests/test_imhex_patterns.py fails, as on main. AI-assisted (Claude Code). Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ed3621b to
c53551d
Compare
|
Reviewed c53551d: test-only PR extending the soffset-only raw atomic test to the integer, float-min/max and 64-bit _x2 lowerings, on both sides of the documented raw bound. Ran the touched file on both the PR and main (11 tests OK on each; it also passes on main, matching its message), and probe-verified the added coverage: dropping soffset at the three atomic call sites fails exactly the 6 new subtests, and the old main test missed the float and _x2 drops that this one catches. Note: the intro line "No test ran a buffer atomic with a non-zero scalar offset" overstates — the replaced test already did that for Recommendation: Merge |
Claimed in the coordination issue as: TEST-ATOMIC-SOFFSET-BOUNDS (claim).
Part of the split of #984 into small pull requests.
Depends on: none
Overlaps: #984 is the parent integration. #1097 (open, SHADER-BUFFER-BOUNDS) is the runtime half of the integrated commit this test comes from; it has no translator test and this pull request has nothing of the runtime. #850 (open) edits another test of the same file,
test_spirv_emits_alignment_guard; its current diff applies cleanly on this branch. #1068 (open) testssoffsetfor loads and stores, not for atomics. None of the current diffs of #850, #1039 and #1068 adds a buffer atomic with a non-zerosoffset.What and why
Test only; the translator is not changed.
No test runs a buffer atomic with a non-zero scalar offset. The tests and the GPU fixtures hold 57
buffer_atomic_*instructions as text, and all 57 pass0assoffset. The address and bounds code is shared with loads and stores, which do testsoffset, but each of the three atomic lowerings (32-bit integer, float min/max, 64-bit_x2) hands its operands to that code at its own call site. Dropping the operand at any of the three went unnoticed by the whole translator suite (see the mutation below).test_raw_atomic_soffset_onlyaddresses a raw V# throughsoffsetalone, with novaddrand no instruction offset, once per lowering (buffer_atomic_add,buffer_atomic_fmax,buffer_atomic_swap_x2). For each it checks both sides of the raw bound ofdocs/buffer_bounds.md,offset + soffset + size > NUM_RECORDS: withNUM_RECORDS = soffset + sizethe element is updated andglcreturns the old value, and one byte short it is left alone andglcreturns 0. The words in front of the element must keep their sentinel, so an atomic that lands at the V# base instead fails as well.The expected values follow the rule the repository already documents for raw accesses. Nothing new was measured on hardware for this.
Tested
CachyOS (kernel 7.3.5), Python 3.14, SPIRV-Tools v2026.4.
python3 -I tests/semantic/test_buffer_atomic_fminmax_and_align.py: 11 tests pass (10 before, plus the new one with its 6 subtests). It passes on the base commit's translator too, as a pure test addition must.soffsetdropped at the three atomic call sites ofGen.buffer_address(areplaced bya[:3]),python3 -I scripts/run_semantic_tests.py tests/semantic -j 2ran 470 files and 6,169 tests and exactly one file failed, this one, in the 6 subtests of the new test. Its other 10 tests and the other 469 files passed, so without this test the mutation passes the whole translator suite. The mutation was applied to the working tree for that run only and is not in the branch.python3 -I scripts/run_semantic_tests.py tests/semantic -j 2on the branch as committed: 470 files, 6,169 tests, 0 files failed (the base: 470 files, 6,168 tests, 0 failed).tests/the wayci.ymlruns them, andpython3 -I -m compileall -q make_game.py tools tests: 520 files, 519 pass.tests/test_imhex_patterns.pyfails (6 of its 9 tests) and fails the same way on the base commit, so it is not from this change.compileallpasses.python3 -I scripts/check_no_game_data.py: passes.spirv-asandspirv-val --target-env vulkan1.2(SPIRV-Tools v2026.4) on the three in-range modules of the test, written out by hand: all three validate.Not run: any GPU test (there is no GPU fixture for an atomic with a
soffset, and this adds none), thetools/hw_oracleprobe, native Windows, macOS, the runtime build and a game boot.GPUs tested: n/a (CPU interpreter only).
AI-assisted: yes (Claude Code). The numbers above come from runs on the machine named.
Checklist
6293c1c4f, one commit, one file.🤖 Generated with Claude Code