[PR #394] [MERGED] tests: image atomics guard keeps a dynamic EXEC case #445

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/394
Author: @Okamizs
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: test-image-atomics-dynamic-exec


📝 Commits (1)

  • b3eaa3d tests: image atomics guard keeps a dynamic EXEC case

📊 Changes

1 file changed (+41 additions, -0 deletions)

View changed files

📝 tests/semantic/test_image_atomics_guard.py (+41 -0)

📄 Description

Claimed in the coordination issue as: TEST-ATOMIC-GUARD follow-up (finding comment in #14)

What and why

Before: since #20 (by @wavehs), find_guarded_texel_block accepts the folded if (%true) guard when a shader never writes EXEC. Every case in test_image_atomics_guard.py leaves EXEC alone, so all 49 subtests take that path and the check that a lane switched off at run time skips the image atomic was never exercised.

After: a new test, test_dynamic_exec_keeps_the_real_active_guard, switches lanes off before the atomic with v_cmp_gt_u32 + s_and_saveexec_b32 and with v_cmpx_gt_u32, covering image_atomic_add, swap, inc and cmpswap on 2D and 3D images (16 subtests). Each case asserts the module stores to %active and the atomic's block is entered through a branch on the loaded %active, then swaps that condition for %true and asserts the helper rejects it.

Test only: one file, 41 lines added. No translator change, so no new rule for docs/design.md. Builds on #20 and does not change it. Stays off SHADER-1264: the EXEC writes here come from per-lane compares, not a computed SGPR value.

Tested

  • python -m pytest tests/semantic/test_image_atomics_guard.py: before 49 subtests passed, after 65.
  • Mutation check: forcing the helper's exec_is_constant_true to True makes the 16 new subtests fail while the old 49 still pass.
  • python -I scripts/run_semantic_tests.py tests/semantic -j 4: 6103 tests before, 6104 after. The same 2 files failed in both runs (see limitations).
  • python -m pytest tests/test_semantic_translator_use.py: 3 passed.

Ran on the CPU only, in a Linux container with Python 3.13.

GPUs tested: n/a

Known limitations

  • Unverified: spirv-as and spirv-val weren't installed locally, so test_sopc_validation and test_unary_f16_validation failed before and after, and the new cases weren't run through spirv-val. CI has SPIRV-Tools.
  • The test checks the emitted structure, not execution, because spirv_wave_interp.py doesn't model storage images yet.
  • Wave32 forms only; no wave64 variant.

AI-assisted: yes (Claude helped write the test and this description)


🔄 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/394 **Author:** [@Okamizs](https://github.com/Okamizs) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `test-image-atomics-dynamic-exec` --- ### 📝 Commits (1) - [`b3eaa3d`](https://github.com/ubiquitarianism/leonida/commit/b3eaa3d7b05e10384b3a89e584a40b32eb9eea5c) tests: image atomics guard keeps a dynamic EXEC case ### 📊 Changes **1 file changed** (+41 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/semantic/test_image_atomics_guard.py` (+41 -0) </details> ### 📄 Description Claimed in the coordination issue as: TEST-ATOMIC-GUARD follow-up (finding comment in #14) ### What and why Before: since #20 (by @wavehs), `find_guarded_texel_block` accepts the folded `if (%true)` guard when a shader never writes EXEC. Every case in `test_image_atomics_guard.py` leaves EXEC alone, so all 49 subtests take that path and the check that a lane switched off at run time skips the image atomic was never exercised. After: a new test, `test_dynamic_exec_keeps_the_real_active_guard`, switches lanes off before the atomic with `v_cmp_gt_u32` + `s_and_saveexec_b32` and with `v_cmpx_gt_u32`, covering `image_atomic_add`, `swap`, `inc` and `cmpswap` on 2D and 3D images (16 subtests). Each case asserts the module stores to `%active` and the atomic's block is entered through a branch on the loaded `%active`, then swaps that condition for `%true` and asserts the helper rejects it. Test only: one file, 41 lines added. No translator change, so no new rule for `docs/design.md`. Builds on #20 and does not change it. Stays off SHADER-1264: the EXEC writes here come from per-lane compares, not a computed SGPR value. ### Tested - `python -m pytest tests/semantic/test_image_atomics_guard.py`: before 49 subtests passed, after 65. - Mutation check: forcing the helper's `exec_is_constant_true` to `True` makes the 16 new subtests fail while the old 49 still pass. - `python -I scripts/run_semantic_tests.py tests/semantic -j 4`: 6103 tests before, 6104 after. The same 2 files failed in both runs (see limitations). - `python -m pytest tests/test_semantic_translator_use.py`: 3 passed. Ran on the CPU only, in a Linux container with Python 3.13. GPUs tested: n/a ### Known limitations - Unverified: `spirv-as` and `spirv-val` weren't installed locally, so `test_sopc_validation` and `test_unary_f16_validation` failed before and after, and the new cases weren't run through `spirv-val`. CI has SPIRV-Tools. - The test checks the emitted structure, not execution, because `spirv_wave_interp.py` doesn't model storage images yet. - Wave32 forms only; no wave64 variant. AI-assisted: yes (Claude helped write the test and this description) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:54 +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#445
No description provided.