Recompiler: fix per-lane cross-lane mask lowering bugs #2118

Merged
Decodere merged 1 commit from upstream-pr/2128 into main 2026-11-29 12:18:12 +00:00
Decodere commented 2026-11-25 05:27:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-25T05:27:32Z.


What is in it

Fixes four per-lane cross-lane wave lowering bugs in crates/xcl/src/gpu/recomp/lower/wave.rs:

  1. V_MBCNT_HI_U32_B32 half-wave ballot and mask addend (wave_valu): hi_half was unconditionally true for V_MBCNT_HI_U32_B32, calling ballot_half even when SRC0 was the lower dword of a wave64 mask (e.g. vcc_lo or exec_lo), which left lanes 32..63 reading their own half's ballot instead of lanes 0..31's bits. hi_half is now only set when SRC0 is the upper dword of a wave64 mask pair (matches!(self.mask_reg(b, s0), Some((_, true)))). SRC1 is also now read via self.word(b, d, s1)? instead of self.src(...), so a mask SGPR can be used as the addend.
  2. Wave32 64-bit SGPR pairs with a mask in either half (words, wave_salu): In wave32, masks are single 32-bit SGPRs, so a 64-bit operand s[r:r+1] (r in 0..=106, including vcc_lo/vcc_hi) can hold a mask in r with an independent scalar number in r+1, or a number in r with a mask in r+1. Previously words() zeroed the upper dword whenever r held a mask, and wave_salu() skipped instructions where only r+1 held a mask (causing the fallback path to fail with "a mask read as a number"). words() now lowers wave32 0..=106 pairs dword-by-dword via word(), and wave_salu() checks s0 + 1 in wave32 _B64 mask counts while keeping EXEC (126) mapped to [ballot(exec), 0].
  3. V_READFIRSTLANE_B32 and V_READLANE_B32 mask SRC0 (wave_valu): Both instructions read SRC0 via self.src(b, d, s0)?, rejecting mask SGPRs (such as vcc_lo), unlike V_WRITELANE_B32 which already used self.word(b, d, s0)?. Both now use self.word(b, d, s0)?.
  4. MaskOp::Bcnt stale-SCC tracking (wave_salu): S_BCNT{0,1}_I32_B{32,64} wrote SCC via raw self.ssa.write(b, Var::Scc, c) instead of self.write_scc(b, c), bypassing own() so a stale SCC written inside a partial block and read after a lane join was not detected or refused. It now calls self.write_scc(b, c).

Adds five regression tests in gpu::recomp::lower::wave::tests: four deterministic CPU tests covering all four bugs plus a WARP-guarded GPU parity test (gpu_wave_fixes_agree_with_hlsl) comparing per-lane direct DXIL against HLSL on both split-wave64 and wave32.

Part of #1269

Tested

Hardware/toolchain: Windows 11 (26200), NVIDIA GeForce RTX 4060 (32-lane waves, driver 621.14), DXC 1.9.2609.5 (01b62ad4), Rust 1.100.0.

  • Verified pre-fix failures on the regression tests before applying the fixes (s106: a mask read as a number, unsupported S_BCNT1_I32_B64 (s5: a mask read as a number), wrong upper-half counts / zeroed high SGPR, and unrefused stale SCC).
  • cargo test --release -p xcl --lib gpu::recomp::lower::wave::tests:: -- --nocapture --test-threads=1 on RTX 4060: 5 passed, 0 failed, 0 ignored (0 skipped; gpu_wave_fixes_agree_with_hlsl ran on GPU for split-wave64 mbcnt_hi_low_mask and wave32 wave32_b64_mixed_mask / readlane_of_mask).
  • CI WARP check (XCL_ADAPTER="Microsoft Basic Render Driver" and XCL_ADAPTER=warp) on gpu::recomp::lower::wave::tests::: 5 passed, 0 failed, 0 ignored (4 CPU tests passed; gpu_wave_fixes_agree_with_hlsl cleanly reported SKIPPED ...: no GPU with 32-lane waves).
  • cargo build --release --workspace: exit 0.
  • cargo test --release --workspace -- --test-threads=4: 1159 passed, 0 failed, 46 ignored across 21 test suites, with 25 pre-existing runtime SKIPPED lines (23 native wave64 / unsupported per-lane lowering skips on 32-lane RTX 4060, 1 Windows driver-cache skip, 1 heap-window skip; 0 new skips).

Regression run

Paired 60-second scripts/smoke.ps1 runs on the same retail title build (29640639) from clean origin/main (6020a33) and this branch (9e08a5a):

Base (origin/main):

xcl-smoke v1
commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1614 (PresentX 1614)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 14532 MB

PR (fix-1269-perlane-wave-bugs):

xcl-smoke v1
commit: 9e08a5a82b408f3272f7e340f56795946ba249ac
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1578 (PresentX 1578)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14507 MB

Not tested

  • Native 64-lane wave64 GPU hardware (the test GPU is a 32-lane NVIDIA RTX 4060; split-wave64 V_MBCNT_HI_U32_B32 was verified on both the CPU interpreter and the RTX 4060 GPU against HLSL).
  • Non-Windows host platforms.

AI use

Drafted with Google Antigravity (Gemini 4 Neon) and verified locally by reproducing failures before the fix, checking CPU and RTX 4060 GPU parity against HLSL, checking WARP adapter skips, running the full release workspace test suite, and completing the paired 60-second smoke run above.

<!-- greyfinch-sync:ivall/xcl:issue:5485726033 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2128). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-25T05:27:32Z. --- **What is in it** Fixes four per-lane cross-lane wave lowering bugs in `crates/xcl/src/gpu/recomp/lower/wave.rs`: 1. **`V_MBCNT_HI_U32_B32` half-wave ballot and mask addend (`wave_valu`)**: `hi_half` was unconditionally `true` for `V_MBCNT_HI_U32_B32`, calling `ballot_half` even when `SRC0` was the lower dword of a wave64 mask (e.g. `vcc_lo` or `exec_lo`), which left lanes `32..63` reading their own half's ballot instead of lanes `0..31`'s bits. `hi_half` is now only set when `SRC0` is the upper dword of a wave64 mask pair (`matches!(self.mask_reg(b, s0), Some((_, true)))`). `SRC1` is also now read via `self.word(b, d, s1)?` instead of `self.src(...)`, so a mask SGPR can be used as the addend. 2. **Wave32 64-bit SGPR pairs with a mask in either half (`words`, `wave_salu`)**: In wave32, masks are single 32-bit SGPRs, so a 64-bit operand `s[r:r+1]` (`r` in `0..=106`, including `vcc_lo`/`vcc_hi`) can hold a mask in `r` with an independent scalar number in `r+1`, or a number in `r` with a mask in `r+1`. Previously `words()` zeroed the upper dword whenever `r` held a mask, and `wave_salu()` skipped instructions where only `r+1` held a mask (causing the fallback path to fail with `"a mask read as a number"`). `words()` now lowers wave32 `0..=106` pairs dword-by-dword via `word()`, and `wave_salu()` checks `s0 + 1` in wave32 `_B64` mask counts while keeping `EXEC` (`126`) mapped to `[ballot(exec), 0]`. 3. **`V_READFIRSTLANE_B32` and `V_READLANE_B32` mask `SRC0` (`wave_valu`)**: Both instructions read `SRC0` via `self.src(b, d, s0)?`, rejecting mask SGPRs (such as `vcc_lo`), unlike `V_WRITELANE_B32` which already used `self.word(b, d, s0)?`. Both now use `self.word(b, d, s0)?`. 4. **`MaskOp::Bcnt` stale-SCC tracking (`wave_salu`)**: `S_BCNT{0,1}_I32_B{32,64}` wrote `SCC` via raw `self.ssa.write(b, Var::Scc, c)` instead of `self.write_scc(b, c)`, bypassing `own()` so a stale `SCC` written inside a partial block and read after a lane join was not detected or refused. It now calls `self.write_scc(b, c)`. Adds five regression tests in `gpu::recomp::lower::wave::tests`: four deterministic CPU tests covering all four bugs plus a WARP-guarded GPU parity test (`gpu_wave_fixes_agree_with_hlsl`) comparing per-lane direct DXIL against HLSL on both split-wave64 and wave32. Part of #1269 **Tested** Hardware/toolchain: Windows 11 (26200), NVIDIA GeForce RTX 4060 (32-lane waves, driver 621.14), DXC `1.9.2609.5 (01b62ad4)`, Rust `1.100.0`. - Verified pre-fix failures on the regression tests before applying the fixes (`s106: a mask read as a number`, `unsupported S_BCNT1_I32_B64 (s5: a mask read as a number)`, wrong upper-half counts / zeroed high SGPR, and unrefused stale `SCC`). - `cargo test --release -p xcl --lib gpu::recomp::lower::wave::tests:: -- --nocapture --test-threads=1` on RTX 4060: **5 passed, 0 failed, 0 ignored** (0 skipped; `gpu_wave_fixes_agree_with_hlsl` ran on GPU for split-wave64 `mbcnt_hi_low_mask` and wave32 `wave32_b64_mixed_mask` / `readlane_of_mask`). - CI WARP check (`XCL_ADAPTER="Microsoft Basic Render Driver"` and `XCL_ADAPTER=warp`) on `gpu::recomp::lower::wave::tests::`: **5 passed, 0 failed, 0 ignored** (4 CPU tests passed; `gpu_wave_fixes_agree_with_hlsl` cleanly reported `SKIPPED ...: no GPU with 32-lane waves`). - `cargo build --release --workspace`: exit 0. - `cargo test --release --workspace -- --test-threads=4`: **1159 passed, 0 failed, 46 ignored** across 21 test suites, with 25 pre-existing runtime `SKIPPED` lines (23 native wave64 / unsupported per-lane lowering skips on 32-lane RTX 4060, 1 Windows driver-cache skip, 1 heap-window skip; 0 new skips). **Regression run** Paired 60-second `scripts/smoke.ps1` runs on the same retail title build (`29640639`) from clean `origin/main` (`6020a33`) and this branch (`9e08a5a`): Base (`origin/main`): ``` xcl-smoke v1 commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1614 (PresentX 1614) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 14532 MB ``` PR (`fix-1269-perlane-wave-bugs`): ``` xcl-smoke v1 commit: 9e08a5a82b408f3272f7e340f56795946ba249ac gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1578 (PresentX 1578) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14507 MB ``` **Not tested** - Native 64-lane wave64 GPU hardware (the test GPU is a 32-lane NVIDIA RTX 4060; split-wave64 `V_MBCNT_HI_U32_B32` was verified on both the CPU interpreter and the RTX 4060 GPU against HLSL). - Non-Windows host platforms. **AI use** Drafted with Google Antigravity (Gemini 4 Neon) and verified locally by reproducing failures before the fix, checking CPU and RTX 4060 GPU parity against HLSL, checking WARP adapter skips, running the full release workspace test suite, and completing the paired 60-second smoke run above.
DarkPanda69 commented 2026-11-25 06:06:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T05:51:05Z.


Tested: gpu_wave_fixes_agree_with_hlsl passes on an AMD D3D12 driver and on an RTX 3060.

  • RX 9070 XT (RDNA4, driver 32.0.32029.2010): ok. Whole gpu:: filter: 589 passed, 2 failed, 22 ignored. The 2 failures are the AMD fuzz seeds 722 and 1599 tracked in #2115, which fail the same way on main.
  • RTX 3060 (driver 32.0.16.1088): ok. 591 passed, 0 failed, 22 ignored.

Head 9e08a5a applied on main 6e1e2be, cargo test -p xcl --lib -- gpu:: --test-threads=4 with XCL_ADAPTER set to each card.
The test's wave64 cases use the split form (kernel_split, split_wave64: true), so even on the 9070 XT they do not run in native 64-lane waves. This is an AMD driver result, not the native wave64 check the PR lists as untested.
Not tested: native wave64 per-lane, retail runs.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7154198773 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2128#issuecomment-7154198773). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-25T05:51:05Z. --- Tested: `gpu_wave_fixes_agree_with_hlsl` passes on an AMD D3D12 driver and on an RTX 3060. - RX 9070 XT (RDNA4, driver 32.0.32029.2010): ok. Whole `gpu::` filter: 589 passed, 2 failed, 22 ignored. The 2 failures are the AMD fuzz seeds 722 and 1599 tracked in #2115, which fail the same way on `main`. - RTX 3060 (driver 32.0.16.1088): ok. 591 passed, 0 failed, 22 ignored. Head `9e08a5a` applied on `main` `6e1e2be`, `cargo test -p xcl --lib -- gpu:: --test-threads=4` with `XCL_ADAPTER` set to each card. The test's wave64 cases use the split form (`kernel_split`, `split_wave64: true`), so even on the 9070 XT they do not run in native 64-lane waves. This is an AMD driver result, not the native wave64 check the PR lists as untested. Not tested: native wave64 per-lane, retail runs. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
JoaoPauluu commented 2026-11-25 07:05:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-25T06:12:09Z.


A run with vkd3d-proton as the host D3D12. The DXIL goes through dxil-spirv and then the NVIDIA Vulkan driver, not the native-Windows path: this PR's 5 new tests pass, none skipped.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. 9e08a5a as it is (merge base with main 6020a33), no uncommitted changes. The lib test binary runs under Wine, one test per process.
    • bcnt_scc_written_in_partial_block_is_detected_as_stale: ok
    • gpu_wave_fixes_agree_with_hlsl: ok
    • mbcnt_hi_of_low_mask_and_mask_addend_on_cpu: ok
    • readfirstlane_and_readlane_accept_mask_sgpr_on_cpu: ok
    • wave32_b64_mask_counts_preserve_independent_high_sgpr_on_cpu: ok

Not tested

  • the whole suite on this head, a retail title, native Windows, AMD.

AI use

  • Claude Code (Claude Opus 5.5) built the commit, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
<!-- greyfinch-sync:ivall/xcl:comment:7154547184 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2128#issuecomment-7154547184). Originally posted by [JoaoPauluu](https://github.com/JoaoPauluu) on 2026-11-25T06:12:09Z. --- A run with vkd3d-proton as the host D3D12. The DXIL goes through dxil-spirv and then the NVIDIA Vulkan driver, not the native-Windows path: this PR's 5 new tests pass, none skipped. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `9e08a5a` as it is (merge base with `main` `6020a33`), no uncommitted changes. The lib test binary runs under Wine, one test per process. - `bcnt_scc_written_in_partial_block_is_detected_as_stale`: ok - `gpu_wave_fixes_agree_with_hlsl`: ok - `mbcnt_hi_of_low_mask_and_mask_addend_on_cpu`: ok - `readfirstlane_and_readlane_accept_mask_sgpr_on_cpu`: ok - `wave32_b64_mask_counts_preserve_independent_high_sgpr_on_cpu`: ok **Not tested** - the whole suite on this head, a retail title, native Windows, AMD. **AI use** - Claude Code (Claude Opus 5.5) built the commit, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
DavidM1911 commented 2026-11-25 07:05:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T06:32:33Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7154897815 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2128#issuecomment-7154897815). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T06:32:33Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
JJAutoCompare commented 2026-11-25 08:08:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T07:12:05Z.


Tested

  • Clean detached 9e08a5a82b408f3272f7e340f56795946ba249ac on Windows 11 Enterprise Evaluation 25H2 (26200.9974), Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175. Rust/Cargo 1.100.0 (x86_64-pc-windows-msvc), DXC/DXIL 1.9.2609.5. Debug/test profile with debuginfo and incremental compilation disabled.
  • Prebuilt with cargo test --locked -p xcl --lib --no-run --jobs 2 --message-format=json-render-diagnostics. Under the Arc mutex with XCL_ADAPTER=A770, ran the pinned Cargo artifact as xcl-97fdf2b9ff8e1482.exe gpu::recomp::lower::wave::tests::gpu_wave_fixes_agree_with_hlsl --exact --nocapture --test-threads=1. The binary digest matched before and after lock acquisition and after exit.
  • 1 passed, 0 failed, 0 ignored, 0 GPU skips, 1128 filtered out, 3.22 s. Direct DXIL matched HLSL/DXC readback in all 133 comparisons. Split wave64 covered the low-mask source and mask addend for V_MBCNT_HI_U32_B32 across all 64 logical lanes. Wave32 covered mixed mask/scalar B64 counts and find-first-bit, plus V_READFIRSTLANE_B32 and V_READLANE_B32 with a mask source. The fixture reports equality without printing passing readback values.

Not tested

Native wave64, CPU tests including stale-SCC refusal, overflow or invalid inputs, the workspace suite, retail smoke, and other adapters.

AI use

T3 Code / Codex (gpt-6.2-sol) built and ran the existing fixture and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7155598204 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2128#issuecomment-7155598204). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T07:12:05Z. --- **Tested** - Clean detached `9e08a5a82b408f3272f7e340f56795946ba249ac` on Windows 11 Enterprise Evaluation 25H2 (`26200.9974`), Ryzen 7 3800X, Intel Arc A770 driver `32.0.101.9175`. Rust/Cargo `1.100.0` (`x86_64-pc-windows-msvc`), DXC/DXIL `1.9.2609.5`. Debug/test profile with debuginfo and incremental compilation disabled. - Prebuilt with `cargo test --locked -p xcl --lib --no-run --jobs 2 --message-format=json-render-diagnostics`. Under the Arc mutex with `XCL_ADAPTER=A770`, ran the pinned Cargo artifact as `xcl-97fdf2b9ff8e1482.exe gpu::recomp::lower::wave::tests::gpu_wave_fixes_agree_with_hlsl --exact --nocapture --test-threads=1`. The binary digest matched before and after lock acquisition and after exit. - **1 passed, 0 failed, 0 ignored, 0 GPU skips**, 1128 filtered out, 3.22 s. Direct DXIL matched HLSL/DXC readback in all 133 comparisons. Split wave64 covered the low-mask source and mask addend for `V_MBCNT_HI_U32_B32` across all 64 logical lanes. Wave32 covered mixed mask/scalar B64 counts and find-first-bit, plus `V_READFIRSTLANE_B32` and `V_READLANE_B32` with a mask source. The fixture reports equality without printing passing readback values. **Not tested** Native wave64, CPU tests including stale-SCC refusal, overflow or invalid inputs, the workspace suite, retail smoke, and other adapters. **AI use** T3 Code / Codex (gpt-6.2-sol) built and ran the existing fixture and wrote this report.
github-actions[bot] commented 2026-11-28 20:18:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:18:54Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7245195217 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2128#issuecomment-7245195217). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T20:18:54Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Kalmarv commented 2026-11-29 00:33:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T00:33:54Z.


merge-check
base: fa204595a4
head: 9e08a5a82b
merge: clean (trial merge a5984b5fe9a8d558272c23ee00fa3548f83c1375, local, not pushed; git diff --check clean)
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609) -> 2613 passed, 0 failed, 49 ignored; SKIPPED: 26 (21 no wave64 on this 32-lane GPU, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows); failing: none. All 5 new gpu::recomp::lower::wave::tests ran and passed. That includes gpu_wave_fixes_agree_with_hlsl, which ran on the GPU (not skipped): direct DXIL against HLSL, split wave64 for mbcnt_hi_low_mask and wave32 for the other two.
review: none blocking; whole diff read (lower/wave.rs only).

  1. V_MBCNT_HI_U32_B32 takes ballot_half only when SRC0 is the upper dword of a wave64 mask. A low-dword mask (vcc_lo) now gets the full ballot's low word on every lane. That is what lanes 32..63 need, because the instruction counts SRC0's bits as a number. In wave32, lt is 0 on every lane, so the result is still SRC1, as on hardware.
  2. In wave32, words() for s0..s106 pairs reads each dword with word(), so a mask in one half and a number in the other both survive. EXEC (126) keeps [ballot(exec), 0]. wave_salu also takes _B64 counts whose mask is in s0 + 1.
  3. V_READFIRSTLANE_B32 / V_READLANE_B32 read SRC0 through word(), as V_WRITELANE_B32 already does.
  4. S_BCNT* writes SCC through write_scc, so a stale SCC after a lane join is refused.
    Note, not blocking: v_mbcnt_hi_u32_b32 v, exec_lo, ... now asks for the full ballot (half = false). In a partial block of a split wave64 it is refused, where before it compiled with the wrong half-ballot. The usual idiom (mbcnt_lo exec_lo then mbcnt_hi exec_hi) is unchanged, because exec_hi is the upper dword.
    performance: none expected. The same ops are emitted, except for one extra word() per wave32 _B64 operand in s0..s106. Not measured. No title run: Recompiler / Tier 1.
    verdict: safe to merge
    hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, DXC 1.9.2609 via XCL_DXC_DIR. Claude Code, Claude Opus 5.5: merge, build, suite and full-diff review; this report.
<!-- greyfinch-sync:ivall/xcl:comment:7248199809 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2128#issuecomment-7248199809). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-29T00:33:54Z. --- merge-check base: fa204595a488c60c6c5f905244f0172072c9c2a9 head: 9e08a5a82b408f3272f7e340f56795946ba249ac merge: clean (trial merge a5984b5fe9a8d558272c23ee00fa3548f83c1375, local, not pushed; `git diff --check` clean) build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609) -> 2613 passed, 0 failed, 49 ignored; SKIPPED: 26 (21 no wave64 on this 32-lane GPU, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows); failing: none. All 5 new `gpu::recomp::lower::wave::tests` ran and passed. That includes `gpu_wave_fixes_agree_with_hlsl`, which ran on the GPU (not skipped): direct DXIL against HLSL, split wave64 for `mbcnt_hi_low_mask` and wave32 for the other two. review: none blocking; whole diff read (`lower/wave.rs` only). 1. `V_MBCNT_HI_U32_B32` takes `ballot_half` only when SRC0 is the upper dword of a wave64 mask. A low-dword mask (`vcc_lo`) now gets the full ballot's low word on every lane. That is what lanes 32..63 need, because the instruction counts SRC0's bits as a number. In wave32, `lt` is 0 on every lane, so the result is still SRC1, as on hardware. 2. In wave32, `words()` for `s0..s106` pairs reads each dword with `word()`, so a mask in one half and a number in the other both survive. EXEC (126) keeps `[ballot(exec), 0]`. `wave_salu` also takes `_B64` counts whose mask is in `s0 + 1`. 3. `V_READFIRSTLANE_B32` / `V_READLANE_B32` read SRC0 through `word()`, as `V_WRITELANE_B32` already does. 4. `S_BCNT*` writes SCC through `write_scc`, so a stale SCC after a lane join is refused. Note, not blocking: `v_mbcnt_hi_u32_b32 v, exec_lo, ...` now asks for the full ballot (`half = false`). In a partial block of a split wave64 it is refused, where before it compiled with the wrong half-ballot. The usual idiom (`mbcnt_lo exec_lo` then `mbcnt_hi exec_hi`) is unchanged, because `exec_hi` is the upper dword. performance: none expected. The same ops are emitted, except for one extra `word()` per wave32 `_B64` operand in `s0..s106`. Not measured. No title run: Recompiler / Tier 1. verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, DXC 1.9.2609 via XCL_DXC_DIR. Claude Code, Claude Opus 5.5: merge, build, suite and full-diff review; this report.
throny commented 2026-11-29 00:47:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-29T00:47:28Z.


merge-check claim
head: 9e08a5a82b

<!-- greyfinch-sync:ivall/xcl:comment:7248352265 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2128#issuecomment-7248352265). Originally posted by [throny](https://github.com/throny) on 2026-11-29T00:47:28Z. --- merge-check claim head: 9e08a5a82b408f3272f7e340f56795946ba249ac
throny commented 2026-11-29 01:02:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-29T01:02:07Z.


merge-check
base: fa204595
head: 9e08a5a82b
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2613 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at fa204595: 2608 passed, 0 failed, 49 ignored.
review: no blocking finding; all hunks read (one file, the per-lane wave lowering). The half ballot is now taken only for the upper dword of a mask, a low dword gets the full ballot; in wave32 the two words of a 64-bit read are read separately, so a mask next to a plain number survives; the bit count's condition flag goes through the common write, so a stale one is caught, and that test fails without the fix. To know: one form in a partial block of a split wave64 is now refused and falls back to HLSL, where before it compiled with a wrong result. No overlap with #2117 (other files); the two point the same way. This agrees with the other check on this head in the thread.
performance: none measurable. Per-lane source only: only per-lane cache entries are re-translated.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7248514990 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2128#issuecomment-7248514990). Originally posted by [throny](https://github.com/throny) on 2026-11-29T01:02:07Z. --- merge-check base: fa204595 head: 9e08a5a82b408f3272f7e340f56795946ba249ac merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2613 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at fa204595: 2608 passed, 0 failed, 49 ignored. review: no blocking finding; all hunks read (one file, the per-lane wave lowering). The half ballot is now taken only for the upper dword of a mask, a low dword gets the full ballot; in wave32 the two words of a 64-bit read are read separately, so a mask next to a plain number survives; the bit count's condition flag goes through the common write, so a stale one is caught, and that test fails without the fix. To know: one form in a partial block of a split wave64 is now refused and falls back to HLSL, where before it compiled with a wrong result. No overlap with #2117 (other files); the two point the same way. This agrees with the other check on this head in the thread. performance: none measurable. Per-lane source only: only per-lane cache entries are re-translated. verdict: safe to merge hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2118
No description provided.