Skip to content

rdna2spirv: preserve never-launched bits in partial-wave lane masks - #8747

Open
Kalmarv wants to merge 3 commits into
ItsNotRexed:mainfrom
Kalmarv:fix/partial-wave-inverting-masks
Open

Kalmarv wants to merge 3 commits into
ItsNotRexed:mainfrom
Kalmarv:fix/partial-wave-inverting-masks

Conversation

@Kalmarv

@Kalmarv Kalmarv commented Nov 23, 2026

Copy link
Copy Markdown

New SHADER item (no numeric ID assigned in the claim) — claimed in #8344 (comment)
Depends on: none (based on main 6dda063). Head: 9c9641f.

Problem

A compute or mesh group whose size is not a multiple of the wave size ends in a partial wave: the last wave's lanes c..W-1 are never launched. Their bits are 0 in EXEC and in a VALU compare. A SALU bitwise op, though, computes all bits of the word (RDNA2 ISA SOP1/SOP2: D = S0 op S1, SCC = D != 0), so s_not_b64 s[12:13], vcc sets those bits. The translator keeps one bit per launched lane, so those bits were lost. In a 40-thread wave64, after v_cmp_eq vcc, v1, v1, the ops s_not_b64, s_orn2_b64 0, vcc, s_nand_b64 vcc, exec and s_xor_b64 vcc, -1 gave SCC 0 and an s_bcnt1 of 0 (the ISA gives SCC 1 and 24). A 20-thread wave32 fails the same way on vcc_lo.

Fix

Only modules with a partial wave are affected; every other module translates as before, and a test asserts that.

  • Each SGPR, VCC and VCC_HI gets a run-time shadow word (%sgpr_s, %vcc_s, %vcc_hi_s) holding its bits at the never-launched positions.
  • Every SGPR or VCC write resets the shadow to 0. s_and/or/xor/andn2/orn2/nand/nor/xnor/not/mov/cselect (b32/b64) compute it with the same op over the sources' shadows: a data register's shadow is its value, a constant's is the constant, EXEC's is 0.
  • A mask parked with v_writelane and restored with v_readlane keeps its shadow.
  • The shadow is stored next to the register, so it follows branches, joins and loops. It is not a static flag.
  • Readers: those ops' SCC, s_cmp_eq/lg_u32/u64 of a lane mask, and wave_mask (s_bcnt*, s_ff*, s_bitcmp* and the other whole-mask readers) add shadow & never-launched lanes of this wave. The wave is taken from LocalInvocationIndex, so in a 96-thread wave64 group only the second wave has such lanes.
  • s_wqm_b32/b64 of a lane mask in a partial module is computed from the whole word (launched bits plus shadow), with no quad operation. Where the launch ends inside a quad (group 42), the result takes bits from both sides of the boundary. Don't-care shadow bits at launched positions stay out of it: (~vcc & 0x300) in group 10 gives SCC 0 and 0 bits, and group 9 gives SCC 1 and 4 bits. No absent invocation is read.
  • Gen.partial / Gen.vcc_half have class-level defaults, so a Gen built without __init__ (as test_bitcast_round_trip does) still works.
  • The contract row "Partial-wave lane masks (never-launched lanes)" is added to docs/design.md.

Tests

The CPU expected words follow the ISA definitions, not a hardware measurement.

  • tests/semantic/test_partial_wave_inverted_masks.py (7 tests):
    • Wave64 groups 40, 96, 64, 42, 10, 9 and 8, native and --wave64-emulate on 32-wide subgroups; wave32 groups 20, 52, 32 and 18.
    • A join and a loop, parked masks, and s_wqm across a split quad. Partial native groups run on the stock spirv_mini_interp, with no quad operation left in the module.
    • Literal translator values: group 10 gives 0/0, group 9 gives 1/4, group 42 gives 44.
    • Full-wave controls check that the module is unchanged.
    • With the translator from main, 62 subtests fail.
  • The 58 mask-related semantic files (mask/wqm/scmp/ballot/exec/vcc/lane/partial/quad/bitcast/saveexec/flbit) all pass on 9c9641f.
  • Full suite run_semantic_tests.py -j 2 on 9c9641f: 448 files, 5963 tests, 3 files failed in 274 s. The first two match the exact base 6dda063 translator; the third matches the earlier baseline audit and is environment-dependent:
    • test_image_atomics_guard: 47 failures, and main's translator gives the same 47.
    • test_image_store_d16: 1 failure, 1 on main.
    • test_image_cube_store_glc: a FileNotFoundError in its llvm-mc round trip under the suite runner, which a main audit run also hit. Run on its own it passes on both main and this branch.
  • GPU, at a103e3c (RTX 5070 Ti, NVIDIA 610.74, Windows 11; 32-wide subgroups only, so no native wave64):
    • New fixtures cs_w64x_partial_not.asm (40-thread wave64) and cs_w32_partial_not.asm (20-thread wave32), registered in check.py and run_gpu_tests.py.
    • --filter partial native: 2/5 pass (cs_w32_partial_not, cs_w32_partial_scmp). The 3 cs_w64x_partial* fixtures skip because the device has no 64-wide subgroup.
    • --filter partial with LEONIDA_W64_EMULATE=1: 5/5 pass. cs_w64x_partial_not gives 1 24 1 24 1 0 24 64 and cs_w32_partial_not gives 1 12 1 12 1 0 0xffffffff 32.
    • The two new fixtures with main's translator: 0/2, giving the old words 0 0 0 0 0 0 0 40 and 0 0 0 0 0 0 0xffffffff 20.
    • The other partial-group fixtures whose SPIR-V changes: cmpx_class_f32, cvt_f32_sat, cvt_pk_u8, div_fmas_f64, f64_add, fma_fused, heap_init, signed_zero_nan, user_sgprs, workgroup_yz. All 10 pass native and 10/10 with emulation, with no skips.
    • The follow-up 9c9641f only adds class defaults that __init__ overrides, plus test and doc edits, so its translation output is the same as a103e3c's. The GPU runs were not repeated at 9c9641f.
  • check_no_game_data.py on the changed files: clean.

Not covered

  • Nothing is measured on AMD hardware. The GPU results are NVIDIA 32-wide (wave64 emulated) and show that the translation runs as intended, not that it matches hardware.
  • Corpus impact is not counted: no game files were used. How many shaders in the corpus take this path, and how their translated/valid counts change, is still open.
  • EXEC's never-launched bits are assumed to be 0. A write of ones to EXEC (s_mov_b64 exec, -1) would launch nothing here.
  • A mask read as data (v_mov_b32 vN, s12, a store) still gives this lane's bit. That is Translator: a lane mask read as data gives the wave's bits (SHADER-21 part 1, #210) #293's scope and is not touched here.
  • A mask combined with a data SGPR pair goes the data path.
  • s_flbit_i32_b64 of a lane mask is still refused, as before.
  • Vertex, pixel and geometry waves are not covered: the host decides how they are packed.

AI-assisted (Claude Code). No game data.

🤖 Generated with Claude Code

Kalmarv and others added 2 commits November 23, 2026 13:56
In a compute or mesh group whose size is not a multiple of the wave size, the
last wave has lanes that were never launched. Their bits are 0 in EXEC and in a
VALU compare, but a SALU op computes them with the rest of the word, so
s_not_b64 of VCC sets them (SCC 1, s_bcnt1 counts them). The translator keeps
one bit per launched lane, so those bits were lost: in a 40-thread wave64
s_not/s_orn2/s_nand/s_xor -1 of VCC gave SCC 0.

Modules with a partial wave (only those) keep a shadow word per scalar
register: its bits at the never-launched positions. Every SGPR/VCC write resets
it to 0; the SALU bitwise ops set it to the same op over the sources' shadows,
and parked masks keep it. Their SCC, s_cmp_eq/lg of a mask and wave_mask (the
whole-mask readers) add it. s_wqm of a lane mask there is taken from the whole
word, with no quad operation, so a quad split by the launch is exact both ways.

CPU-checked by tests/semantic/test_partial_wave_inverted_masks.py (62 subtests
fail before); GPU fixtures cs_w64x_partial_not and cs_w32_partial_not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gen.partial and Gen.vcc_half get class-level None, so emit/store_reg work
on a Gen built without __init__ (test_bitcast_round_trip makes one; it hit
AttributeError in emit). The split-quad s_wqm test now checks the
translator's words for groups 10, 9 and 42 instead of the model's; the
reviewer's agent name is dropped from the docs row and the test comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@smowlyy

smowlyy commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Verified head 9c9641f13 merged onto main (867d922f0) on native Windows 11 (10.0.26300.9974, Python 3.12.10, Vulkan SDK 1.4.363.0) across both 32-wide (NVIDIA) and 32/64-wide (AMD RDNA2) GPUs:

  • python -I scripts/check_no_game_data.py on all 7 changed files: clean (exit 0)
  • python -I -m unittest discover -s tests/semantic -p test_partial_wave_inverted_masks.py -v: 7/7 passed
  • python -I scripts/run_gpu_tests.py --build runtime/build --filter partial_not --require-pass on NVIDIA GeForce RTX 5060 Ti (driver 610.88, Vulkan 1.4.341, wave32): 2/2 translated and passed spirv-val; cs_w32_partial_not PASS (1 12 1 12 1 0 4294967295 32), cs_w64x_partial_not SKIP (no 64-wide compute subgroup)
  • LEONIDA_VK_DEVICE=Radeon python -I scripts/run_gpu_tests.py --build runtime/build --filter partial_not --require-pass on AMD Radeon(TM) Graphics (driver 24.10.24, Vulkan 1.3.280, wave32/wave64): 2/2 translated and passed spirv-val; cs_w32_partial_not PASS (1 12 1 12 1 0 4294967295 32), cs_w64x_partial_not PASS (1 24 1 24 1 0 24 64)

AI-assisted.

@trigger337

Copy link
Copy Markdown

Tested 9c9641f on AMD Radeon RX 6900 XT (RADV Navi 21, Mesa 26.2.5, Linux 7.3.1 CachyOS): pass

  • PYTHONPATH=tests/semantic python -I tests/semantic/test_partial_wave_inverted_masks.py: 7/7 passed.
  • python scripts/run_gpu_tests.py --build runtime/build/linux --filter partial_not: 2/2 passed (cs_w32_partial_not, cs_w64x_partial_not).
  • LEONIDA_W64_EMULATE=1 python scripts/run_gpu_tests.py --build runtime/build/linux --filter partial_not: 2/2 passed.
  • python scripts/run_gpu_tests.py --build runtime/build/linux: 227/243 passed, 16 skipped, 0 failures.
  • scripts/check_no_game_data.py: clean.

AI-assisted: yes
agent: yes

@TG0000

TG0000 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Hardware verification (gfx1030)

Head 9c9641f136fb, trial-merged into origin/main 867d922 (clean merge). GPU: AMD Radeon RX 6800 (gfx1030), Windows 11, AMD 26.11.2, Vulkan 1.4.363

  • compileall: ok
  • tests/semantic/test_partial_wave_inverted_masks.py: 7 tests OK
  • New GPU tests: cs_w32_partial_not PASS (1 12 1 12 1 0 4294967295 32), cs_w64x_partial_not PASS (1 24 1 24 1 0 24 64)
  • Full scripts/run_gpu_tests.py: 225/243 passed, 17 skipped; only failure is ms_wave_info_s3 (flake, also fails on bare main)
  • Baseline origin/main (867d922) on the same build: 223/241 passed, 17 skipped, 1 fail (ms_wave_info_s3, a known intermittent flake on this card).

No regressions. AI-assisted run (Claude Code).

@altLov3r

Copy link
Copy Markdown

Tested 9c9641f136 on Intel Arc A770 (Alchemist / Xe-HPG, PCI 0x8086:0x56a0, subgroup 8..32, 32-wide GPU, Windows 11, Intel driver 32.0.101.9150, Vulkan 1.4.359), llvm-mc 23.1.6, SPIRV-Tools 2026.4, Python 3.14.4: PASS.

  • python -m unittest discover -s tests/semantic -p test_partial_wave_inverted_masks.py -v: 7/7 OK (17.41 s).
  • python -I scripts/run_gpu_tests.py --build runtime\build --filter partial --require-pass (native): 5/5 translated & pass spirv-val; 2/5 passed, 3 skipped (cs_w32_partial_not and cs_w32_partial_scmp PASS; the 3 cs_w64x_* fixtures skip natively on 32-wide subgroups).
  • LEONIDA_W64_EMULATE=1 python -I scripts/run_gpu_tests.py --build runtime\build --filter partial --require-pass: 5/5 translated & pass spirv-val; 5/5 passed (cs_w32_partial_not, cs_w32_partial_scmp, cs_w64x_partial, cs_w64x_partial_not, cs_w64x_partial_scmp).

No game files. AI-assisted (Antigravity / Gemini 4 Neon).

@Grimkeh

Grimkeh commented Nov 23, 2026

Copy link
Copy Markdown

Tested 9c9641f136 on AMD Radeon RX 5500 XT (Navi 14, RADV), Mesa 25.0.7, Linux: pass.

Independent check. Synthetic shaders only, no game files. vk_compute_test was built from this head. llvm-mc 19.1.7. The device reports subgroup sizes 32..64.

--filter partial, native: 5/5 pass. The three cs_w64x_partial* fixtures ran at a pinned compute subgroup size of 64 (they skip where the device has no 64-wide subgroup). cs_w64x_partial_not read back 1 24 1 24 1 0 24 64.

--filter partial with LEONIDA_W64_EMULATE=1: 5/5 pass, same words.

The other fixtures whose SPIR-V this changes, run natively: cs_cmpx_class_f32, cs_cvt_f32_sat, cs_cvt_pk_u8, cs_div_fmas_f64, cs_f64_add, cs_fma_fused, cs_heap_init, cs_signed_zero_nan, cs_user_sgprs, cs_workgroup_yz. 10/10 pass. cs_fma_fused reports 0/7 f32 ops fused and 7/7 split under GLSL Fma, which this driver does and the harness still counts as a pass.

AI-assisted (Cursor).

@slint6614-dev

Copy link
Copy Markdown
Contributor

AMD Windows check of 9c9641f13 (AI-assisted). Windows 11 (10.0.26300), MSVC 2022 (Ninja, RelWithDebInfo), Python 3.12, AMD Adrenalin 26.11.2: Radeon RX 9070 (RDNA4, Vulkan driver 2.0.416) and Ryzen 9600X iGPU "AMD Radeon(TM) Graphics" (RDNA2 gfx1036, driver 2.0.353). Built vk_compute_test, vk_store_test and vk_harness from this branch.

  • scripts/run_gpu_tests.py --filter partial: 5/5 PASS on both GPUs, same words on both (cs_w32_partial_not 1 12 1 12 1 0 4294967295 32, cs_w64x_partial_not 1 24 1 24 1 0 24 64, plus cs_w32_partial_scmp, cs_w64x_partial, cs_w64x_partial_scmp); 5 translated, 5 pass spirv-val.
  • Negative control on the iGPU: the same run with tools/rdna2spirv.py from the merge base (6dda063) fails both new fixtures (cs_w32_partial_not 0 0 0 0 0 0 4294967295 20, cs_w64x_partial_not 0 0 0 0 0 0 0 40), 3/5, so the fixtures catch what the change fixes.

@Kalmarv

Kalmarv commented Nov 23, 2026

Copy link
Copy Markdown
Author

Please hold this PR: I found a defect in my own change while validating #8007, and a correction is in progress.

Combined with #8007 (5650615bd), this PR's partial-wave exact s_wqm path in Gen.shadow_pre replaces the instruction before #8007's corrected Gen.wqm runs. The merge is textually clean, but it silently undoes #8007 for partial waves:

Cause: the b32 source word is picked by shadow_half over all operands, which conflates the destination with the source, so opposite halves fall back to low. In b64, wave_mask(srcs[0]) assumes a canonical lo/hi pair.

Correction in progress: pick the source and destination halves independently, build b64 words per register or decline non-canonical pairs, and add persistent 40- and 20-lane regressions tested together with #8007. I'll post the update here with results. Full waves (64, and wave 0 of 96) are correct on every tree.

CPU interpreter, synthetic shaders only.

@wavehs wavehs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Audited the lane-mask math and the shadow lifecycle; no defect found.

  • unl_words is right for both wave sizes. With w, n = partial, c = n % w and ul = ((1 << w) - 1) & ~((1 << c) - 1) marks lanes c..w-1 of the last wave, wid = local_id >> log2(w) and wid == n // w selects that wave; the 64-bit split is ul & 0xFFFFFFFF / ul >> 32. I checked the three shapes: w=64, n=32 → lo 0, hi 0xFFFFFFFF; w=32, n=5 → lo 0xFFFFFFE0, hi 0; w=64, n=70 → wave 0 all zero, wave 1 lanes 6..63. g.partial is only set when group % wave (:17015-17017), so a full wave never calls it, and n < w (all invocations in wave 0) is the wid == 0 case, which is also the correct last wave.
  • Reset then set. put_mask sets self.vcc_half around its OpStore %vcc and clears it immediately (:6155-6159), so a half write resets only the half it changed and leaves the other half's shadow intact. shadow_post_op then stores the computed words directly as OpStore %vcc_s / OpStore %vcc_hi_s (:5884-5892), after the reset (the emit hook only matches OpStore %vcc / OpStore %vcc_hi , so it does not re-reset the _s stores), so the set wins.
  • The text match covers every writer today. Every VCC store goes through dst / put_mask (OpStore %vcc …, OpStore %vcc_hi …; :1611, :1613, :1617, :6158), and there is no path that writes VCC through an OpAccessChain. A one-line note in emit that the hook is a text match on those two stores (a future pointer-based write would slip past) would be enough.

Suite on this head (9c9641f13, macOS arm64): 448 files, 5963 tests, 2 files failed in 95 s with 12 jobs: test_image_atomics_guard, test_image_store_d16 — the two that already fail on origin/main 867d922 (reported to #8683), nothing else; the new file's 7 tests pass, and test_partial_wave_inverted_masks's stores/OpPhi output validates through spirv_mini_interp as the test asserts.

AI-assisted. macOS 27.2.1 arm64, Python 3.15.2; synthetic listings only, no game files.

@SpaghettiMaster545

Copy link
Copy Markdown

Tested 9c9641f13 merged onto main 867d922f0 (clean merge) on Windows 11 IoT Enterprise LTSC 2024 (26100), MSVC 14.50 (VS 2026) RelWithDebInfo + Ninja, Vulkan SDK 1.4.363.0, llvm-mc 23.1.6. Test programs were built from main; the PR changes no C++. Synthetic tests only, no game files.

--filter partial, three runs per configuration:

  • AMD Radeon Graphics (Ryzen 7 9800X3D iGPU, RDNA2 gfx1036), AMD 24.10.24 (Vulkan 2.0.302):
    • Native: 5/5. At a real 64-wide subgroup cs_w64x_partial_not gives 1 24 1 24 1 0 24 64, and cs_w32_partial_not gives 1 12 1 12 1 0 4294967295 32.
    • LEONIDA_W64_EMULATE=1: 5/5.
  • NVIDIA GeForce RTX 5070 Ti, 621.24: native 2/5 with 3 skipped; emulated 5/5, with the same words as AMD.

Negative control (this branch's fixtures with main's tools/rdna2spirv.py):

  • 3/5 on AMD native, AMD emulated and NVIDIA emulated, and 1/5 + 3 skipped on NVIDIA native.
  • The two new fixtures fail, with 0 0 0 0 0 0 4294967295 20 and 0 0 0 0 0 0 0 40.

Full run_gpu_tests.py: 249 translated, 249 spirv-val (main 247).

  • AMD native: 221/243 (20 skipped), twice; main 218/241.
  • NVIDIA native: 193/243 (49 skipped); main 192/241.
  • NVIDIA emulated: 225/243 (17 skipped), twice; main 223/241.
  • The only failures are the known ones, as on main, and the only status differences are the two new fixtures. The 10 fixtures whose SPIR-V changes pass on AMD native, NVIDIA native and NVIDIA emulated.

Semantic tests: test_partial_wave_inverted_masks.py 7/7 (with main's translator: 62 failures and 1 error). The full suite fails the same files as main, with the same counts.

Gap, not a regression: a lane-mask write the shadow doesn't model sets the shadow to 0, even where the ISA sets never-launched bits. main already translates wave64 s_bfm_b64 as a lane mask. In a 40-thread group (lanes 40–63 never launched):

s_bfm_b64 s[12:13], 4, 38      ; bits 38..41 (2 launched, 2 never launched)
s_bcnt1_i32_b64 s20, s[12:13]  ; ISA 4
s_not_b64 s[14:15], s[12:13]
s_bcnt1_i32_b64 s21, s[14:15]  ; ISA 60
s_bfm_b64 s[16:17], 8, 48      ; only never-launched lanes
s_bcnt1_i32_b64 s22, s[16:17]  ; ISA 8
s_cmp_lg_u64 s[16:17], 0       ; ISA SCC 1

This branch gives 2 62 0 0, main gives 2 38 0 0, and the ISA model gives 4 60 8 1. That is the same on AMD native and NVIDIA emulated. #8714's s_bitreplicate_b64_b32 vcc behaves the same way in a partial group. The expected values come from the RDNA2 ISA definitions, not from a hardware measurement. It may be worth a line under "Not covered".

Pass. AI-assisted (Claude Code).

In a partial-wave module s_wqm of a lane mask is taken from the gathered
words in place of the instruction. That path chose the source word of a
32-bit s_wqm from all its operands, so with the destination in one half and
the source in the other it fell back to lanes 0-31, and it took every SGPR
pair of s_wqm_b64 as (lanes 0-31, lanes 32-63). In a 40-thread wave64
s_wqm_b32 vcc_lo, vcc_hi left vcc_lo = 0xffffffff (0xff by the ISA
definition); in a 20-thread one it gave SCC 1 for vcc_hi = 0, where the
translator before this branch gave 0; s_wqm_b32 vcc_hi, vcc_lo was refused.

The 32-bit form now reads its source's half (vcc_hi, exec_hi, a MASK_HI
SGPR) and writes only its destination's lanes. The 64-bit form gathers a
pair whose words are not (low half, high half) one register at a time, each
from its own half; a 0 / -1 word is its constant. A single SGPR that is a
mask of unknown half is read as before (the destination's half, or its place
in the pair), and a pair with a plain-data word stays with Gen.wqm.

ItsNotRexed#8007 corrects the same forms in Gen.wqm for every module. This path replaces
the instruction in a partial-wave module, so merged with ItsNotRexed#8007 it undid that
fix there; found while checking the two together.

CPU-checked by PartialWaveWqmHalves in
tests/semantic/test_partial_wave_inverted_masks.py (12 programs in groups 40,
42, 20, 10 and 96, native and --wave64-emulate, and the 40- and 20-thread
words spelled out). No GPU run.

Co-Authored-By: Claude <noreply@anthropic.com>
@Kalmarv

Kalmarv commented Nov 23, 2026

Copy link
Copy Markdown
Author

Correction to this PR: partial-wave s_wqm read the wrong half when source and destination differ

While checking this branch together with #8007 I found a defect in my own change (head 9c9641f13). #8007 is correct on these cases; the problem was here.

In a partial-wave module this PR takes s_wqm of a lane mask from the gathered words, in place of the instruction. That path:

  • chose the source word of s_wqm_b32 from all operands, so with the destination in one half and the source in the other it fell back to lanes 0-31;
  • took every SGPR pair of s_wqm_b64 as (lanes 0-31, lanes 32-63), also when it was put together from 32-bit copies.

Because the path replaces the instruction, merging this PR with #8007 undid #8007's fix for partial waves.

40-thread wave64, vcc = lanes 0..39, then s_wqm_b32 vcc_lo, vcc_hi:

vcc_lo SCC bits set in vcc
ISA definition 0xff 1 16
#8007 alone 0xff 1 16
this PR at 9c9641f13, and merged with #8007 0xffffffff 1 40
this PR at cf695ee3c, alone and merged with #8007 0xff 1 16

In a 20-thread wave (vcc_hi = 0) 9c9641f13 gave SCC 1 where the translator before this PR (dde82f2) gives 0, a regression of this PR; s_wqm_b32 vcc_hi, vcc_lo was refused ("mask destination") in a partial-wave module.

Fix (cf695ee3c, one commit on top): the 32-bit form reads its source's half (vcc_hi, exec_hi, a MASK_HI SGPR) and writes only its destination's lanes. The 64-bit form gathers a pair whose words are not (low half, high half) one register at a time, each from its own half; a 0 / -1 word is its constant.

Left as they were:

Tests (CPU only, Windows 11, Python 3.13, synthetic programs, no game data):

  • New PartialWaveWqmHalves in tests/semantic/test_partial_wave_inverted_masks.py: 12 programs (opposite-half b32 into vcc_lo, vcc_hi and exec_lo, directly and through SGPR copies; swapped, doubled and half-and-constant b64 pairs) in groups 40, 42, 20, 10 and 96, native and --wave64-emulate, plus the 40- and 20-thread words spelled out. The file passes 9/9 at cf695ee3c. With the translator of 9c9641f13 the two new tests fail (18 failed subtests and 2 errors; the other 7 tests pass).
  • An 18-case scratch suite against a bit-exact model (SCC, bit counts of the mask and of each word, first set bit) in groups 64, 40, 42, 36, 20, 10 and 96, 144 wave cells:
tree ok wrong not counted
base dde82f27e 52 60 32
#8007 5650615bd 84 50 10
this PR 9c9641f13 73 57 12
9c9641f13 merged with #8007 81 49 12
this PR cf695ee3c 136 8 0
cf695ee3c merged with #8007 144 0 0

"Not counted" cells are refused forms or the interpreter's undefined value for a missing quad partner. The 8 cells still wrong at cf695ee3c alone are the mask-and-plain-data pairs, with the same words as base; they are #8007's and pass in the merge. No cell that passes on base or on 9c9641f13 fails at cf695ee3c. The merges are trial merges (git merge-tree, clean as text), not onto current main.

  • 39 lane-mask, wave64 and partial-wave files of tests/semantic at cf695ee3c: 614 tests pass.

Not done: the whole semantic suite, any GPU run, and AMD hardware. The expected words follow the ISA definition, not a measurement. Pixel shaders are not covered.

AI-assisted (Claude).

The branch is pushed at cf695ee3c, and the earlier hold is lifted. I have stopped active work on Leonida, so after this the PR is in reviewers' hands. If something here still needs changing, anyone may take it over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants