tests/semantic: narrow EXEC in test_image_atomics_guard so dynamic %active guard is exercised #117

Closed
Andretuta wants to merge 1 commit from upstream-pr/117 into main
Andretuta commented 2026-11-24 02:21:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:21:35Z.


Carried over from old PR 9851 by lordon1a in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9851, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
lordon1a: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Claim: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116717748

What and why

On main@2d53a8055, tests/semantic/test_image_atomics_guard.py fails all 47 subtests (OpImageTexelPointer in unguarded block). Because none of the synthetic test shaders modify EXEC, rdna2spirv's exec_always_on optimization folds %active to constant %true, so OpBranchConditional %true is emitted instead of OpLoad %bool %active.

Prepends v_cmpx_ne_u32_e32 0, v7 in translate() so EXEC is dynamically narrowed and rdna2spirv emits the real %active guard that the test suite is designed to verify.

Verification (Windows 11 Home 26H2, CPython 3.11.9, SPIRV-Tools v2026.4, no game files)

  • Before fix (e56d97950 / 2d53a8055): python -I -m unittest discover -s tests/semantic -p test_image_atomics_guard.py -> FAILED (47 failures).
  • After fix: python -I -m unittest discover -s tests/semantic -p test_image_atomics_guard.py -v -> 3/3 tests (all 47 subtests) OK in 3.115s (including spirv-as + spirv-val --target-env vulkan1.3).
  • python -I scripts/check_no_game_data.py tests/semantic/test_image_atomics_guard.py: clean (rc=0).
  • git diff --check: clean (rc=0).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464864800 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/117). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:21:35Z. --- > Carried over from **old PR 9851** by `lordon1a` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9851`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `lordon1a`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Claim: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116717748 ### What and why On `main@2d53a8055`, `tests/semantic/test_image_atomics_guard.py` fails all 47 subtests (`OpImageTexelPointer in unguarded block`). Because none of the synthetic test shaders modify `EXEC`, `rdna2spirv`'s `exec_always_on` optimization folds `%active` to constant `%true`, so `OpBranchConditional %true` is emitted instead of `OpLoad %bool %active`. Prepends `v_cmpx_ne_u32_e32 0, v7` in `translate()` so `EXEC` is dynamically narrowed and `rdna2spirv` emits the real `%active` guard that the test suite is designed to verify. ### Verification (Windows 11 Home 26H2, CPython 3.11.9, SPIRV-Tools v2026.4, no game files) - Before fix (`e56d97950` / `2d53a8055`): `python -I -m unittest discover -s tests/semantic -p test_image_atomics_guard.py` -> **FAILED (47 failures)**. - After fix: `python -I -m unittest discover -s tests/semantic -p test_image_atomics_guard.py -v` -> **3/3 tests (all 47 subtests) OK in 3.115s** (including `spirv-as` + `spirv-val --target-env vulkan1.3`). - `python -I scripts/check_no_game_data.py tests/semantic/test_image_atomics_guard.py`: clean (`rc=0`). - `git diff --check`: clean (`rc=0`). AI-assisted.
wavehs commented 2026-11-24 02:40:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-24T02:40:11Z.


Independent check of this branch (macOS 15 arm64, CPython 3.15.2, CPU only): tests/semantic/test_image_atomics_guard.py -> Ran 3 tests ... OK. It is a smaller fix than the alternative that landed in #20 (which accepted the folded %true): this one narrows EXEC in the fixture so the test still exercises a real %active branch, which is the better of the two. Mergeable against current main.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7120368423 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/117#issuecomment-7120368423). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-24T02:40:11Z. --- Independent check of this branch (macOS 15 arm64, CPython 3.15.2, CPU only): `tests/semantic/test_image_atomics_guard.py` -> `Ran 3 tests ... OK`. It is a smaller fix than the alternative that landed in #20 (which accepted the folded `%true`): this one narrows EXEC in the fixture so the test still exercises a real `%active` branch, which is the better of the two. Mergeable against current `main`.
MoonEyes commented 2026-11-30 18:53:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T18:53:52Z.


Closing as superseded by current main's focused regression est_a_shader_that_writes_exec_guards_on_the_load_not_the_folded_constant in tests/semantic/test_image_atomics_guard.py. That test narrows EXEC within its own deterministic fixture and asserts the guard condition is derived from the active-lane load, so it directly covers the behavior this PR was intended to exercise without injecting a comparison into every test. This PR was still a draft, had cancelled checks, and had no current claim.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7288531871 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/117#issuecomment-7288531871). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T18:53:52Z. --- Closing as superseded by current main's focused regression est_a_shader_that_writes_exec_guards_on_the_load_not_the_folded_constant in tests/semantic/test_image_atomics_guard.py. That test narrows EXEC within its own deterministic fixture and asserts the guard condition is derived from the active-lane load, so it directly covers the behavior this PR was intended to exercise without injecting a comparison into every test. This PR was still a draft, had cancelled checks, and had no current claim.

Pull request closed

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!117
No description provided.