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

Merged
wavehs merged 1 commit from upstream-pr/20 into main 2026-11-24 02:26:11 +00:00
wavehs commented 2026-11-24 01:50:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-24T01:50:56Z.


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.)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464550187 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/20). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-24T01:50:56Z. --- 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.)
wavehs commented 2026-11-24 01:57:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-24T01:57:30Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7119615972 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/20#issuecomment-7119615972). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-24T01:57:30Z. --- 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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!20
No description provided.