[PR #1275] [CLOSED] tests: run raw buffer atomics addressed by soffset alone (TEST-ATOMIC-SOFFSET-BOUNDS) #1306

Closed
opened 2026-11-26 20:20:48 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1275
Author: @Moriz82
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: split/test-atomic-soffset-bounds


📝 Commits (1)

  • c53551d tests: run raw buffer atomics addressed by soffset alone (TEST-ATOMIC-SOFFSET-BOUNDS)

📊 Changes

1 file changed (+29 additions, -12 deletions)

View changed files

📝 tests/semantic/test_buffer_atomic_fminmax_and_align.py (+29 -12)

📄 Description

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) tests soffset for loads and stores, not for atomics. None of the current diffs of #850, #1039 and #1068 adds a buffer atomic with a non-zero soffset.

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 pass 0 as soffset. The address and bounds code is shared with loads and stores, which do test soffset, 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_only addresses a raw V# through soffset alone, with no vaddr and 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 of docs/buffer_bounds.md, offset + soffset + size > NUM_RECORDS: with NUM_RECORDS = soffset + size the element is updated and glc returns the old value, and one byte short it is left alone and glc returns 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.
  • Mutation, to show what the test adds: with soffset dropped at the three atomic call sites of Gen.buffer_address (a replaced by a[:3]), python3 -I scripts/run_semantic_tests.py tests/semantic -j 2 ran 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 2 on the branch as committed: 470 files, 6,169 tests, 0 files failed (the base: 470 files, 6,168 tests, 0 failed).
  • The standard-library and pytest files under tests/ the way ci.yml runs them, and python3 -I -m compileall -q make_game.py tools tests: 520 files, 519 pass. tests/test_imhex_patterns.py fails (6 of its 9 tests) and fails the same way on the base commit, so it is not from this change. compileall passes.
  • python3 -I scripts/check_no_game_data.py: passes.
  • spirv-as and spirv-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), the tools/hw_oracle probe, 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

  • Based on upstream main 6293c1c4f, one commit, one file.
  • One topic: one test.
  • No game data, keys or decryption, including in logs or reports quoted here.
  • No new translator rule: the test pins the documented raw bound for an operand form that had no test.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1275 **Author:** [@Moriz82](https://github.com/Moriz82) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `split/test-atomic-soffset-bounds` --- ### 📝 Commits (1) - [`c53551d`](https://github.com/ubiquitarianism/leonida/commit/c53551d6b627d5b21802de58b4a48b8068a8fc6f) tests: run raw buffer atomics addressed by soffset alone (TEST-ATOMIC-SOFFSET-BOUNDS) ### 📊 Changes **1 file changed** (+29 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `tests/semantic/test_buffer_atomic_fminmax_and_align.py` (+29 -12) </details> ### 📄 Description Claimed in the coordination issue as: TEST-ATOMIC-SOFFSET-BOUNDS ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7144600523)). 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) tests `soffset` for loads and stores, not for atomics. None of the current diffs of #850, #1039 and #1068 adds a buffer atomic with a non-zero `soffset`. ### 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 pass `0` as `soffset`. The address and bounds code is shared with loads and stores, which do test `soffset`, 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_only` addresses a raw V# through `soffset` alone, with no `vaddr` and 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 of `docs/buffer_bounds.md`, `offset + soffset + size > NUM_RECORDS`: with `NUM_RECORDS = soffset + size` the element is updated and `glc` returns the old value, and one byte short it is left alone and `glc` returns 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. - Mutation, to show what the test adds: with `soffset` dropped at the three atomic call sites of `Gen.buffer_address` (`a` replaced by `a[:3]`), `python3 -I scripts/run_semantic_tests.py tests/semantic -j 2` ran 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 2` on the branch as committed: 470 files, 6,169 tests, 0 files failed (the base: 470 files, 6,168 tests, 0 failed). - The standard-library and pytest files under `tests/` the way `ci.yml` runs them, and `python3 -I -m compileall -q make_game.py tools tests`: 520 files, 519 pass. `tests/test_imhex_patterns.py` fails (6 of its 9 tests) and fails the same way on the base commit, so it is not from this change. `compileall` passes. - `python3 -I scripts/check_no_game_data.py`: passes. - `spirv-as` and `spirv-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), the `tools/hw_oracle` probe, 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 - [x] Based on upstream main `6293c1c4f`, one commit, one file. - [x] One topic: one test. - [x] No game data, keys or decryption, including in logs or reports quoted here. - [x] No new translator rule: the test pins the documented raw bound for an operand form that had no test. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:20:48 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1306
No description provided.