tests/semantic: green without the game or SPIRV-Tools (image atomics guard after #4473, optional spirv-val) #136

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

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


Carried over from old PR 9866 by QuentinDanblon in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9866, 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.
QuentinDanblon: 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-7116564579 (new item: semantic suite red on main without the game).

On main@2d53a805, python -I scripts/run_semantic_tests.py tests/semantic fails 4 of 459 files on a machine without llvm-mc or SPIRV-Tools. This PR fixes three of them. All three are test-side problems; no translator change.

The fourth, test_exec_computed (SHADER-1264), is a missing import: #8995's fixtures are in main (717f011a), but neither fix is. #8424 and #8353 were both closed unmerged. Either one, applied on main, makes that file pass. Not touched here; the finding is in the claim comment.

test_image_atomics_guard: red since #3559 landed

  • The file passes on #3559's own head (f02a7ea9) and fails in main from its squash (f469596f) on, with 47 failing subtests.
  • git bisect (with #3559's diff applied at each step) names #4473 (92417d59). For a program that never writes EXEC, #4473 sets exec_static_true, and Gen.active_b() returns the constant %true, so the guard is OpBranchConditional %true ....
  • That output is correct: with no EXEC write every lane is active. But find_guarded_texel_block only accepted a condition that is an OpLoad %bool %active.
  • The fixtures now start with s_mov_b32 exec_lo, 0x55555555, so the guard reads the real %active again, which is what the tests mean to check.
  • A new test, test_no_exec_write_guards_with_static_true, covers #4473's constant form on its own. Without an EXEC write, %active is never loaded, and the atomic sits in a block guarded by %true.
  • Mutation: replacing the atomic guard's self.active_b() with "%true" in tools/rdna2spirv.py (the if (active) block around OpImageTexelPointer) makes 37 subtests fail. With the source restored, all pass.

Tests that need SPIRV-Tools when it is optional

  • test_sopc_validation and test_unary_f16_validation failed when spirv-as / spirv-val are not on PATH. AGENTS.md says the suite needs none.
  • They now skip only the spirv-val step, as test_active_cache and test_reg_ptr_hoist do. The translation and interpreter checks still run.
  • With LEONIDA_REQUIRE_SPIRV_TOOLS=1 they still fail without the tools (checked).
  • test_active_cache and test_reg_ptr_hoist read the variable for truthiness. The "Translator semantic tests" step in ci.yml sets it to 0 on its non-Linux runners, which counted as "required". They now compare with "1", as test_fma_khr, test_fma_khr_f64 and test_spirv_tools_required already do.

Tested

  • Windows 11 Pro (26300), Python 3.13, no llvm-mc, no SPIRV-Tools, no GPU involved (these are CPU tests).
  • python -I scripts/run_semantic_tests.py tests/semantic: 459 files, 6,047 tests, 1 file failed: test_exec_computed only (the missing SHADER-1264 import above). Before this PR, 4 files failed.
  • python -m compileall -q make_game.py tools tests: clean.
  • The spirv-val step of the touched tests was not run here (no SPIRV-Tools); CI's Linux leg runs it with LEONIDA_REQUIRE_SPIRV_TOOLS=1.

No game data, nothing from the executable or the package. AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464911061 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/136). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:25:49Z. --- > Carried over from **old PR 9866** by `QuentinDanblon` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9866`, 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. > `QuentinDanblon`: 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-7116564579 (new item: semantic suite red on `main` without the game). On `main@2d53a805`, `python -I scripts/run_semantic_tests.py tests/semantic` fails 4 of 459 files on a machine without llvm-mc or SPIRV-Tools. This PR fixes three of them. All three are test-side problems; no translator change. The fourth, `test_exec_computed` (SHADER-1264), is a missing import: `#8995`'s fixtures are in `main` (`717f011a`), but neither fix is. `#8424` and `#8353` were both closed unmerged. Either one, applied on `main`, makes that file pass. Not touched here; the finding is in the claim comment. ### `test_image_atomics_guard`: red since `#3559` landed - The file passes on `#3559`'s own head (`f02a7ea9`) and fails in `main` from its squash (`f469596f`) on, with 47 failing subtests. - `git bisect` (with `#3559`'s diff applied at each step) names `#4473` (`92417d59`). For a program that never writes EXEC, `#4473` sets `exec_static_true`, and `Gen.active_b()` returns the constant `%true`, so the guard is `OpBranchConditional %true ...`. - That output is correct: with no EXEC write every lane is active. But `find_guarded_texel_block` only accepted a condition that is an `OpLoad %bool %active`. - The fixtures now start with `s_mov_b32 exec_lo, 0x55555555`, so the guard reads the real `%active` again, which is what the tests mean to check. - A new test, `test_no_exec_write_guards_with_static_true`, covers `#4473`'s constant form on its own. Without an EXEC write, `%active` is never loaded, and the atomic sits in a block guarded by `%true`. - Mutation: replacing the atomic guard's `self.active_b()` with `"%true"` in `tools/rdna2spirv.py` (the `if (active)` block around `OpImageTexelPointer`) makes 37 subtests fail. With the source restored, all pass. ### Tests that need SPIRV-Tools when it is optional - `test_sopc_validation` and `test_unary_f16_validation` failed when `spirv-as` / `spirv-val` are not on PATH. AGENTS.md says the suite needs none. - They now skip only the `spirv-val` step, as `test_active_cache` and `test_reg_ptr_hoist` do. The translation and interpreter checks still run. - With `LEONIDA_REQUIRE_SPIRV_TOOLS=1` they still fail without the tools (checked). - `test_active_cache` and `test_reg_ptr_hoist` read the variable for truthiness. The "Translator semantic tests" step in `ci.yml` sets it to `0` on its non-Linux runners, which counted as "required". They now compare with `"1"`, as `test_fma_khr`, `test_fma_khr_f64` and `test_spirv_tools_required` already do. ### Tested - Windows 11 Pro (26300), Python 3.13, no llvm-mc, no SPIRV-Tools, no GPU involved (these are CPU tests). - `python -I scripts/run_semantic_tests.py tests/semantic`: 459 files, 6,047 tests, 1 file failed: `test_exec_computed` only (the missing SHADER-1264 import above). Before this PR, 4 files failed. - `python -m compileall -q make_game.py tools tests`: clean. - The `spirv-val` step of the touched tests was not run here (no SPIRV-Tools); CI's Linux leg runs it with `LEONIDA_REQUIRE_SPIRV_TOOLS=1`. No game data, nothing from the executable or the package. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ItsMrDubey commented 2026-11-24 02:50:40 +00:00 (Migrated from github.com)

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


A suggestion for the spirv-val half, from working on the same four files (TEST-SPIRV-TOOLS-SKIP in #14; I'm not opening a second pull request for it).

Here, when SPIRV-Tools is missing, the spirv-val step returns early and the test reports a pass. A machine without the tools then can't tell "validated" from "not validated". An alternative is to move each spirv-val check into its own test method that skipTests without the tools. The interpreter and translation checks of the same programs keep running everywhere, and the skip shows in the count. scripts/run_semantic_tests.py already counts a skip as a pass, so the job stays green. CI still enforces the tools on the Linux leg through tests/semantic/test_spirv_tools_required.py.

Two smaller things in the same change:

  • LEONIDA_REQUIRE_SPIRV_TOOLS means "required" only when it is "1". ci.yml sets it to 0 on the Windows leg, and the old truthiness check made both files fail there.
  • run_semantic_tests.py prints the number of skipped tests in its summary line (test in tests/test_run_semantic_tests.py).

It's one commit on top of 9ec34cdff, if you want to take any of it: ItsMrDubey:semantic-skip-without-spirv-tools @ 1fd211c. On Windows 11 without SPIRV-Tools, the semantic suite goes from 463 files / 6075 tests / 4 files failed to 6078 tests (89 skipped) / 2 files failed. The two left are test_exec_computed (#24) and test_image_atomics_guard, which this pull request fixes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7120530858 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/136#issuecomment-7120530858). Originally posted by [ItsMrDubey](https://github.com/ItsMrDubey) on 2026-11-24T02:50:40Z. --- A suggestion for the spirv-val half, from working on the same four files (TEST-SPIRV-TOOLS-SKIP in #14; I'm not opening a second pull request for it). Here, when SPIRV-Tools is missing, the spirv-val step returns early and the test reports a pass. A machine without the tools then can't tell "validated" from "not validated". An alternative is to move each spirv-val check into its own test method that `skipTest`s without the tools. The interpreter and translation checks of the same programs keep running everywhere, and the skip shows in the count. `scripts/run_semantic_tests.py` already counts a skip as a pass, so the job stays green. CI still enforces the tools on the Linux leg through `tests/semantic/test_spirv_tools_required.py`. Two smaller things in the same change: - `LEONIDA_REQUIRE_SPIRV_TOOLS` means "required" only when it is `"1"`. `ci.yml` sets it to `0` on the Windows leg, and the old truthiness check made both files fail there. - `run_semantic_tests.py` prints the number of skipped tests in its summary line (test in `tests/test_run_semantic_tests.py`). It's one commit on top of `9ec34cdff`, if you want to take any of it: [`ItsMrDubey:semantic-skip-without-spirv-tools` @ 1fd211c](https://github.com/ItsMrDubey/leonida/commit/1fd211c). On Windows 11 without SPIRV-Tools, the semantic suite goes from 463 files / 6075 tests / 4 files failed to 6078 tests (89 skipped) / 2 files failed. The two left are `test_exec_computed` (#24) and `test_image_atomics_guard`, which this pull request fixes.
wavehs commented 2026-11-24 02:54:35 +00:00 (Migrated from github.com)

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


This branch no longer merges: the conflict is tests/semantic/test_image_atomics_guard.py, which main changed twice since the branch was cut. #20 (merged) made the guard walker accept the folded %true when the shader writes no EXEC, and #117 (open) narrows EXEC in the fixture so the test exercises a real dynamic %active branch instead. This branch reworks the same 36 lines around the old %active-only requirement.

So it needs a rebase on current main; the image-atomics hunk can probably be dropped (the file is green on main now: tests/semantic is 463 files, 6075 tests, 0 failed). What still looks unique here is the SPIRV-Tools half - test_active_cache.py, test_reg_ptr_hoist.py, test_sopc_validation.py, test_unary_f16_validation.py - and those four apply cleanly.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7120592302 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/136#issuecomment-7120592302). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-24T02:54:35Z. --- This branch no longer merges: the conflict is `tests/semantic/test_image_atomics_guard.py`, which `main` changed twice since the branch was cut. #20 (merged) made the guard walker accept the folded `%true` when the shader writes no EXEC, and #117 (open) narrows EXEC in the fixture so the test exercises a real dynamic `%active` branch instead. This branch reworks the same 36 lines around the old `%active`-only requirement. So it needs a rebase on current `main`; the image-atomics hunk can probably be dropped (the file is green on `main` now: `tests/semantic` is 463 files, 6075 tests, 0 failed). What still looks unique here is the SPIRV-Tools half - `test_active_cache.py`, `test_reg_ptr_hoist.py`, `test_sopc_validation.py`, `test_unary_f16_validation.py` - and those four apply cleanly.
Headache3318 commented 2026-11-24 09:52:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Headache3318 on 2026-11-24T09:52:52Z.


Tested at your head abd6173fb: cd tests/semantic && python3 -m unittest test_image_atomics_guard -> Ran 4 tests ... OK, and the whole runner there reports 459 files, 6047 tests, 1 file failed - that one is test_exec_computed, which main has since fixed through #24 (84347bbb6).
Your guard half is now superseded. Current main (7430f59b2) does more than accept the folded constant: its helper walks the defining instructions (derived_from), accepts %true only where there is no OpStore %active at all, and ships test_dynamic_exec_keeps_the_real_active_guard plus test_a_shader_that_writes_exec_guards_on_the_load_not_the_folded_constant, which forges %true into an EXEC-writing shader and asserts the walker rejects it - which is what issue #14's TEST-ATOMIC-GUARD row asked for, so that row can be closed.
The other half no longer reproduces here either: with llvm-mc, spirv-as and spirv-val all off PATH, test_active_cache, test_reg_ptr_hoist, test_sopc_validation and test_unary_f16_validation are OK at 7430f59b2, and test_rdna2_decode just skips its parity test (1 skip, OK (skipped=1)). So unless you want to keep those four as insurance for tool-less runners, this can close rather than rebase.
AI-assisted (Hermes agent on behalf of @Headache3318): Arch Linux, 8 cores, python 3.14.9, llvm-mc 23.1.5 hidden and restored for the comparison, no game files, no GPU run.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7128015384 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/136#issuecomment-7128015384). Originally posted by [Headache3318](https://github.com/Headache3318) on 2026-11-24T09:52:52Z. --- Tested at your head `abd6173fb`: `cd tests/semantic && python3 -m unittest test_image_atomics_guard` -> `Ran 4 tests ... OK`, and the whole runner there reports `459 files, 6047 tests, 1 file failed` - that one is `test_exec_computed`, which `main` has since fixed through #24 (`84347bbb6`). Your guard half is now superseded. Current `main` (`7430f59b2`) does more than accept the folded constant: its helper walks the defining instructions (`derived_from`), accepts `%true` only where there is no `OpStore %active` at all, and ships `test_dynamic_exec_keeps_the_real_active_guard` plus `test_a_shader_that_writes_exec_guards_on_the_load_not_the_folded_constant`, which forges `%true` into an EXEC-writing shader and asserts the walker rejects it - which is what issue #14's `TEST-ATOMIC-GUARD` row asked for, so that row can be closed. The other half no longer reproduces here either: with `llvm-mc`, `spirv-as` and `spirv-val` all off PATH, `test_active_cache`, `test_reg_ptr_hoist`, `test_sopc_validation` and `test_unary_f16_validation` are OK at `7430f59b2`, and `test_rdna2_decode` just skips its parity test (1 skip, `OK (skipped=1)`). So unless you want to keep those four as insurance for tool-less runners, this can close rather than rebase. **AI-assisted** (Hermes agent on behalf of @Headache3318): Arch Linux, 8 cores, python 3.14.9, llvm-mc 23.1.5 hidden and restored for the comparison, no game files, no GPU run.
kirigayakazima commented 2026-11-24 11:37:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-24T11:37:44Z.


Factual cross-reference on Windows 11 main (21625bca, spirv-as/spirv-val absent): test_active_cache.py (9/9) and test_reg_ptr_hoist.py (5/5) pass, whereas test_sopc_validation.py (1 fail) and test_unary_f16_validation.py (15 subtest failures) still failed on main (unlike #136's earlier Linux run). Opened #676 implementing @ItsMrDubey's skipTest / LEONIDA_REQUIRE_SPIRV_TOOLS suggestion cleanly on main. (AI-assisted)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7130342906 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/136#issuecomment-7130342906). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-24T11:37:44Z. --- Factual cross-reference on Windows 11 `main` (`21625bca`, `spirv-as`/`spirv-val` absent): `test_active_cache.py` (9/9) and `test_reg_ptr_hoist.py` (5/5) pass, whereas `test_sopc_validation.py` (1 fail) and `test_unary_f16_validation.py` (15 subtest failures) still failed on `main` (unlike #136's earlier Linux run). Opened #676 implementing @ItsMrDubey's `skipTest` / `LEONIDA_REQUIRE_SPIRV_TOOLS` suggestion cleanly on `main`. (AI-assisted)
MoonEyes commented 2026-11-24 16:02:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-24T16:02:46Z.


Measured side by side with #676 and #940 in https://github.com/ubiquitarianism/leonida/pull/676#issuecomment-7137025630. This is the only PR that fixes the LEONIDA_REQUIRE_SPIRV_TOOLS=0 case (== "1" in test_active_cache and test_reg_ptr_hoist), which is what makes main's Windows semantic-tests job red (run 45369028646). I confirmed it on Windows. The test_image_atomics_guard half is already on main through #20, #394 and #460, and the conflict is in that file. Rebased down to those two lines, it would be a one-commit fix.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7137031204 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/136#issuecomment-7137031204). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-24T16:02:46Z. --- Measured side by side with #676 and #940 in https://github.com/ubiquitarianism/leonida/pull/676#issuecomment-7137025630. This is the only PR that fixes the `LEONIDA_REQUIRE_SPIRV_TOOLS=0` case (`== "1"` in `test_active_cache` and `test_reg_ptr_hoist`), which is what makes main's Windows `semantic-tests` job red (run 45369028646). I confirmed it on Windows. The `test_image_atomics_guard` half is already on main through #20, #394 and #460, and the conflict is in that file. Rebased down to those two lines, it would be a one-commit fix.
MoonEyes commented 2026-11-24 17:39:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-24T17:39:39Z.


Question for the carry-over owner and for @QuentinDanblon: is anyone planning to rebase this down to the two == "1" lines in test_active_cache.py and test_reg_ptr_hoist.py? They are what keeps test_active_cache and test_reg_ptr_hoist red in main's Windows semantic-tests job, which sets the variable to 0 (run 45369028646 failed on those two plus test_sopc_validation and test_unary_f16_validation, which #676 / #940 address; see https://github.com/ubiquitarianism/leonida/pull/676#issuecomment-7137025630). If nobody objects within a day, I will claim it in #14 as a small separate PR, credit this one, and leave #136 for its authors to close.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7139519633 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/136#issuecomment-7139519633). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-24T17:39:39Z. --- Question for the carry-over owner and for @QuentinDanblon: is anyone planning to rebase this down to the two `== "1"` lines in `test_active_cache.py` and `test_reg_ptr_hoist.py`? They are what keeps `test_active_cache` and `test_reg_ptr_hoist` red in main's Windows `semantic-tests` job, which sets the variable to `0` (run 45369028646 failed on those two plus `test_sopc_validation` and `test_unary_f16_validation`, which #676 / #940 address; see https://github.com/ubiquitarianism/leonida/pull/676#issuecomment-7137025630). If nobody objects within a day, I will claim it in #14 as a small separate PR, credit this one, and leave #136 for its authors to close.
MoonEyes commented 2026-11-30 19:09:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T19:09:32Z.


Closing as superseded by current main. All five behavior changes are now present: test_active_cache.py and test_reg_ptr_hoist.py require the exact value "1"; optional SPIRV-Tools validation is handled in test_sopc_validation.py and test_unary_f16_validation.py; and the image-atomic guard suite now has stronger constant-true and dynamic-EXEC regression coverage. Those changes landed through #676, #940, and the later guard work. This branch is still a draft with conflicts and cancelled checks, so it needs no merge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7288933549 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/136#issuecomment-7288933549). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T19:09:32Z. --- Closing as superseded by current `main`. All five behavior changes are now present: `test_active_cache.py` and `test_reg_ptr_hoist.py` require the exact value `"1"`; optional SPIRV-Tools validation is handled in `test_sopc_validation.py` and `test_unary_f16_validation.py`; and the image-atomic guard suite now has stronger constant-true and dynamic-EXEC regression coverage. Those changes landed through #676, #940, and the later guard work. This branch is still a draft with conflicts and cancelled checks, so it needs no merge.
MoonEyes commented 2026-11-30 19:09:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T19:09:34Z.


Superseded by current main; all five changed behaviors are already covered.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7288934527 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/136#issuecomment-7288934527). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T19:09:34Z. --- Superseded by current main; all five changed behaviors are already covered.

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