tests: the image atomics guard accepts the folded %true when no lane can be inactive #20

Manually merged
github merged 1 commit from gh-pr/20/head into gh-pr/20/base 2026-11-26 08:40:43 +00:00
Owner

@⁠wavehs on GitHub · 2026-11-24 01:50 UTC · original
wavehs:test-image-atomics-folded-true → main · +7 −2 · 1 files · 1 commits · merged 2026-11-24 02:26 UTC

Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository has no such issue yet. This is the image-atomics half of #15; no open pull request touches tests/semantic/test_image_atomics_guard.py.

Depends on: none.

What and why

tests/semantic/test_image_atomics_guard.py fails 47 of 49 subtests on main@9ec34cdff, one of the two files that keep the semantic-tests job red:

FAIL: test_all_image_atomics_2d_and_3d_guarded_and_valid ... (op='image_atomic_add', dim='dim:SQ_RSRC_IMG_2D', glc=False)
AssertionError: OpImageTexelPointer in unguarded block %t86_do

The test models the translator's guard around OpImageTexelPointer as "a branch on an OpLoad of %active". Since #4473 the translator folds if (%active) to if (%true) when the shader writes no EXEC (no lane can be inactive), so the walker no longer finds its load and calls a guarded access unguarded.

The walker now also accepts the constant %true, and only when the module has no OpStore %active — a shader that can deactivate lanes still has to branch on the real load. Test file only; no translator change.

This patches in the old project's never-merged pr/7292 (be65e0611, same tree) against today's main; authorship is kept (kett1m), and the commit is cherry-picked with -x. Say so here and I will withdraw it in favour of a fresh one from its author.

Tested

main@9ec34cdff, macOS 15 arm64 (Apple M3 Pro), CPython 3.15.2, CPU only, no game files:

tree tests/semantic/test_image_atomics_guard.py full tests/semantic
main@9ec34cdff FAILED (failures=47) 2 files failed: this and test_exec_computed
this commit Ran 3 tests ... OK 1 file failed: test_exec_computed (#15)

python -m compileall -q make_game.py tools tests clean, python -I scripts/check_no_game_data.py tests/semantic/test_image_atomics_guard.py clean. Not run: Windows, any GPU test.

AI-assisted: yes (the patch is kett1m's; carried over and re-verified here).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: test-only.)
**@⁠wavehs** on GitHub · 2026-11-24 01:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/20) `wavehs:test-image-atomics-folded-true` → `main` · +7 −2 · 1 files · 1 commits · merged 2026-11-24 02:26 UTC Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository has no such issue yet. This is the image-atomics half of #15; no open pull request touches `tests/semantic/test_image_atomics_guard.py`. Depends on: none. ### What and why `tests/semantic/test_image_atomics_guard.py` fails 47 of 49 subtests on `main@9ec34cdff`, one of the two files that keep the `semantic-tests` job red: ``` FAIL: test_all_image_atomics_2d_and_3d_guarded_and_valid ... (op='image_atomic_add', dim='dim:SQ_RSRC_IMG_2D', glc=False) AssertionError: OpImageTexelPointer in unguarded block %t86_do ``` The test models the translator's guard around `OpImageTexelPointer` as "a branch on an `OpLoad` of `%active`". Since #4473 the translator folds `if (%active)` to `if (%true)` when the shader writes no EXEC (no lane can be inactive), so the walker no longer finds its load and calls a guarded access unguarded. The walker now also accepts the constant `%true`, and only when the module has no `OpStore %active` — a shader that can deactivate lanes still has to branch on the real load. Test file only; no translator change. This patches in the old project's never-merged `pr/7292` (`be65e0611`, same tree) against today's `main`; authorship is kept (kett1m), and the commit is cherry-picked with `-x`. Say so here and I will withdraw it in favour of a fresh one from its author. ### Tested `main@9ec34cdff`, macOS 15 arm64 (Apple M3 Pro), CPython 3.15.2, CPU only, no game files: | tree | `tests/semantic/test_image_atomics_guard.py` | full `tests/semantic` | |---|---|---| | `main@9ec34cdff` | `FAILED (failures=47)` | 2 files failed: this and `test_exec_computed` | | this commit | `Ran 3 tests ... OK` | 1 file failed: `test_exec_computed` (#15) | `python -m compileall -q make_game.py tools tests` clean, `python -I scripts/check_no_game_data.py tests/semantic/test_image_atomics_guard.py` clean. Not run: Windows, any GPU test. AI-assisted: yes (the patch is kett1m's; carried over and re-verified here). ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (Not applicable: test-only.)
main is red in this suite: 3 files, 51 failures. 47 are here. #4473 folds `if (%active)` to `if (%true)` when the
shader writes no EXEC, which is what the model says then (no lane is inactive), but find_guarded_texel_block only
accepted a branch on an OpLoad of %active.

The walker now accepts the constant, and only the constant: a module with an OpStore to %active still has to branch
on the load, so a shader that can deactivate lanes keeps the real guard.

test_image_atomics_guard: OK (3 tests). Whole suite after: 2 files failed (test_float_nan_fract,
test_image_store_d16), both separate.

(cherry picked from commit be65e06113373bcd0405818ebfa65dad18d6b5a3)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:40:42 +00:00
github manually merged commit c1bcf15f8f into gh-pr/20/base 2026-11-26 08:40:43 +00:00
Author
Owner

@⁠wavehs on GitHub · 2026-11-24 01:57 UTC · original

Provenance: this is old PR 7292 (be65e0611, kett1m), which is not among the branches kept in #17 - there is no old-pr/7292 here, and the old issue index in #18 has the red-test report as old 9870 (aelogonpin: "test_image_atomics_guard (47 failures) ... their fix PRs closed without landing"). So this is the only copy of that patch; kett1m, say the word and I will close this one for you to open.

**@⁠wavehs** on GitHub · 2026-11-24 01:57 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/20#issuecomment-7119615972) Provenance: this is old PR 7292 (`be65e0611`, kett1m), which is not among the branches kept in #17 - there is no `old-pr/7292` here, and the old issue index in #18 has the red-test report as old 9870 (`aelogonpin`: "test_image_atomics_guard (47 failures) ... their fix PRs closed without landing"). So this is the only copy of that patch; kett1m, say the word and I will close this one for you to open.
This discussion has been locked. Commenting is limited to contributors.
No description provided.