Commit Graph

6 Commits

Author SHA1 Message Date
b3c8d1b60a rendering(r4b-spv): fix wave32 s_mov_b64 vcc tuples, partial image_store RMW, and 64-bit 2D image_atomic on R64ui binding 29 2026-11-29 06:34:52 -05:00
abbd7d9b27 Document the boot profile and verify descriptor guards and per-device GPU completion
Keep completion batches with their owning Vulkan context. Test switching primitives, caller overrides, and the dynamic EXEC and uniform null-descriptor guards used for dimension-specific storage views.
2026-11-24 21:40:02 +08:00
891fb8f4e2 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.
2026-11-24 08:40:05 +03:00
b3eaa3d7b0 tests: image atomics guard keeps a dynamic EXEC case
Every case in test_image_atomics_guard.py leaves EXEC alone, so since #20
the helper takes the folded if (%true) path everywhere and the real %active
guard was never checked. Add cases that switch lanes off with
s_and_saveexec_b32 and v_cmpx before image_atomic_add/swap/inc/cmpswap on
2D and 3D images, and check the helper rejects %true there.

Follow-up to TEST-ATOMIC-GUARD (#14), building on #20 by wavehs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 04:20:24 +00:00
c1bcf15f8f tests: the image atomics guard accepts the folded %true when no lane can be inactive
main is red in this suite: 3 files, 51 failures. 47 are here. #4473 folds `if (%active)` to `if (%true)` when the
shader writes no EXEC, which is what the model says then (no lane is inactive), but find_guarded_texel_block only
accepted a branch on an OpLoad of %active.

The walker now accepts the constant, and only the constant: a module with an OpStore to %active still has to branch
on the load, so a shader that can deactivate lanes keeps the real guard.

test_image_atomics_guard: OK (3 tests). Whole suite after: 2 files failed (test_float_nan_fract,
test_image_store_d16), both separate.

(cherry picked from commit be65e06113373bcd0405818ebfa65dad18d6b5a3)
2026-11-24 03:47:56 +02:00
f469596f93 rdna2spirv: guard all image_atomic_* by active lane (#3559)
Squash-merged after diff review of PR #3559
2026-11-23 10:01:21 -06:00