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

Open
github-bot wants to merge 1 commit from github-bot/gh-136 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:25 UTC · original
ubiquitarianism:old-pr/9866 → main · +39 −9 · 5 files · 1 commits · draft

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

**@⁠Andretuta** on GitHub · 2026-11-24 02:25 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/136) `ubiquitarianism:old-pr/9866` → `main` · +39 −9 · 5 files · 1 commits · draft > 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)
test_image_atomics_guard has failed on main since #3559 landed: #4473's
no-EXEC fast path guards the atomic with the constant %true, which the
test did not accept. The fixtures now write EXEC first, so the guard reads
%active again, and a new test covers the constant form.

test_sopc_validation and test_unary_f16_validation skip only their
spirv-val step when spirv-as / spirv-val are missing, unless
LEONIDA_REQUIRE_SPIRV_TOOLS is 1. test_active_cache and test_reg_ptr_hoist
compare that variable with "1" instead of testing it for truthiness.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:46:00 +00:00
Author
Owner

@⁠ItsMrDubey on GitHub · 2026-11-24 02:50 UTC · original

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.

**@⁠ItsMrDubey** on GitHub · 2026-11-24 02:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/136#issuecomment-7120530858) 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.
Author
Owner

@⁠wavehs on GitHub · 2026-11-24 02:54 UTC · original

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.

**@⁠wavehs** on GitHub · 2026-11-24 02:54 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/136#issuecomment-7120592302) 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.
Author
Owner

@⁠Headache3318 on GitHub · 2026-11-24 09:52 UTC · original

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.

**@⁠Headache3318** on GitHub · 2026-11-24 09:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/136#issuecomment-7128015384) 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.
Author
Owner

@⁠kirigayakazima on GitHub · 2026-11-24 11:37 UTC · original

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)

**@⁠kirigayakazima** on GitHub · 2026-11-24 11:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/136#issuecomment-7130342906) 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)
Author
Owner

@⁠MoonEyes on GitHub · 2026-11-24 16:02 UTC · original

Measured side by side with #676 and #940 in #676. 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** on GitHub · 2026-11-24 16:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/136#issuecomment-7137031204) Measured side by side with #676 and #940 in https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/676. 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.
Author
Owner

@⁠MoonEyes on GitHub · 2026-11-24 17:39 UTC · original

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 #676). 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** on GitHub · 2026-11-24 17:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/136#issuecomment-7139519633) 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://git.gtahub.st/github/ubiquitarianism--leonida/pulls/676). 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.
This pull request has changes conflicting with the target branch.
  • tests/semantic/test_image_atomics_guard.py
  • tests/semantic/test_sopc_validation.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/136/head:github-bot/gh-136'
git switch 'github-bot/gh-136'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-136'
git switch 'github-bot/gh-136'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-136'
git switch 'github-bot/gh-136'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-136'
git switch 'main'
git merge --squash 'github-bot/gh-136'
git switch 'main'
git merge --ff-only 'github-bot/gh-136'
git switch 'main'
git merge 'github-bot/gh-136'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.