Repository navigation
rdna2spirv: mask carry/sign-out lane masks by EXEC - #1109
InduwaraSMPN wants to merge 0 commit into
Conversation
e982504 to
6de000c
Compare
|
Tested 6de000c on Windows 11 Build 26200 x64 (AMD Ryzen 5 5500, Python 3.12.10):
No game files. AI-assisted. |
|
Tested 6de000c on Linux (Fedora 45), one machine with two GPUs: pass, and first GPU confirmation of the fix. AI-assisted.
On the GPU. No existing GPU test covers carry-out under partial EXEC (only
With this PR the counts are what RDNA2's CPU tests: No regressions, this PR vs
Probe (wave32 version; synthetic, written for this test); group: 32,1,1
; mattr: +wavefrontsize32,-wavefrontsize64
v_mov_b32_e32 v1, -1
v_mov_b32_e32 v2, 1
v_mov_b32_e32 v6, -1
v_mov_b32_e32 v7, -1
v_mov_b32_e32 v8, 0
s_mov_b32 exec_lo, 0xffff
v_add_co_u32 v3, vcc_lo, v1, v2
s_mov_b32 s10, vcc_lo
v_sub_co_u32 v3, vcc_lo, v8, v2
s_mov_b32 s11, vcc_lo
v_mad_u64_u32 v[4:5], s12, v1, v1, v[6:7]
s_mov_b32 exec_lo, -1
s_bcnt1_i32_b32 s6, s10
s_bcnt1_i32_b32 s7, s11
s_bcnt1_i32_b32 s9, s12
v_cmpx_eq_u32_e32 0, v0
v_mov_b32_e32 v1, s6
v_mov_b32_e32 v2, 0
buffer_store_dword v1, v2, s[0:3], 0 offen
v_mov_b32_e32 v1, s7
v_mov_b32_e32 v2, 4
buffer_store_dword v1, v2, s[0:3], 0 offen
v_mov_b32_e32 v1, s9
v_mov_b32_e32 v2, 8
buffer_store_dword v1, v2, s[0:3], 0 offen
s_endpgm
|
|
Tested 6de000c on NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11 Home 25H2 (26200.9974), VS 2022 Build Tools, Vulkan SDK 1.4.363.1, llvm-mc 21.1.8: pass
AI-assisted. No game files. |
# Conflicts: # docs/design.md
quackottu
left a comment
There was a problem hiding this comment.
Tested 6de000c on NVIDIA GeForce RTX 5070 (subgroup 32), driver 621.24, Windows 11 Pro (26300), Vulkan SDK 1.4.363.0, llvm-mc 21.1.8 (built with scripts/build_llvm_mc.ps1), scripts/run_gpu_tests.py:
- native: 83/110 passed, 27 skipped (
main8df277f here: 64/91 passed, 27 skipped, all wave64 tests needing a 64-wide subgroup) LEONIDA_W64_EMULATE=1: 110/110 passed (mainhere: 91/91)python -m unittest discover -s tests/semantic: Ran 1110 tests in 203.073s OK
|
Tested 6de000c: no regression on both GPUs. Windows 11 26200, MSVC 19.44, llvm-mc 23.1.6, Vulkan SDK 1.4.363, runtime built from
No game files. AI-assisted (Claude Code). |
6de000c to
e982504
Compare
|
Landed on |
|
Tested
AI-assisted (test run driven by a coding agent). |
# Conflicts: # docs/design.md
test_carry_exec_mask (#1109) and test_wave64_vcc_half_write (#1125) stored through a V# with word3 = 0, which is OOB_SELECT 0 (structured with offset) with stride 0: since #1104 every store is out of range, as on RDNA2, and the tests read back nothing. They now use the raw-buffer V# (OOB_SELECT 3) the other semantic tests use. test_shader_checks counts the third vk_store_test check (#1136) and its fake harness answers it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claimed in the coordination issue as: #1006 (comment)
What and why
Mask the scalar lane-mask destination of VALU carry/borrow and 65-bit MAD instructions by
EXEC(self.active_b()) intools/rdna2spirv.py, matching the AMD RDNA2 ISA (SDST[lane] = EXEC[lane] ? bit : 0) and existingv_cmp_*translation:v_add_co_u32,v_add_co_ci_u32,v_sub_co_u32,v_sub_co_ci_u32,v_subrev_co_u32,v_subrev_co_ci_u32v_mad_u64_u32,v_mad_i64_i32Previously, both handlers selected
0xFFFFFFFFor0from the lane's computed carry/borrow/sign bit without ANDing with%active. Under partialEXEC, inactive lanes whose inputs overflowed/borrowed/were negative leaked1bits intoVCCor SGPR lane masks, corrupting wave-wide consumers (s_bcnt1_i32_b32/b64,s_cbranch_vccz) and post-EXEC-restorev_cndmask_b32. Also skipped emitting the unused mask select whencdisnullon*_co_*(matchingv_mad_*64).Audited all other
mask_dst/OpStore %vccsites intools/rdna2spirv.py: allv_cmp_*sites already AND withself.active_b(), andv_div_scale_*is not present. Updated the contract table indocs/design.md(EXECandv_mad_u64_u32,v_mad_i64_i32rows) and added CPU-only wave32, wave64, and--wave64-emulatetests intests/semantic/test_carry_exec_mask.py.AI-assisted: written and verified with an AI coding assistant.
Tested
Environment: Windows 11 (
Microsoft Windows NT 10.0.26300.0), Python 3.12.12, CPU-only (no GPU, nollvm-mc/spirv-as/spirv-val, no game files; not GPU-verified).48ad23f:python -I tests/semantic/test_carry_exec_mask.py -v->Ran 9 tests in 4.840s,FAILED (failures=48)(all 48 EXEC-masking subtests failed across wave32, wave64, and--wave64-emulatestructure; the 2nullsdst sanity tests passed).e982504):python -I tests/semantic/test_carry_exec_mask.py -v->Ran 9 tests in 4.712s,OK(all 6*_co_*ops,v_mad_u64_u32,v_mad_i64_i32,s_bcnt1,s_cbranch_vccz,v_cndmask_b32,nulldst; wave32, wave64, and--wave64-emulateSPIR-V structure).python -m compileall -q make_game.py tools tests-> exit 0.python -I make_game.py --help-> exit 0.python -I -m unittest discover -s tests/semantic -v->Ran 1091 tests in 279.348s,OK.python -I -m unittest discover -s tests -p "test_make_game_wave64.py" -v->Ran 28 tests in 0.880s,OK.uv run --with pytest pytest tests/test_lane_masks.py tests/test_partial_wave_subgroup.py -q->9 passed in 0.43s.uv run --with pytest pytest tests/test_translate.py -q->293 skipped in 0.32s(requiresllvm-mcwithamdgcnandspirv-as/spirv-valonPATH).Checklist
docs/design.md, with how it was confirmed.