mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:45:53 +01:00
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#499
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/448
Author: @Len1k
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:test/atomic-guard-writes-exec📝 Commits (1)
522e189tests: exercise the real active-lane guard when a shader writes EXEC📊 Changes
1 file changed (+142 additions, -6 deletions)
View changed files
📝
tests/semantic/test_image_atomics_guard.py(+142 -6)📄 Description
Claimed 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).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.