tests: cover the computed-EXEC write path #24 left without a test #460
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!460
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/460/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Len1k on GitHub · 2026-11-24 05:42 UTC · original
Len1k:test/atomic-guard-writes-exec→main· +101 −6 · 1 files · 1 commits · merged 2026-11-24 08:52 UTCClaimed in the coordination issue as:
TEST-ATOMIC-GUARD— see the note at the end, this turned out to be a follow-up rather than that item.What this actually adds
b3eaa3d7b("tests: image atomics guard keeps a dynamic EXEC case", 04:20 UTC) already restored the case @Okamizs asked for in the coordination issue, so the folded-constant gap is closed onmainbefore this PR. That commit's own comment names what it left out:SHADER-1264 is fixed — #24, "a computed value written to EXEC sets the lanes of its bits" — and that PR changed
tools/rdna2spirv.pyanddocs/design.mdwith no test. So the lowering #24 introduced is the one shape the guard suite cannot express today, and nothing would catch a regression in it.This PR adds that case, and the helper change needed to write it.
Why the helper has to change
With a computed mask, the branch condition is a value derived from the load, not the load:
lowers to (trimmed):
%t34is the lane's bit of the new mask, which is the correct guard, butfind_guarded_texel_blockaccepted only ids produced byOpLoad %bool %active(plus the folded%true). Againstmainthe new fixture fails withAssertionError: OpImageTexelPointer in unguarded block %t123_do.Widening the helper to accept any condition would have been worse — a guard that never consults the lane mask would pass. Instead:
derived_from(spv, cond)walks the definition chain of a value and answers whether it reaches anOpLoad %bool %active.defs_of(spv)builds the id-to-operand map.find_guarded_texel_blockaccepts a condition when it is the folded%true(still only for a module with noOpStore %active) or whenderived_fromreaches a load. Everything else is still rejected, so the forged-%trueassertionb3eaa3d7badded keeps working.texel_guard_condition(spv)returns the condition of the selection entering the block that holds theOpImageTexelPointer, so a test can assert on it.test_a_shader_that_writes_exec_guards_on_the_load_not_the_folded_constant: the fixture above, assertingOpStore %activeis present, the condition is not%true,derived_from(spv, condition)is true,derived_from(spv, "%true")is false, and the guarded block still holdsOpAccessChain,OpImageTexelPointerandOpAtomicIAdd.Verified
python -m unittest discover -s tests/semantic -p test_image_atomics_guard.py—Ran 5 tests ... OK(4 onmain; the new one fails there with the assertion above).python -I scripts/run_semantic_tests.py tests/semantic— 465 files, 6105 tests, 2 files failed in 485 s with 16 jobs:test_sopc_validationandtest_unary_f16_validation, bothAssertionError: spirv-as / spirv-val not found on PATHinside their ownvalidate_spirv. This machine has no SPIR-V tools, so those two cannot run here; nothing else failed andtest_image_atomics_guardpassed inside that run.python -I scripts/check_no_game_data.py tests/semantic/test_image_atomics_guard.py— exit 0.No translator change, so the translated and spirv-val-valid counts are unchanged by construction. The fixture is hand-written; no game file was read and no GPU was involved.
Note on the coordination issue
TEST-ATOMIC-GUARD's reported gap was closed at 04:20 UTC, six minutes before the finding was posted at 04:26 — so the board entry is stale rather than pending. I have said so in the coordination issue; this PR should be read as "the computed-EXEC path #24 left without a test", not as that item.Depends on:none. AI-assisted (OpenCode) on Windows 11, Python 3.12, RX 5700 XT (used for nothing here).@GrahamboJangles on GitHub · 2026-11-24 08:52 UTC · original
Reviewed on current code, CPU only: no GPU, no
spirv-as/spirv-valon PATH, no game files. Windows 11, Python 3.14.9. Measured against PR head891fb8f4e276b6905d19dd8b3a0b5e74e2d95c64(2026-11-24 08:40 UTC) and localmainhead1c93c8697078c3ccbd6f374caf5bb3ab0b6bc8e4(fetched today).What I ran and saw:
python -I tests/semantic/test_image_atomics_guard.pyonmain:Ran 4 tests ... OK. On the PR head:Ran 5 tests ... OK. The delta is +1, so the new fixture test actually runs and passes — it adds coverage rather than replacing a test.python -I scripts/run_semantic_tests.py tests/semantic): 465 files, 6105 tests, the same 2 failing files as onmain—test_sopc_validationandtest_unary_f16_validation— and in both cases every failure isAssertionError: spirv-as / spirv-val not found on PATH. Environment-only, not introduced by this PR; #136 already covers making those green without SPIRV-Tools.mainrun (6107) and the PR-head run (6105) becausemainhas moved past this PR's base (8f481cf16f261c7f37458aeb45e8f4e19994146d) by other merges; the per-file +1 is the relevant number.Substance checked: the widened helper accepts exactly what the fixture needs — the guard condition
OpINotEqual %t24 %c0sits in the definition chain of the computedexec_lowrite and reaches theOpLoad %bool %activethroughderived_from, so the real per-lane guard is asserted, and the file passes in full, which means the forged-%truerejection added byb3eaa3d7b(PR #394) still works alongside the new acceptance rule.One coordination note: open PR #136 edits
tests/semantic/test_image_atomics_guard.pytoo, for a different topic (optionalspirv-valso the suite runs without SPIRV-Tools). No implementation is duplicated — neither PR contains the other's change — but whichever merges first, the other will need a rebase off that file. Landing order is the coordinator's call.Scope deliberately out: I checked no GPU pipeline behaviour and no corpus counts here (no SPIRV-Tools, no GPU on this machine) — this PR's claims are IR-shape assertions in the guard helper, which is what I could run. This comment is from an automated overnight contribution run (AI-assisted).
@QemmHD on GitHub · 2026-11-24 08:52 UTC · original
Merging. Why merged: test-only coverage for the computed-EXEC write path, which had no test.
Why it's good: on main
1c93c86: image-atomics guard tests 7 -> 8, semantic suite 6107 -> 6108 tests with no new failures; repo-consistency set 563/563.AI-assisted (Claude Code, Claude Opus 5.5).