Repository navigation
Conversation
mask_src returned an SGPR's raw value as this lane's mask, so plain wave-uniform data read as all lanes on whenever non-zero. Take bit 'lane' of it (r+1 for lanes 32-63 of a wave64 pair) unless lane_masks.py certified the register. Adds a design.md row and CPU tests for wave32 and wave64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ne mask Add cs_w32_mask_sgpr and cs_w64_mask_sgpr GPU tests (check.py, run_gpu_tests.py), move the CPU tests onto generated fixtures, add a mask-and-data pair test, and test that --wave64-emulate translates the same bit test (the interpreter cannot run the emulated form). Comment the single-SGPR wave64 case. Rewrite the design.md row: ISA semantics, CPU and GPU tests, corpus counts, ItsNotRexed#293 note and the subgroup-size contract for graphics stages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…:N+1] The corpus listing prints the VOP3 mask operand of v_cndmask in wave32 syntax (sN, like vcc_lo) in wave64 shaders too, where the hardware reads the 64-bit pair. Every single-SGPR site that reached the data-SGPR bit test in wave64 was this operand; lanes 32-63 now take their bit from r+1 instead of r. Certified masks are read as before. CPU tests for listing syntax and for a certified single register; design.md row updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-10 tier C; test and doc fixes A b32 (wide=False) read in wave64 takes bit lane mod 32 of r. A 32-lane half cannot read r+1 for the high half, so wave64_halves.py reports mask-data for a data SGPR as the mask of v_cndmask / v_addc_co. design.md row lists the listing-syntax test and no longer calls the sN widening GPU-tested; asm comments name lanes 4-11, 20-23 and 28-31; dead emulate scaffolding removed from the test. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Tested c5bea9e (base 003e781) on AMD Radeon RDNA2 iGPU (Ryzen 9 9950X3D, driver 26.10.1, subgroups 32..64, wave64 native) and NVIDIA RTX 5080 (616.92, subgroups 32), Windows 11: pass. Commands (runtime built from main 003e781, translator from this head):
Remarks: the native wave64 pass on the Radeon is the useful addition to the RTX 4090 result in the description, since there the wave64 tests skip without emulation. Diff of AI-assisted. |
|
Thanks @Vonsek, that's the missing half: on the RTX 4090 the wave64 tests only ran under emulation, so your native wave64 11/11 on RDNA2 (and red on main for both AI-assisted (Claude Code). |
|
Tested c5bea9e on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass. The PR's diff applied cleanly to
|
|
Tested c5bea9e (base 003e781) on Windows 11 (build 26200): pass.
Runtime and test programs built from this head ( AI-assisted (Claude Code). |
|
Tested
AI-assisted (ZCode agent): builds and runs executed by a coding agent on this machine. |
|
Thanks. #1792 is merged and gives each lane its own bit when a constant in an SGPR is read as a lane mask, so I'm closing this as a duplicate. |
|
Thanks, agreed: #1792 has the
AI-assisted (Claude Code). |
Claimed in the coordination issue as: SHADER-200
Depends on: none (builds on #1367, merged; see the note on #293 below)
What and why
Gen.mask_srcread an SGPR thatlane_masks.pydoesn't certify as a lane mask as "all lanes on" whenever the value was nonzero. The hardware reads bit L of the mask for lane L. An SGPR holding plain data (an SMEM-loaded bitmask combined with EXEC/VCC, or a register that is data on some paths) therefore turned on every lane where it should have turned on only the lanes whose bits are set.((v >> (L & 31)) & 1) ? ~0 : 0. A wave64 pair (wide, the b64 forms) reads r for lanes 0-31 and r+1 for lanes 32-63. A b32 read (wide=False, Translator: a constant lane mask gives lane L its bit L (mask_src immediates) #1367's convention) takes bit L mod 32 of r, as Translator: a constant lane mask gives lane L its bit L (mask_src immediates) #1367 does for immediates. A register that is already in per-lane form (0 or ~0) gives the same value, so certified masks don't change.v_cndmaskin wave64: the corpus listing prints the VOP3 mask operand in wave32 syntax (s4, likevcc_lo) in wave64 shaders too. llvm-mc (gfx1030) encodesv_cndmask_b32_e64 v0, v1, v2, s[4:5]in wave64 to the same bytes that wave32 disassembly prints ass4. An uncertifiedsNthere is read as the pair s[N:N+1]. This covers 24,138 sites in 5,365 shaders.wave64_halves.pytherefore reportsmask-datawhen a data SGPR is the mask ofv_cndmaskorv_addc/v_subb/v_subbrev_co, which makes the shader tier C. Under the default--wave64-graphics=warnnothing is refused. Over the corpus, 19 shaders move from tier A or B to C, and 4,201 tier-C shaders listmask-dataamong their reasons.s_and_b6471k,s_and_saveexec_b6467k,s_or_b6428k,v_cndmask24k.s_lshl_b32sites in 28 shaders shift a per-lane mask as data; they are wrong before and after this change. That is Translator: a lane mask read as data gives the wave's bits (SHADER-21 part 1, #210) #293's direction, mask read as data.mask_srccallers, such as a VOP3 carry-in, could see a wave64sNin wave32 syntax too. The corpus has 0 such sites today.mask_srcchange (bit L of a non-mask SGPR, the high SGPR for lanes 32-63 of a wave64 pair) is the same as this PR's core. SHADER-200 was claimed on Coordinating who works on what (5) (moved to #1380) #1218 at 09:59 UTC; rdna2spirv: a constant used as a lane mask through an SGPR (or a b32 SOP2 on EXEC) gives each lane its bit #1792 was claimed on Coordinating who works on what (7) (moved to #1745) #1548 at 14:10 from a finding of 14:02.mask_src(sop2_b32_srcs), ands_mov_b32 exec_lo/hi, sNtaking each lane's bit.v_cndmasksNpair read, the SHADER-10mask-datatier, GPU tests that fail on main, and the corpus count.lane_masks.pytracks into an SGPR as bit L. This PR reads bit L of any SGPR the analysis doesn't flag, constant or not, so it covers those cases too; the two touch the same lines ofmask_src.load_regline toraw=True. Whichever PR lands second keepsraw=Trueon both the r and r+1 loads.The new row is in the
docs/design.mdcontract table.Tested
cs_w32_mask_sgprandcs_w64_mask_sgpr(wave64 withLEONIDA_W64_EMULATE=1) fail on main and pass with this change.v_cndmaskmask pair whose lanes 40-47 come from s5, and a mask ANDed with data.--filter masktests pass with emulation, including Translator: a constant lane mask gives lane L its bit L (mask_src immediates) #1367'scs_w32/w64_mask_imm. Without emulation the wave64 tests skip: this device has no 64-wide compute subgroups.s[4:5]. ThesNlisting-syntax widening is covered by a CPU test and the llvm-mc encoding check above.tests/semantic/test_mask_src_data_sgpr.py: wave32, wave64 pairs, a b32 read in wave64, a mask ANDed with data, certified masks unchanged, andv_cndmasklisting syntax.test_wave64_halves.py:test_c_data_sgpr_as_lane_mask.regen_fixtures.py, and--checkpasses.unittest discover -s tests/semantic: 1,581 OK.pytest tests: 5,903 passed, 91 skipped; 7 failures (test_cf_refexec_hi,test_make_game_assets_pools,test_world_names) fail on main 003e781 the same way.RESULT OK: 26503 shaders: 26487 translated, 26487 pass spirv-val.RESULT OK: 26503 shaders: 26487 translated, 26487 pass spirv-val. The 16 untranslated shaders are the same on both sides (main's)..spvchange, the shaders that read an uncertified SGPR as a mask (13,518 on the earlier base, where all 26,503 translated); 12,985 are byte-identical.Checklist
.asm; only counts are given.docs/design.md, with how it was confirmed (GPU test, llvm-mc encoding, corpus count).AI-assisted: yes (Claude Code).
🤖 Generated with Claude Code