A lane mask (EXEC/VCC or a mask-tracked SGPR) that a VALU op reads as a
32-bit value — v_mov_b32 of it into a plain VGPR, or any VALU source
where the mask is data rather than a mask operand — materialized each
lane's own 0 / ~0 bit. Hardware holds the whole wave's mask word there
(tools/crosslane_fuzz.py's op_maskdata model: the uniform word written
to the active lanes), so every lane gets the word, the same in each.
- src_u materializes the wave mask word (lane_mask_word) for SGPR and
EXEC/VCC operands when the instruction's VGPR destination makes the
read a data read (mask_read_is_data); SGPR/EXEC/VCC destinations keep
this lane's bit, which mask_src readers rely on. Mask-holding VGPRs
already store the word, so their reads are plain loads.
- mask_src extracts this lane's bit back out of a mask-holding VGPR
(_vgpr_mask_lane_bit), half-aware in wave64 via mask_half.
- mask_data_src keeps instructions that materialize the word out of
EXEC-gated active runs (a subgroup op can't sit inside if (active)).
- v_readfirstlane_b32 of a mask VGPR broadcasts the first active lane's
copy — the only lane guaranteed fresh after an EXEC-gated v_mov_b32 —
as the word itself into a VGPR destination (VGPR writes are never
mask-tracked), or this lane's bit for a mask-tracked SGPR/special
one; fixes cs_wavemask lanes 48-63.
Found by tools/crosslane_fuzz.py (#293). docs/design.md's whole-wave
mask contract updated.
Co-Authored-By: Devin <noreply@cognition.ai>
Review (@shdann): setUpModule() registered tearDownModule() with atexit every time it created the folder, so a
process that cycles setup and teardown kept one more callback per cycle (128 after 128 cycles). A module-level flag
now registers it on the first creation only. That first registration still follows the module's first
TemporaryDirectory, so it runs before tempfile's exit finalizer, and tearDownModule() cleans whichever folder is
live at exit, so a borrower that recreates it after teardown is still covered.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_salu64_bitwise_data and test_buffer_load_format create their folder lazily: translate_ps() / load_format()
call setUpModule() when _TMP_DIR is None. Four modules import those helpers (test_interp_merge_check,
test_mask_src_sgpr_const and test_saveexec_variants from the first, test_norm_decode from the second), so in
discovery order:
- a borrower that runs first creates the folder, and the owner's own setUpModule() then replaces it without
cleaning it up;
- a borrower that runs after the owner's tearDownModule() creates it again, and nothing removes it.
`python -m unittest discover -s tests/semantic` printed three "ResourceWarning: Implicitly cleaning up
<TemporaryDirectory ...>" lines for this.
setUpModule() now keeps an existing folder, and registers tearDownModule() with atexit right after creating
one. It is registered after the TemporaryDirectory, so it runs before tempfile's own exit finalizer (atexit is
last in, first out); registering it at import time ran too late and the warning stayed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The other 64-bit scalar bitwise ops were translated, these three were
rejected. They join the s_and_b64 branch: D = ~(S0 op S1) on the
lane-mask path (a lane's mask value is 0 or ~0, so the NOT is per lane)
and on both dwords of 64-bit data, SCC as for the others.
test_salu64_bitwise_data.py runs them through its data cases (distinct
dwords, four-corner SCC, immediates, null, aliasing) and the wave32 and
wave64 lane-mask cases. docs/design.md row updated.
- vulkan_backend.h: #1212's query_heap_type locked mutex_, which VulkanContext no longer has; query_pools_ is
guarded by resource_mutex_ (add/remove take it unique), so the lookup takes it shared. The runtime didn't build.
- test_salu64_bitwise_data (#1207): its wave64 store went through a V# with word3 = 0 (OOB_SELECT 0, stride 0),
out of range since #1104; it now uses the raw-buffer word3 the other semantic tests use.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>