[GH-ISSUE #15] test_exec_computed is red on main: the fixtures landed without the translator half (SHADER-1264) #3

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

Originally created by @wavehs on GitHub (Nov 24, 2026).
Original GitHub issue: https://github.com/ubiquitarianism/leonida/issues/15

tests/semantic/test_exec_computed.py fails on main (9ec34cdff) for both of its shaders. The GPU fixtures and the CPU test were merged test-first in 717f011a0 ("GPU fixtures for computed writes to exec_lo / exec_hi (SHADER-1264)"), and the translator change they describe did not come with them; nothing in the repository or the old project's branches implements it.

What happens

A computed 32-bit value written to exec_lo / exec_hi must turn on the lanes whose own bit is set. The translator still tests the value for non-zero and turns on the whole half (tools/rdna2spirv.py, set_exec at :1523 and exec_half_write at :5515), so the words read back are the pre-SHADER-1264 ones:

cs_w32_exec_computed: got [8192, 8192, 8192, 7682, 512, 4100, 0, 3]
                     want [259, 1028, 3088, 7682, 512, 4100, 0, 3]
cs_w64_exec_computed: got [8224, 8192, 16384, 16384, 8192, 4132, 0, 3]
                     want [291, 1028, 11264, 771, 8192, 4132, 0, 3]

got[:len(OLD_PREFIX)] equals the test's OLD_PREFIX, which it asserts against explicitly.

python -m unittest test_exec_computed (from tests/semantic): 2 tests, 2 failures. This is one of the two files that keep the semantic-tests job red on every pull request.

Where the rule goes

set_exec / exec_half_write need to distinguish a lane-mask value (per-lane representation, all ones or zero: a move of vcc_lo, say) from computed scalar data, and for the latter set each lane of the half from bit lane & 31 of the 32-bit word. The existing s_mov_b32 exec_lo, <imm or non-mask SGPR> path already does exactly that with mask_src(..., wide=False) / const (tools/rdna2spirv.py:6772-6785); the general scalar-ALU destinations (s_lshl_b32, s_add_u32, s_bfm_b32, s_not_b32, s_and_b32 exec_lo, vcc_lo, s8) still go through the non-zero test. The cc_w32 fixture's s_and_b32 exec_lo, vcc_lo, s8 case needs vcc_lo as a whole 32-bit word, not the per-lane copy.

No game files, no GPU: the hand-written .s fixtures, the CPU test and tests/semantic are the check.

Also red, for whoever picks it up

tests/semantic/test_image_atomics_guard.py fails 47 of 49 subtests on main for the %active guard #4473 folds to %true. A tested fix existed in the old project's branch pr/7292 (be65e0611, "tests: the image atomics guard accepts the folded %true when no lane can be inactive"); it was never re-submitted here.

AI-assisted: yes.

Claimed: I am taking the test_exec_computed half (translator + no test changes) unless its fixture author is on it; say so here and I will drop it.

Originally created by @wavehs on GitHub (Nov 24, 2026). Original GitHub issue: https://github.com/ubiquitarianism/leonida/issues/15 `tests/semantic/test_exec_computed.py` fails on `main` (`9ec34cdff`) for both of its shaders. The GPU fixtures and the CPU test were merged test-first in `717f011a0` ("GPU fixtures for computed writes to exec_lo / exec_hi (SHADER-1264)"), and the translator change they describe did not come with them; nothing in the repository or the old project's branches implements it. ## What happens A computed 32-bit value written to `exec_lo` / `exec_hi` must turn on the lanes whose own bit is set. The translator still tests the value for non-zero and turns on the whole half (`tools/rdna2spirv.py`, `set_exec` at `:1523` and `exec_half_write` at `:5515`), so the words read back are the pre-SHADER-1264 ones: ``` cs_w32_exec_computed: got [8192, 8192, 8192, 7682, 512, 4100, 0, 3] want [259, 1028, 3088, 7682, 512, 4100, 0, 3] cs_w64_exec_computed: got [8224, 8192, 16384, 16384, 8192, 4132, 0, 3] want [291, 1028, 11264, 771, 8192, 4132, 0, 3] ``` `got[:len(OLD_PREFIX)]` equals the test's `OLD_PREFIX`, which it asserts against explicitly. `python -m unittest test_exec_computed` (from `tests/semantic`): 2 tests, 2 failures. This is one of the two files that keep the `semantic-tests` job red on every pull request. ## Where the rule goes `set_exec` / `exec_half_write` need to distinguish a lane-mask value (per-lane representation, all ones or zero: a move of `vcc_lo`, say) from computed scalar data, and for the latter set each lane of the half from bit `lane & 31` of the 32-bit word. The existing `s_mov_b32 exec_lo, <imm or non-mask SGPR>` path already does exactly that with `mask_src(..., wide=False)` / `const` (`tools/rdna2spirv.py:6772-6785`); the general scalar-ALU destinations (`s_lshl_b32`, `s_add_u32`, `s_bfm_b32`, `s_not_b32`, `s_and_b32 exec_lo, vcc_lo, s8`) still go through the non-zero test. The `cc_w32` fixture's `s_and_b32 exec_lo, vcc_lo, s8` case needs `vcc_lo` as a whole 32-bit word, not the per-lane copy. No game files, no GPU: the hand-written `.s` fixtures, the CPU test and `tests/semantic` are the check. ## Also red, for whoever picks it up `tests/semantic/test_image_atomics_guard.py` fails 47 of 49 subtests on `main` for the `%active` guard #4473 folds to `%true`. A tested fix existed in the old project's branch `pr/7292` (`be65e0611`, "tests: the image atomics guard accepts the folded %true when no lane can be inactive"); it was never re-submitted here. AI-assisted: yes. Claimed: I am taking the `test_exec_computed` half (translator + no test changes) unless its fixture author is on it; say so here and I will drop it.
4ld0 closed this issue 2026-11-26 20:11:11 +01:00
Author
Owner

@wavehs commented on GitHub (Nov 24, 2026):

releasing: the test_exec_computed half (I opened this and then read the code closely enough to see it is bigger than a one-line change).

What I found while sketching it, for whoever takes it:

  • The translator keeps a lane mask as this invocation’s own bit (all ones or zero), and mask_src(..., wide=False) converts a data word to that same per-lane form. That is exact for a move or a boolean combination of masks, and the fixtures’ s_not_b32 exec_lo, s5 case happens to work that way too (NOT of a per-lane 0/~0 is the per-lane NOT).
  • It is not exact when a data word is combined arithmetically with a mask or with another data word: s_add_u32 exec_lo, s4, 0xf0, s_lshl_b32 exec_lo, 1, s5, s_bfm_b32 exec_lo, s6, s7, and the fixture’s s_and_b32 exec_lo, vcc_lo, s8 all need the real 32-bit words (vcc_lo through the existing ballot helper, s8 as data), the op on words, and only then bit lane & 31 of the result. The test’s expected word(0x000FFFFF & (base + 0xFFFF0)) is exactly that.
  • exec_half_write(half, val, const) already does the per-bit conversion for a constant word; it needs the same path for an SSA word, and sop2_b32_srcs needs a word variant selected when the destination is EXEC and any source is data. Untouched by that: the s_mov_b32 exec_lo, <imm|non-mask SGPR> special case already reads as a word (tools/rdna2spirv.py:6772-6785), and the existing cs_exec_const behaviour is word-correct.

So it is a real but invasive change to the scalar ALU → EXEC path (wave32 and both halves of wave64), not a rule addition; I would rather the fixture author take it with that in hand. The image-atomics half in the first comment is independent and much smaller (re-land be65e0611 from the old pr/7292).

<!-- gh-comment-id:7119405066 --> @wavehs commented on GitHub (Nov 24, 2026): releasing: the test_exec_computed half (I opened this and then read the code closely enough to see it is bigger than a one-line change). What I found while sketching it, for whoever takes it: - The translator keeps a lane mask as this invocation’s own bit (all ones or zero), and `mask_src(..., wide=False)` converts a *data* word to that same per-lane form. That is exact for a move or a boolean combination of masks, and the fixtures’ `s_not_b32 exec_lo, s5` case happens to work that way too (NOT of a per-lane 0/~0 is the per-lane NOT). - It is not exact when a data word is combined arithmetically with a mask or with another data word: `s_add_u32 exec_lo, s4, 0xf0`, `s_lshl_b32 exec_lo, 1, s5`, `s_bfm_b32 exec_lo, s6, s7`, and the fixture’s `s_and_b32 exec_lo, vcc_lo, s8` all need the real 32-bit words (`vcc_lo` through the existing ballot helper, `s8` as data), the op on words, and only then bit `lane & 31` of the result. The test’s expected `word(0x000FFFFF & (base + 0xFFFF0))` is exactly that. - `exec_half_write(half, val, const)` already does the per-bit conversion for a *constant* word; it needs the same path for an SSA word, and `sop2_b32_srcs` needs a word variant selected when the destination is EXEC and any source is data. Untouched by that: the `s_mov_b32 exec_lo, <imm|non-mask SGPR>` special case already reads as a word (`tools/rdna2spirv.py:6772-6785`), and the existing `cs_exec_const` behaviour is word-correct. So it is a real but invasive change to the scalar ALU → EXEC path (wave32 and both halves of wave64), not a rule addition; I would rather the fixture author take it with that in hand. The image-atomics half in the first comment is independent and much smaller (re-land `be65e0611` from the old `pr/7292`).
Author
Owner

@wavehs commented on GitHub (Nov 24, 2026):

The image-atomics half is up as #20: the old pr/7292 patch (be65e0611, kett1m) cherry-picked onto 9ec34cdff, authorship kept, re-verified there.

After it: tests/semantic is 463 files, 6075 tests, 1 file failed (test_exec_computed) - so the semantic-tests job comes down to this one file.

<!-- gh-comment-id:7119504739 --> @wavehs commented on GitHub (Nov 24, 2026): The image-atomics half is up as #20: the old `pr/7292` patch (`be65e0611`, kett1m) cherry-picked onto `9ec34cdff`, authorship kept, re-verified there. After it: `tests/semantic` is 463 files, 6075 tests, 1 file failed (`test_exec_computed`) - so the `semantic-tests` job comes down to this one file.
Author
Owner

@Mby159 commented on GitHub (Nov 24, 2026):

GPU side of this, from an AMD Radeon 780M (RDNA3 iGPU, gfx1103), AMD proprietary driver 26.10.2 (LLPC), Vulkan 1.4.359, Windows 11: the two GPU fixtures fail on main (9ec34cdff) with exactly the words the CPU interpreter returns.

cs_w32_exec_computed: got 8192 8192 8192 7682 512 4100 0 3
cs_w64_exec_computed: got 8224 8192 16384 16384 8192 4132 0 3

python -I scripts/run_gpu_tests.py --build <build>: 228/248 passed, 16 skipped, 4 failed; 257/257 shaders translated and spirv-val clean. The other two failures are the tfe cases, which I reported as #31.

So the wrong words are not a CPU-interpreter artefact: on real hardware the GPU returns the same pre-fix words. The per-lane expectations in the fixture comments are what the hardware should give once the translator takes each lane's own bit out of the computed value.

If someone takes the translator half, say so here and I will re-run the GPU suite on the 780M and post the numbers (it takes about three minutes on this machine).

AI-assisted (MiniMax Code).

<!-- gh-comment-id:7119712139 --> @Mby159 commented on GitHub (Nov 24, 2026): GPU side of this, from an AMD Radeon 780M (RDNA3 iGPU, gfx1103), AMD proprietary driver 26.10.2 (LLPC), Vulkan 1.4.359, Windows 11: the two GPU fixtures fail on `main` (9ec34cdff) with exactly the words the CPU interpreter returns. ``` cs_w32_exec_computed: got 8192 8192 8192 7682 512 4100 0 3 cs_w64_exec_computed: got 8224 8192 16384 16384 8192 4132 0 3 ``` `python -I scripts/run_gpu_tests.py --build <build>`: 228/248 passed, 16 skipped, 4 failed; 257/257 shaders translated and spirv-val clean. The other two failures are the `tfe` cases, which I reported as #31. So the wrong words are not a CPU-interpreter artefact: on real hardware the GPU returns the same pre-fix words. The per-lane expectations in the fixture comments are what the hardware should give once the translator takes each lane's own bit out of the computed value. If someone takes the translator half, say so here and I will re-run the GPU suite on the 780M and post the numbers (it takes about three minutes on this machine). AI-assisted (MiniMax Code).
Author
Owner

@wavehs commented on GitHub (Nov 24, 2026):

Taken as #24 (rdna2spirv: a computed value written to EXEC sets the lanes of its bits (SHADER-1264), ddddddddwp) - so my claim on this half is released for real: no pull request of mine touches it. I verified their branch: test_exec_computed passes and the whole translator suite is down to test_image_atomics_guard (#20).

<!-- gh-comment-id:7119753600 --> @wavehs commented on GitHub (Nov 24, 2026): Taken as #24 (`rdna2spirv: a computed value written to EXEC sets the lanes of its bits (SHADER-1264)`, ddddddddwp) - so my claim on this half is released for real: no pull request of mine touches it. I verified their branch: `test_exec_computed` passes and the whole translator suite is down to `test_image_atomics_guard` (#20).
Author
Owner

@ddddddddwp commented on GitHub (Nov 24, 2026):

done: SHADER-1264 -> #24 (merged in 84347bbb6). @wavehs re-ran the whole translator suite on main after the merge: 463 files, 6075 tests, 0 failed. The fixtures' CPU words and Mby159's 780M GPU words are the same now; nothing else is needed here.

<!-- gh-comment-id:7123843186 --> @ddddddddwp commented on GitHub (Nov 24, 2026): done: SHADER-1264 -> #24 (merged in `84347bbb6`). @wavehs re-ran the whole translator suite on `main` after the merge: 463 files, 6075 tests, 0 failed. The fixtures' CPU words and Mby159's 780M GPU words are the same now; nothing else is needed here.
Author
Owner

@MoonEyes commented on GitHub (Nov 24, 2026):

This can be closed: the translator half landed as #24, and the test is green on current main.

Re-checked on main d0da7dade (Windows 11, Python 3.14.0): python -I scripts/run_semantic_tests.py tests/semantic -p test_exec_computed.py gives 1 files, 2 tests, 0 files failed. The path #24 left without a test is covered by #460 (merged), and the coordination issue already lists SHADER-1264 as closed.

AI-assisted (Claude Code).

<!-- gh-comment-id:7133652781 --> @MoonEyes commented on GitHub (Nov 24, 2026): This can be closed: the translator half landed as #24, and the test is green on current `main`. Re-checked on `main` d0da7dade (Windows 11, Python 3.14.0): `python -I scripts/run_semantic_tests.py tests/semantic -p test_exec_computed.py` gives `1 files, 2 tests, 0 files failed`. The path #24 left without a test is covered by #460 (merged), and the coordination issue already lists SHADER-1264 as closed. AI-assisted (Claude Code).
Author
Owner

@efeekrb commented on GitHub (Nov 25, 2026):

This is fixed on main by #24 (1b15cd23, SHADER-1264): tests/semantic/test_exec_computed.py passes at 3de22a19, along with the whole semantic suite (487 files, 6,279 tests, 0 failed; Linux, no GPU). I think this issue can be closed.

<!-- gh-comment-id:7159730667 --> @efeekrb commented on GitHub (Nov 25, 2026): This is fixed on main by #24 (1b15cd23, SHADER-1264): tests/semantic/test_exec_computed.py passes at 3de22a19, along with the whole semantic suite (487 files, 6,279 tests, 0 failed; Linux, no GPU). I think this issue can be closed.
Author
Owner

@BubsMcgee commented on GitHub (Nov 25, 2026):

Verified on current main 0d80bc5df (Windows 11 Pro build 26300, Python 3.14.3, CPU only):

  • python -I scripts/run_semantic_tests.py tests/semantic -p test_exec_computed.py
    → 1 file, 2 tests, 0 files failed (8 s, 16 jobs)
  • python -m unittest test_image_atomics_guard (run from tests/semantic)
    → Ran 6 tests, OK

Both halves are green on current main: the computed-EXEC write handling (the SHADER-1264 fix) and the image-atomics guard helper. The earlier red fixtures reflect the old translator output. The open-work row for SHADER-1264 is stale, so this looks closeable.

AI-assisted.

<!-- gh-comment-id:7162195273 --> @BubsMcgee commented on GitHub (Nov 25, 2026): Verified on current `main` `0d80bc5df` (Windows 11 Pro build 26300, Python 3.14.3, CPU only): - `python -I scripts/run_semantic_tests.py tests/semantic -p test_exec_computed.py` → 1 file, 2 tests, 0 files failed (8 s, 16 jobs) - `python -m unittest test_image_atomics_guard` (run from `tests/semantic`) → Ran 6 tests, OK Both halves are green on current main: the computed-EXEC write handling (the SHADER-1264 fix) and the image-atomics guard helper. The earlier red fixtures reflect the old translator output. The open-work row for SHADER-1264 is stale, so this looks closeable. AI-assisted.
Author
Owner

@BubsMcgee commented on GitHub (Nov 25, 2026):

Both checks pass on current main (verified on 0d80bc5df, above), and SHADER-1264 is fixed by #24. This can be closed. (AI-assisted.)

<!-- gh-comment-id:7163235748 --> @BubsMcgee commented on GitHub (Nov 25, 2026): Both checks pass on current main (verified on 0d80bc5df, above), and SHADER-1264 is fixed by #24. This can be closed. (AI-assisted.)
Author
Owner

@usercristian commented on GitHub (Nov 25, 2026):

finding: issue #15 is outdated relative to current main (0d80bc5df) — both SHADER-1264 and TEST-ATOMIC-GUARD are already fixed and green.

Where:

  • tools/rdna2spirv.py:1645-1653 (Gen.exec_bit) and tools/rdna2spirv.py:1680-1685 (Gen.dst routing exec/exec_lo/exec_hi through self.exec_bit(val)), landed via PR #24 (1b15cd231, merged in 84347bbb6) and documented in docs/design.md:476.
  • tests/semantic/test_image_atomics_guard.py:88-114 (derived_from), :125, :226-313 (3 dynamic-EXEC test cases), landed via PR #20 (c1bcf15f8, cherry-pick of be65e0611) and PR #460 (b3eaa3d7b, 891fb8f4e, merged in f74304de5), plus abbd7d9b2.

Why it matters: #15 and the Open work table in #14 still show these two items as open/red, which misleads contributors into claiming already-solved work.

Repro (no game files, no GPU; Fedora 43, Python 3.14.10, spirv-as/spirv-val on PATH, main @ 0d80bc5df):

  • cd tests/semantic && python3 -m unittest test_exec_computed -v -> 2/2 OK
  • cd tests/semantic && python3 -m unittest test_image_atomics_guard -v -> 6/6 OK
  • python3 scripts/run_semantic_tests.py tests/semantic -> 489 files, 6288 tests, 0 files failed (445 s, 4 jobs)
  • python3 -m compileall -q make_game.py tools tests -> OK

Needs game files / GPU: No game files, no GPU. Suggest closing #15 as resolved.

AI-Assisted Gemini

<!-- gh-comment-id:7164035006 --> @usercristian commented on GitHub (Nov 25, 2026): finding: issue #15 is outdated relative to current main (0d80bc5df) — both SHADER-1264 and TEST-ATOMIC-GUARD are already fixed and green. Where: - tools/rdna2spirv.py:1645-1653 (Gen.exec_bit) and tools/rdna2spirv.py:1680-1685 (Gen.dst routing exec/exec_lo/exec_hi through self.exec_bit(val)), landed via PR #24 (1b15cd231, merged in 84347bbb6) and documented in docs/design.md:476. - tests/semantic/test_image_atomics_guard.py:88-114 (derived_from), :125, :226-313 (3 dynamic-EXEC test cases), landed via PR #20 (c1bcf15f8, cherry-pick of be65e0611) and PR #460 (b3eaa3d7b, 891fb8f4e, merged in f74304de5), plus abbd7d9b2. Why it matters: #15 and the Open work table in #14 still show these two items as open/red, which misleads contributors into claiming already-solved work. Repro (no game files, no GPU; Fedora 43, Python 3.14.10, spirv-as/spirv-val on PATH, main @ 0d80bc5df): - `cd tests/semantic && python3 -m unittest test_exec_computed -v` -> 2/2 OK - `cd tests/semantic && python3 -m unittest test_image_atomics_guard -v` -> 6/6 OK - `python3 scripts/run_semantic_tests.py tests/semantic` -> 489 files, 6288 tests, 0 files failed (445 s, 4 jobs) - `python3 -m compileall -q make_game.py tools tests` -> OK Needs game files / GPU: No game files, no GPU. Suggest closing #15 as resolved. AI-Assisted Gemini
Author
Owner

@BubsMcgee commented on GitHub (Nov 25, 2026):

Green now: tests/semantic/test_exec_computed.py and its two fixtures are in the tree and pass on origin/main at 9e7720c9e (Ran 2 tests ... OK). The translator half of SHADER-1264 is in.

<!-- gh-comment-id:7169515127 --> @BubsMcgee commented on GitHub (Nov 25, 2026): Green now: `tests/semantic/test_exec_computed.py` and its two fixtures are in the tree and pass on `origin/main` at `9e7720c9e` (`Ran 2 tests ... OK`). The translator half of SHADER-1264 is in.
Author
Owner

@wavehs commented on GitHub (Nov 26, 2026):

Closing as fixed, with both halves confirmed on main bd6ba97ab (macOS 27.2.1 arm64, Python 3.15.2, CPU only, no game files):

  • SHADER-1264 (the subject of this issue, translator half): python -I scripts/run_semantic_tests.py tests/semantic -p test_exec_computed.py -> 1 files, 2 tests, 0 files failed. The two fixtures (cs_w32_exec_computed, cs_w64_exec_computed) and the translator change from #24 (1b15cd23) are in the tree.
  • The "also red" half (test_image_atomics_guard.py, 47 of 49 subtests): -p test_image_atomics_guard.py -> 1 files, 6 tests, 0 files failed. The %active guard folding from #20 is on main.

The full translator suite is also green at this commit: 500 files, 6367 tests, 0 files failed in 138 s with 12 jobs.

The issue had several "can be closed" confirmations (MoonEyes, efeekrb, BubsMcgee, usercristian); this records the exact runs so the next reader does not have to re-check.

AI-assisted (verification only).

<!-- gh-comment-id:7200244646 --> @wavehs commented on GitHub (Nov 26, 2026): Closing as fixed, with both halves confirmed on `main` `bd6ba97ab` (macOS 27.2.1 arm64, Python 3.15.2, CPU only, no game files): - **SHADER-1264** (the subject of this issue, translator half): `python -I scripts/run_semantic_tests.py tests/semantic -p test_exec_computed.py` -> `1 files, 2 tests, 0 files failed`. The two fixtures (`cs_w32_exec_computed`, `cs_w64_exec_computed`) and the translator change from #24 (`1b15cd23`) are in the tree. - **The "also red" half** (`test_image_atomics_guard.py`, 47 of 49 subtests): `-p test_image_atomics_guard.py` -> `1 files, 6 tests, 0 files failed`. The `%active` guard folding from #20 is on `main`. The full translator suite is also green at this commit: `500 files, 6367 tests, 0 files failed in 138 s with 12 jobs`. The issue had several "can be closed" confirmations (MoonEyes, efeekrb, BubsMcgee, usercristian); this records the exact runs so the next reader does not have to re-check. AI-assisted (verification only).
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#3
No description provided.