Repository navigation
Conversation
IAmNotSiob
left a comment
There was a problem hiding this comment.
tunczzz's cf_diff sweep already shows main's 43 mismatches go to 0 with this plus #615, and tests pass with main here (805). lgtm \o/ AI-assisted review (Claude Code).
|
GPU run of #663 (eb89f82), which asks for a 64-wide subgroup or Setup: Windows 11. AMD Radeon Graphics (Ryzen 7 7800X3D iGPU, RDNA2), driver 32.0.21043.5001, native wave64 (subgroup 32..64). RTX 4070 Ti SUPER, driver 610.88, subgroup 32. Test programs from main c432cdc (llvm-mingw clang), llvm-mc 23.1.6.
Native wave64 and emulated give the same words. (AI-assisted run, counts only.) |
|
Ran |
|
Tested eb89f82 on RTX 4090 (driver 621.14, 32-wide subgroups), Windows 11 26200: pass (32-wide half)
This still needs a native wave64 (AMD) run. No game files used. AI-assisted run (Claude Code). |
|
Tested #663 (eb89f82) on an NVIDIA GTX 1060 6GB (Pascal, subgroup 32..32, NVIDIA 582.78, With LEONIDA_W64_EMULATE=1 (this device has no 64-wide subgroup, so native wave64 skips as expected): |
…low-up to ItsNotRexed#477) s_not_b32 has its own handler and still set SCC from the lane's own bit after ItsNotRexed#477 moved the SOP2 forms to the wave vote. It now goes through scc_logic too (one or two sources). Reported by @kotorvr in ItsNotRexed#477. - tools/cf_ref.py models s_not_b32/b64; tools/cf_diff.py generates s_not in the sccmask/csel shapes; tests/test_cf_diff.py has the two s_not regression cases (and they fail with the old per-lane SCC). - runtime/test/shaders/cs_scc_mask32.asm: @kotorvr's compute test for s_and + s_cselect, s_andn2 + s_cbranch_scc1, s_not, s_or, s_xnor, registered as a wave32 dump in check.py and run_gpu_tests.py. - docs/design.md: s_not_b32 in the rule, the ItsNotRexed#477 GPU results and @kotorvr's corpus count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es, as main's new rule) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two wave64 findings of tools/cf_diff.py with new mask shapes:
- A register written to exec_lo (s_and_b32 exec_lo, exec_lo, vcc_lo;
s_mov_b32 exec_lo, s0) set all 64 lanes, and any op but s_mov_b32
into exec_hi was rejected ("destination exec_hi"). dst() now writes
one half through exec_half_write; the other half keeps its lanes.
- The SCC of a 32-bit op on one half of a mask (vcc_lo/hi, exec_lo/hi,
a half-mask SGPR) took the lane's own bit. scc_logic now votes over
that half (scc_any_half). The half comes from the sources, or from an
EXEC/VCC destination; an SGPR destination's old half is ignored.
A program with no SCC reader (s_cbranch_scc*, s_cselect, s_addc/subb,
s_cmov*, an scc operand) skips the vote, so --wave64-emulate does not
pay an exchange for an SCC nobody reads (keeps
test_wave64_emulate_reuses_a_mask_exchange at its counts).
Fuzzer: cf_ref treats every _b32 op as a 32-bit word op (halves
included) and models s_cmp_eq/lg_u64 and s_cselect_b64; cf_diff adds
e64 compares into SGPR masks (saveexec, v_cndmask), constant EXEC,
half-EXEC ops, half-mask SCC, s_cmp on masks and s_cselect between
masks, and counts literals in instruction sizes. GPU test
cs_w64_exec_half (wave64 dump; expected 1 0 1 1 0 3 9 9).
Depends on: ItsNotRexed#615
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eb89f82 to
a07e9e0
Compare
|
Rebased onto the rebased #615 (now
The GPU results above still apply. CPU, in WSL Ubuntu (Python 3.14, llvm-mc 21):
AI-assisted (Claude Code). |
|
Semantic suite on |
|
Tested a07e9e0 on Windows 11 (MSVC BuildTools 2022, Ninja, RelWithDebInfo, -j 4; no Vulkan validation layer installed), one GPU at a time, device line confirmed: AMD Radeon RDNA2 iGPU (driver 26.10.1) and NVIDIA RTX 5080 (driver 616.92). Ran AI-assisted. |
|
Tested a07e9e0 (a re-test at the new head) on AMD Radeon RX 9070 XT (RADV GFX1201, wave32/64) and the Ryzen 7 9800X3D iGPU (RADV RAPHAEL_MENDOCINO, gfx1036), Mesa 26.2.6, Linux 7.3.4: pass, no regressions.
No game files. AI-assisted. |
|
Tested
No game files used. AI-assisted (Claude Code). |
Flyander
left a comment
There was a problem hiding this comment.
Review of the wave64 EXEC-half write path.
| if a["k"] == "special" and a["t"] == "null": | ||
| return # result discarded | ||
| if a["k"] == "special" and a["t"] in ("exec_lo", "exec_hi") and self.wave64: | ||
| # One half of a wave64 EXEC: the lanes of the other half keep their state. Until 2026-11-22 a register |
There was a problem hiding this comment.
[P2] Preserve scalar mask bits when writing EXEC halves
val is not always a per-lane mask. For example, s_mov_b32 exec_hi, s0 with scalar s0 = 1 (or an arithmetic SALU result of 1) means only bit 0 of EXEC_HI should be set. Every wave lane sees that same nonzero SGPR, so exec_half_write turns val != 0 into true for all 32 lanes in the selected half. Please distinguish scalar/constant mask words from lane-mask values and select the bit for each lane; the current fixture only exercises mask-shaped values.
Item: FUZZ-8 finding, posted in #374: #374 (comment)
Depends on: #615 (stacked on it; only the last commit,
eb89f82, is new here).Overlaps #293 in three lines of
dst()(theexec_lodestination). #293 already conflicts withmain; whichever lands second keeps both: this adds a wave64-only case in front of that code.Findings (fixed here)
Found by
tools/cf_diff.pywith new mask shapes, reduced:exec_lochanged all 64 lanes.v_cmp_gt_u32 vcc, 8, v1; s_and_b32 exec_lo, exec_lo, vcc_lomust leave lanes 32-63 alone, butdst()stored%activefor every lane, so lanes 32-63 switched off.s_mov_b32 exec_lo, s0did the same. Any op buts_mov_b32intoexec_hiwas rejected (Unsupported: destination exec_hi). Nowdst()writesexec_lo/exec_hiin wave64 throughexec_half_write, the helper the constant moves ands_wqmalready use.s_and_b32 s50, vcc_hi, exec_hi; s_cbranch_scc0must vote over lanes 32-63 only.scc_logicnow usesscc_any_halfin wave64, with the half taken from the sources (or from an EXEC/VCC destination). An SGPR destination's old half is ignored: the fuzzer hit one whose earlier contents were the low half of a 64-bit mask.Cost guard: a program in which nothing reads SCC (
s_cbranch_scc*,s_cselect,s_addc/s_subb,s_cmov*, anscc/src_sccoperand) skips the vote inscc_logic, so--wave64-emulatedoesn't pay an exchange (a round and a barrier) for an SCC nobody reads. That keepstest_wave64_emulate_reuses_a_mask_exchangeat its counts. A program that reads SCC anywhere still votes.Fuzzer
tools/cf_ref.py: every_b32op is a 32-bit word op (exec_lo/hi,vcc_lo/hi, SGPRs), which is what the hardware does in both wave sizes. It also addss_cmp_eq/lg_u64ands_cselect_b64.tools/cf_diff.py, new shapes:v_cmp_*_e64into an SGPR mask feedings_and_saveexecandv_cndmask_b32_e64; constant EXEC (s_mov_b32 exec_lo/exec_hi, literal);s_and_b32on one EXEC half; SCC of half-mask ops;s_cmpof masks against 0;s_cselectbetween masks. Instruction sizes now count literals.destination exec_hi) in 600 cases, all wave64. After: 0 and 0. Another 2,000+ cases pass after rebasing, including 800 with--spirv-val.tests/test_cf_diff.py: five half-mask regression cases in both forms. All 10 fail on the old translator.GPU test
runtime/test/shaders/cs_w64_exec_half.asmis a wave64 dump (one wave64, 64 threads) registered incheck.pyandrun_gpu_tests.py. Expectedout[0..7] = 1 0 1 1 0 3 9 9. With the old translator, (A) givesout[2] = 0, (B) does not translate, and (C) givesout[5] = 7andout[6] = 4. It needs a 64-wide subgroup orLEONIDA_W64_EMULATE=1; it builds and passes spirv-val both ways. Not run on a GPU by me (no Vulkan SDK here).Tests
Ubuntu (WSL), llvm-mc 21, SPIRV-Tools 2026.1, on c432cdc:
pytest tests --ignore=tests/semanticgives 1940 passed, 44 skipped, 1 xfailed;unittest discover -s tests/semanticOK. Not counted over the corpus (no copy of the game here).AI-assisted (Claude Code). No game data.
🤖 Generated with Claude Code