Repository navigation
Conversation
…_lo/hi (SHADER-1264)
|
Independent verification on Windows 11 x64 (Python 3.14.0rc2, CPU-only; pure synthetic fixtures, zero game data). Verification & Negative Controls
LGTM. Approved. AI-assisted. |
|
Verified commit AI-assisted verification. |
|
Tested
AI-assisted (Claude Code). |
|
Independent wave32 GPU check: PASS on Windows 11, GeForce RTX 4070 Laptop (616.92), x64 MSVC 19.44.35230 / Ninja RelWithDebInfo, AMDGPU The fixture computes
The other 31 words on the PR kept the original Reproducer (hand-written, no game data), built with ; group: 32,1,1
; rsrc2: 0x8090
; mattr: +wavefrontsize32,-wavefrontsize64
v_lshlrev_b32_e32 v1, 2, v0
v_mov_b32_e32 v2, 0x12345678
s_lshl_b32 exec_lo, 1, s4
buffer_store_dword v2, v1, s[0:3], 0 offen
s_endpgmAI-assisted (OpenCode). |
cryptocxeq
left a comment
There was a problem hiding this comment.
Independent focused CPU regression review of cb7c5b322e86c1d6437907adae5e4e15b93ba63c, patch applied to main snapshot 32a50c949e882ae539f2d54be93fadd50ce76cae. No blocking finding in the reviewed code/regression path.
The code distinguishes a lane-mask move from a computed scalar word before writing an EXEC half; the bit extraction retains the lane-relative 32-bit index and the existing other-half preservation path. The three new tests are emission-shape checks (presence/count of shifts and the mask-move exception), and they detect removal of the new path. Suggested follow-up: execute a fixture that asserts the exact active-lane set and preservation of the other half, rather than relying only on shift-text presence. Hardware semantics were not remeasured.
Native Windows / CPython 3.11.15:
python -I tests/semantic/test_dst_exec_non_mask.py: 3 tests, exit 0.- Same tests with only implementation files restored: failures=2.
git diff --check passed. Synthetic inputs only; no game files, GPU, real hardware oracle or external shader toolchain. Full-project tests were not run.
Claim: #8344 (comment)
AI-assisted (OpenAI Codex).
|
AI-assisted comparison with #8424 on the same RTX 4080. Both current heads fixed computed scalar EXEC writes in native wave32 and emulated wave64. I also reran #8424 after its wave32 change arrived.
Four hand-written fixtures per revision. The scalar probe writes dynamic SGPR words to EXEC halves via arithmetic, marks active lanes, restores EXEC and reads every lane back. Six directed masks plus 26 deterministic random masks. A separate odd-lane compare/move control matched all 32 and 64 lanes on every revision. All four modules per revision passed SPIR-V validation. All 66 dispatches per revision exited 0, zero skips. CachyOS, CPython 3.14.10, LLVM 23.1.5, SPIRV-Tools 2026.4, NVIDIA GeForce RTX 4080 620.70.06, hardware subgroup 32, Khronos validation on. Commands: |
|
Tested Toolchain: standalone Vulkan harnesses compiled from GPU readback (
Shader suite (
Semantic unit tests:
Synthetic shaders and inputs only; no game files used. AI-assisted. |
|
Wave64 GPU check of cb7c5b3, merged with The check is a wave64 compute shader (group 64,1,1, run with
#8424 (SHADER-1264, flagged as a duplicate) gives the same four rows at 5fcb226, so both fixes agree on this shader on the Radeon.
Windows 10 22H2, AMD Radeon iGPU (gfx1036, driver 32.0.13036.4), Vulkan SDK 1.4.363. The RTX 5070 Ti can't run this shader because it has no 64-wide subgroup. Synthetic values only, no game files. AI-assisted (Claude Code). |
|
Intel wave32 data point on Windows 11 Home 26300, Intel UHD Graphics (13th Gen, i5-13420H; Xe-LP), Intel 32.0.101.7088, Vulkan 1.4.323, compute subgroup 8..32 (pinned at 32). Same hand-written fixture as the RTX 4070 report, built with this PR's
The other 31 words kept the AI-assisted run (CommandCode agent); synthetic fixture only, no game data. |
|
Tested cb7c5b3 applied on main b763516 (clean apply) on native Windows 11, Python 3.14.8, CPU only: pass
The extra test (tests/semantic/test_exec_data_write.py), free to take into this PR"""SHADER-1264: a computed scalar word written to exec_lo / exec_hi enables only the lanes whose bit is set.
RDNA2 ISA: EXEC is a bit per lane. `s_lshl_b32 exec_lo, s2, 4` with s2 = 15 leaves EXEC[31:0] = 0xf0, so lanes 4-7
of that half are active, exactly as `s_mov_b32 exec_lo, 0xf0` does. The translator keeps EXEC as one bool per
invocation; Gen.dst used to set it from (value != 0) for any value, which is right for a lane mask (0 or all-ones in
each invocation) but turned on every lane of the half for a computed word such as 0xf0.
Each program swaps v1 and v2 under the EXEC it sets, restores EXEC and exports v1; a lane that ran the swap exports
0x2000 + lane instead of 0x1000 + lane. The translated SPIR-V runs in spirv_wave_interp.py. Synthetic programs only,
no game data.
"""
import os
import sys
import unittest
HERE = os.path.dirname(os.path.abspath(__file__))
if HERE not in sys.path:
sys.path.insert(0, HERE)
import spirv_wave_interp as wi # noqa: E402
from support import translate_lines # noqa: E402
PROLOGUE = ["v_mbcnt_lo_u32_b32 v0, -1, 0", "v_mbcnt_hi_u32_b32 v0, -1, v0",
"v_add_nc_u32 v1, 0x1000, v0", "v_add_nc_u32 v2, 0x2000, v0"]
EPILOGUE = ["v_swap_b32 v1, v2", "exp mrt0 v1, v2, v0, v0 done vm", "s_endpgm"]
def swapped_lanes(name, lines, wave):
"""The lanes that ran the swap, in a `wave`-lane run of the translated program."""
outputs = wi.run_wave(translate_lines(name, PROLOGUE + lines + EPILOGUE[:1] + RESTORE[wave] + EPILOGUE[1:]),
wave=wave)["outputs"]
assert len(outputs) == wave, len(outputs)
return [lane for lane, out in enumerate(outputs) if out["%out_mrt0"][0] == 0x2000 + lane]
RESTORE = {32: ["s_mov_b32 exec_lo, s1"], 64: ["s_mov_b64 exec, s[0:1]"]}
SAVE = {32: ["s_mov_b32 s1, exec_lo"], 64: ["s_mov_b64 s[0:1], exec"]}
class Wave32ExecLoData(unittest.TestCase):
def test_shifted_word(self):
lanes = swapped_lanes("ps_exec_lo_lshl", SAVE[32] + ["s_mov_b32 s2, 15", "s_lshl_b32 exec_lo, s2, 4"], 32)
self.assertEqual(lanes, [4, 5, 6, 7])
def test_added_word(self):
# 0x80000000 + 1: the top and bottom lane, from an add of two plain words
lanes = swapped_lanes("ps_exec_lo_add",
SAVE[32] + ["s_mov_b32 s2, 0x80000000", "s_mov_b32 s3, 1", "s_add_u32 exec_lo, s2, s3"],
32)
self.assertEqual(lanes, [0, 31])
def test_word_through_bfe(self):
# s_bfe_u32 of 0xa5a5: bits 0-7 = 0xa5 -> lanes 0, 2, 5 and 7
lanes = swapped_lanes("ps_exec_lo_bfe",
SAVE[32] + ["s_mov_b32 s2, 0xa5a5", "s_bfe_u32 exec_lo, s2, 0x80000"], 32)
self.assertEqual(lanes, [0, 2, 5, 7])
def test_constant_control(self):
# The constant path was already right; the computed forms above must match it.
lanes = swapped_lanes("ps_exec_lo_const", SAVE[32] + ["s_mov_b32 exec_lo, 0xf0"], 32)
self.assertEqual(lanes, [4, 5, 6, 7])
def test_lane_mask_control(self):
# A real lane mask (v_cmp result) ANDed into EXEC still selects per lane: even lanes.
lanes = swapped_lanes("ps_exec_lo_mask",
SAVE[32] + ["v_and_b32_e32 v3, 1, v0", "v_cmp_eq_u32_e32 vcc_lo, 0, v3",
"s_and_b32 exec_lo, exec_lo, vcc_lo"], 32)
self.assertEqual(lanes, list(range(0, 32, 2)))
class Wave64ExecHalves(unittest.TestCase):
def test_exec_hi_shifted_word(self):
# exec_lo = 0 (constant), exec_hi = 15 << 4 (computed): lanes 32 + 4..7 only
lanes = swapped_lanes("ps_exec_hi_lshl",
SAVE[64] + ["s_mov_b32 exec_lo, 0", "s_mov_b32 s2, 15", "s_lshl_b32 exec_hi, s2, 4"],
64)
self.assertEqual(lanes, [36, 37, 38, 39])
def test_exec_lo_word_keeps_high_half(self):
# exec_lo = 3 << 1 (computed) leaves exec_hi all-ones: lanes 1, 2 and 32-63
lanes = swapped_lanes("ps_exec_lo_w64",
SAVE[64] + ["s_mov_b64 exec, -1", "s_mov_b32 s2, 3", "s_lshl_b32 exec_lo, s2, 1"], 64)
self.assertEqual(lanes, [1, 2] + list(range(32, 64)))
if __name__ == "__main__":
unittest.main()No game data. |
|
Tested
Code read: for a lane-mask value (all-ones or zero per lane) bit No game files. AI-assisted (Claude). |
|
Tested
No game files. AI-assisted (Claude Code). |
|
Tested
|
|
Tested CPU:
GPU:
AI assisted: yes |
|
Tested Standalone tools built with llvm-mingw 20261117 (clang, Ninja, Release,
Both non-passing results are on main too, not caused by this PR: AI-assisted (Claude Code). |
|
GPU test for this fix: #8995 adds |
|
Tested cb7c5b3 on AMD Radeon RX 5600 XT (RDNA1, gfx1010), RADV Mesa 26.2.5, CachyOS (Linux 7.3.0): pass, no regressions. llvm-mc 23.1.4, SPIRV-Tools v2026.4, GCC 16.2.1, Python 3.14.8: Same counts as |
Claimed in the coordination issue as: SHADER-1264 (#8186 (comment))
What and why
Fixes
SHADER-1264: when a computed non-mask 32-bit value (e.g.,s_lshl_b32 exec_lo, 1, s2,s_add_u32 exec_hi, ...) was written toexec_loorexec_hithroughGen.dst,exec_half_write(andset_execin wave32) evaluatedval != 0, turning on every lane of that half.Gen.exec_half_writenow acceptsmask=True; whenmask=False, it extracts bit(lane & 31)using the same shift-and-mask path used for constants.Gen.dstchecks whether the write is a mask move (exec, ors_mov_b32from an operand satisfyingholds_lane_mask); non-mask writes extract per-lane bits in both wave64 (exec_half_write(..., mask=False)) and wave32 (lane_bit_mask).Added regression tests in
tests/semantic/test_dst_exec_non_mask.py.Tested
nvidia-open615.71.09python3 -m compileall -q make_game.py tools tests: exit 0python3 -m unittest discover -s tests/semantic -p test_dst_exec_non_mask.py -v: 3/3 passedpython3 -m unittest discover -s tests/semantic -p test_salu_b32_lane_masks.py -v: 8/8 passedpython3 -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_dst_exec_non_mask.py: exit 0AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed.