upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/thread_stacks.cpp
diff options
context:
space:
mode:
authorLen1k <102464172+Len1k@users.noreply.github.com>2026-11-24 08:40:05 +0300
committerLen1k <102464172+Len1k@users.noreply.github.com>2026-11-24 08:40:05 +0300
commit891fb8f4e276b6905d19dd8b3a0b5e74e2d95c64 (patch)
tree252ad204fe34198f2b1024fb98395174b369f6ba /runtime/src/thread_stacks.cpp
parent8f481cf16f261c7f37458aeb45e8f4e19994146d (diff)
tests: exercise the real active-lane guard when a shader writes EXEC
`find_guarded_texel_block` accepted only an `OpLoad %bool %active` result as the branch condition (or the folded `%true` for a shader that never writes EXEC). After the folded-constant path was added, every case in the file left EXEC untouched and took that path, so the assertion the file exists for - a lane whose EXEC bit is off skips the image atomic - was not checked by anything. Widening the helper alone would have been wrong: a guard that never consulted the lane mask would then pass. Instead the helper now walks the definition chain of the branch condition and accepts it only when it reaches an `OpLoad %bool %active`, which is the shape the translator actually emits for an EXEC-writing shader. `s_and_b32 exec_lo, exec_lo, s4` becomes `OpSelect`/`OpBitwiseAnd`/`OpShiftRightLogical`/`OpINotEqual` over the loaded boolean and the branch tests the last comparison, so the condition is a value computed from the load, not the load. The new case writes EXEC (`s_mov_b32 s4, 1` + `s_and_b32 exec_lo, exec_lo, s4`) before `image_atomic_add`, asserts the module really contains an `OpStore %active`, and asserts the guard is not the folded constant and does reach the load. A shader with an `OpStore %active` that branched on `%true` would now fail. No GPU, no game data, no translator change: the fixture is hand-written and the file stays standard-library only. Tested with `python -m unittest discover -s tests/semantic -p test_image_atomics_guard.py` (5 tests, OK before and after the change; the new test fails against the old helper with "OpImageTexelPointer in unguarded block %t123_do", which is the gap reported in the coordination issue). AI-assisted (OpenCode). Windows 11, Python 3.12, no GPU involved.
Diffstat (limited to 'runtime/src/thread_stacks.cpp')
0 files changed, 0 insertions, 0 deletions