Shaders: mask v_readlane/v_writelane lane index and bypass EXEC on writelane #1312

Open
ashrafsdrop wants to merge 1 commit from upstream-pr/1312 into main
ashrafsdrop commented 2026-11-24 17:20:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ashrafsdrop on 2026-11-24T17:20:50Z.


Summary

Resolves VIC-BT-030 and VIC-BT-031 from #1249:

  1. Lane Index Masking (VIC-BT-030):

    • On RDNA2 hardware, v_readlane_b32 and v_writelane_b32 mask the lane-select operand to S1 & 31 (Wave32) or S1 & 63 (Wave64).
    • In lower.rs, lane operands are now masked against wave64 ? 63 : 31 before reaching waveReadLaneAt.i32 or lane comparison, preventing DXIL undefined behavior on out-of-range lane indices. Constant lanes fold directly without emitting extra instructions.
    • In wave.rs, v_readlane_b32 simulation masks constant lane indices against wave - 1.
  2. EXEC Bypass on v_writelane_b32 (VIC-BT-031):

    • Per the RDNA2 ISA manual, v_writelane_b32 ignores EXEC so compilers can spill SGPRs into inactive lanes of a spill VGPR across divergent branches.
    • Destination write now runs with guard = None, preventing write_placed from suppressing spills when the target lane has EXEC = 0.
  3. Tests:

    • Added synthetic test v_readlane_and_writelane_mask_lane_and_ignore_exec covering zero EXEC masks and out-of-range lane indices validated via dxil.dll.

Verification

  • cargo test -p victory-shader: 121 tests passed, 0 failed.
  • cargo clippy -p victory-shader: 0 warnings.
  • cargo run -p xtask -- policy: 154 files ok.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6587475519 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1312). Originally posted by [ashrafsdrop](https://github.com/ashrafsdrop) on 2026-11-24T17:20:50Z. --- ### Summary Resolves `VIC-BT-030` and `VIC-BT-031` from #1249: 1. **Lane Index Masking (`VIC-BT-030`)**: - On RDNA2 hardware, `v_readlane_b32` and `v_writelane_b32` mask the lane-select operand to `S1 & 31` (Wave32) or `S1 & 63` (Wave64). - In `lower.rs`, lane operands are now masked against `wave64 ? 63 : 31` before reaching `waveReadLaneAt.i32` or lane comparison, preventing DXIL undefined behavior on out-of-range lane indices. Constant lanes fold directly without emitting extra instructions. - In `wave.rs`, `v_readlane_b32` simulation masks constant lane indices against `wave - 1`. 2. **EXEC Bypass on `v_writelane_b32` (`VIC-BT-031`)**: - Per the RDNA2 ISA manual, `v_writelane_b32` ignores `EXEC` so compilers can spill SGPRs into inactive lanes of a spill VGPR across divergent branches. - Destination write now runs with `guard = None`, preventing `write_placed` from suppressing spills when the target lane has `EXEC = 0`. 3. **Tests**: - Added synthetic test `v_readlane_and_writelane_mask_lane_and_ignore_exec` covering zero `EXEC` masks and out-of-range lane indices validated via `dxil.dll`. ### Verification - `cargo test -p victory-shader`: 121 tests passed, 0 failed. - `cargo clippy -p victory-shader`: 0 warnings. - `cargo run -p xtask -- policy`: 154 files ok.
DenRakEiw commented 2026-11-24 17:26:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T17:26:50Z.

Review: APPROVED


Tested head 542b36e (fast-forward on main ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC):

  • cargo test -p victory-shader emit::lower: 12 passed, 0 failed (including v_readlane_and_writelane_mask_lane_and_ignore_exec)
  • cargo clippy -p victory-shader --all-targets: 0 warnings
  • cargo xtask policy: ok

Clean fix masking v_readlane/v_writelane lane indices and bypassing EXEC on v_writelane. Approving.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6044161490 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1312#pullrequestreview-6044161490). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-24T17:26:50Z. **Review:** APPROVED --- Tested head `542b36e` (fast-forward on `main` `ffe310e`) on Windows 11 x64 (Rust 1.98.1 MSVC): - `cargo test -p victory-shader emit::lower`: **12 passed, 0 failed** (including `v_readlane_and_writelane_mask_lane_and_ignore_exec`) - `cargo clippy -p victory-shader --all-targets`: **0 warnings** - `cargo xtask policy`: ok Clean fix masking `v_readlane`/`v_writelane` lane indices and bypassing EXEC on `v_writelane`. Approving. AI-assisted (Gemini 4 Neon).
fuzeofficlal commented 2026-11-24 18:05:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T17:47:52Z.


Reviewed 03913d9 and tested Wave32 / native Wave64 / pixel-shader host-lane cases across NVIDIA GeForce RTX 5090, AMD Radeon(TM) Graphics, D3D12 WARP, and dxil.dll. Four subtleties worth addressing:

  1. Dynamic v_readlane_b32 in pixel/vertex shaders (MaskData::Host) gets truncated (emit/lower.rs:4207):
    • Masking lane before checking self.mask_data == MaskData::Host && !matches!(lane, V::Const(_)) clamps computed host lane indices (from v_mbcnt or a ballot mask) to & 31 when native.wave64 == false, breaking lanes 32..63 on 64-wide host waves. Only the non-MaskData::Host (or constant-selector) branch should mask lane by self.wave() - 1.
  2. self.write_i vs self.write (emit/lower.rs:4249):
    • Replacing int(self, r) with self.write(inst, Reg::V(reg), r, None) skips write_i's v.clamp / v.omod integer output modifier checks; self.write_i(inst, r, None) preserves them while dropping the EXEC guard.
  3. Implicit EXEC read & Lanes::finish guard (ir.rs:930, structure.rs:601):
    • ir::effects still appends mask(EXEC) as an implicit read on v_readlane_b32 / v_writelane_b32, and structure::Lanes::finish still attaches an EXEC guard to v_readlane_b32 (and if exec_lo is passed as an explicit source operand to spill the mask into an inactive lane, v_writelane_b32 should still receive guard = None).
  4. Descriptor spill tracking modulo wavefront width (resource.rs:1619, 1653):
    • Tracer::restored and Tracer::spilled compare raw lane_of(...) without & (if self.p.wave64 { 63 } else { 31 }), so out-of-range constant selectors miss matching SGPR spill/restore pairs.

Reference branch with all four fixes + Wave32/Wave64/WARP GPU readback tests: fuzeofficlal/VIctory@d80c77a (fix/shader-readlane-writelane-exec-mask-1044).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139718560 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1312#issuecomment-7139718560). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-24T17:47:52Z. --- Reviewed `03913d9` and tested Wave32 / native Wave64 / pixel-shader host-lane cases across **NVIDIA GeForce RTX 5090**, **AMD Radeon(TM) Graphics**, **D3D12 WARP**, and **`dxil.dll`**. Four subtleties worth addressing: 1. **Dynamic `v_readlane_b32` in pixel/vertex shaders (`MaskData::Host`) gets truncated (`emit/lower.rs:4207`)**: - Masking `lane` *before* checking `self.mask_data == MaskData::Host && !matches!(lane, V::Const(_))` clamps computed host lane indices (from `v_mbcnt` or a ballot mask) to `& 31` when `native.wave64 == false`, breaking lanes `32..63` on 64-wide host waves. Only the non-`MaskData::Host` (or constant-selector) branch should mask `lane` by `self.wave() - 1`. 2. **`self.write_i` vs `self.write` (`emit/lower.rs:4249`)**: - Replacing `int(self, r)` with `self.write(inst, Reg::V(reg), r, None)` skips `write_i`'s `v.clamp` / `v.omod` integer output modifier checks; `self.write_i(inst, r, None)` preserves them while dropping the `EXEC` guard. 3. **Implicit `EXEC` read & `Lanes::finish` guard (`ir.rs:930`, `structure.rs:601`)**: - `ir::effects` still appends `mask(EXEC)` as an implicit read on `v_readlane_b32` / `v_writelane_b32`, and `structure::Lanes::finish` still attaches an `EXEC` guard to `v_readlane_b32` (and if `exec_lo` is passed as an explicit source operand to spill the mask into an inactive lane, `v_writelane_b32` should still receive `guard = None`). 4. **Descriptor spill tracking modulo wavefront width (`resource.rs:1619, 1653`)**: - `Tracer::restored` and `Tracer::spilled` compare raw `lane_of(...)` without `& (if self.p.wave64 { 63 } else { 31 })`, so out-of-range constant selectors miss matching SGPR spill/restore pairs. Reference branch with all four fixes + Wave32/Wave64/WARP GPU readback tests: [`fuzeofficlal/VIctory@d80c77a`](https://github.com/fuzeofficlal/VIctory/commit/d80c77aff14f0e3ddbb0eca09b782b1021549dd9) (`fix/shader-readlane-writelane-exec-mask-1044`).
ashrafsdrop commented 2026-11-24 18:06:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ashrafsdrop on 2026-11-24T17:55:16Z.


Thanks @fuzeofficlal for the thorough review and hardware testing!

Integrated in commit d27838e:

  • Dynamic MaskData::Host lane selectors in pixel/vertex shaders now bypass console wave masking so 64-wide host lanes remain unclipped.
  • Preserved integer output modifiers on v_writelane_b32 via write_i(inst, r, None) while bypassing EXEC.
  • Dropped implicit EXEC reads and per-lane EXEC guards on v_readlane_b32 / v_writelane_b32 in ir.rs and structure.rs.
  • Masked SGPR spill tracking selectors modulo wave width in resource.rs.
  • Added multi-lane Wave32/Wave64 execution tests across adapters.

cargo test -p victory-shader (126 tests passed), cargo clippy -p victory-shader --all-targets --all-features -- -D warnings, and cargo run -p xtask -- policy pass with zero warnings.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139895815 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1312#issuecomment-7139895815). Originally posted by [ashrafsdrop](https://github.com/ashrafsdrop) on 2026-11-24T17:55:16Z. --- Thanks [@fuzeofficlal](https://github.com/fuzeofficlal) for the thorough review and hardware testing! Integrated in commit d27838e: - Dynamic `MaskData::Host` lane selectors in pixel/vertex shaders now bypass console wave masking so 64-wide host lanes remain unclipped. - Preserved integer output modifiers on `v_writelane_b32` via `write_i(inst, r, None)` while bypassing EXEC. - Dropped implicit EXEC reads and per-lane EXEC guards on `v_readlane_b32` / `v_writelane_b32` in `ir.rs` and `structure.rs`. - Masked SGPR spill tracking selectors modulo wave width in `resource.rs`. - Added multi-lane Wave32/Wave64 execution tests across adapters. `cargo test -p victory-shader` (126 tests passed), `cargo clippy -p victory-shader --all-targets --all-features -- -D warnings`, and `cargo run -p xtask -- policy` pass with zero warnings.
catminou4 commented 2026-11-24 20:09:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:09:44Z.

Review: APPROVED


Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 99 passed, 0 failed. Execution/valu tests are #[cfg(all(test, windows))] and only run on Windows; macOS covers lowering/structure/IR unit tests.

Masks the v_readlane/v_writelane lane index by wave size and bypasses EXEC for writelane; adds wave32/wave64 lowering+validation tests and host-lane tests across backends including WARP.

<!-- greyfinch-sync:Marvisak/VIctory:review:6046556328 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1312#pullrequestreview-6046556328). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T20:09:44Z. **Review:** APPROVED --- Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 99 passed, 0 failed. Execution/valu tests are #[cfg(all(test, windows))] and only run on Windows; macOS covers lowering/structure/IR unit tests. Masks the v_readlane/v_writelane lane index by wave size and bypasses EXEC for writelane; adds wave32/wave64 lowering+validation tests and host-lane tests across backends including WARP.
wbkepler commented 2026-11-24 21:03:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by wbkepler on 2026-11-24T20:59:47Z.


A merge note: #1336 (VIC-BT-030/031) changes the same two instructions. I compared the two diffs against ffe310e:

  • The same in both: the lane selector is masked by the console wave (wave() - 1, so & 63 for wave64 programs), v_writelane_b32 writes through write_i(inst, r, None) without the EXEC guard, and the wave.rs simulate hunk is identical.
  • Only in #1312:
    1. A computed MaskData::Host selector stays unmasked. #1336 masks it after the Host branch, which clips host lanes 32–63 when a wave32 console pixel or vertex program runs in a 64-wide host wave. That is harmless on 32-lane NVIDIA hosts but wrong on AMD.
    2. Tracer::restored and Tracer::spilled mask the selector too.
    3. The implicit EXEC read and the structure guard are dropped.
  • Only in #1336: nothing for these two instructions.

For the wave64-on-32-lane case: a compute program that uses either instruction sets console_lanes, so it declares WaveSize(64) and is never split into two 32-lane host waves. Masking against the console wave is therefore correct. Pixel and vertex programs refuse constant cross-lane selectors in cross_lane.

So #1312 is the more complete version of these items. The v_readlane_b32 / v_writelane_b32 arms in lower.rs and the test blocks at the end of emit::lower::tests will conflict with whichever of the two lands second.

AI-assisted review (Claude Code); checked on Windows 11 / RTX 5090.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7144334917 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1312#issuecomment-7144334917). Originally posted by [wbkepler](https://github.com/wbkepler) on 2026-11-24T20:59:47Z. --- A merge note: #1336 (VIC-BT-030/031) changes the same two instructions. I compared the two diffs against `ffe310e`: - **The same in both:** the lane selector is masked by the console wave (`wave() - 1`, so `& 63` for wave64 programs), `v_writelane_b32` writes through `write_i(inst, r, None)` without the EXEC guard, and the `wave.rs` `simulate` hunk is identical. - **Only in #1312:** 1. A computed `MaskData::Host` selector stays unmasked. #1336 masks it after the Host branch, which clips host lanes 32–63 when a wave32 console pixel or vertex program runs in a 64-wide host wave. That is harmless on 32-lane NVIDIA hosts but wrong on AMD. 2. `Tracer::restored` and `Tracer::spilled` mask the selector too. 3. The implicit EXEC read and the structure guard are dropped. - **Only in #1336:** nothing for these two instructions. For the wave64-on-32-lane case: a compute program that uses either instruction sets `console_lanes`, so it declares `WaveSize(64)` and is never split into two 32-lane host waves. Masking against the console wave is therefore correct. Pixel and vertex programs refuse constant cross-lane selectors in `cross_lane`. So #1312 is the more complete version of these items. The `v_readlane_b32` / `v_writelane_b32` arms in `lower.rs` and the test blocks at the end of `emit::lower::tests` will conflict with whichever of the two lands second. _AI-assisted review (Claude Code); checked on Windows 11 / RTX 5090._
ashrafsdrop commented 2026-11-25 01:08:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ashrafsdrop on 2026-11-25T00:50:35Z.


Thanks @wbkepler for the comparison against #1336 and detailed verification on RTX 5090.

Merged main (42363ab) in commit 31fd70e resolving all merge conflicts:

  • Preserved unmasked computed MaskData::Host lane selectors for 64-wide host pixel/vertex waves.
  • Maintained the unguarded v_readlane_b32 / v_writelane_b32 path alongside the new last_guard cache.
  • Updated shader test initializers with new HostShader bindless heap/memory fields.

Verification on Windows 11 x64 (Rust 1.98.1 MSVC):

  • cargo test -p victory-shader: 252 passed, 0 failed.
  • cargo clippy -p victory-shader --all-targets --all-features -- -D warnings: 0 warnings.
  • cargo run -p xtask -- policy: 182 files ok.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7148938901 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1312#issuecomment-7148938901). Originally posted by [ashrafsdrop](https://github.com/ashrafsdrop) on 2026-11-25T00:50:35Z. --- Thanks @wbkepler for the comparison against #1336 and detailed verification on RTX 5090. Merged `main` (`42363ab`) in commit `31fd70e` resolving all merge conflicts: - Preserved unmasked computed `MaskData::Host` lane selectors for 64-wide host pixel/vertex waves. - Maintained the unguarded `v_readlane_b32` / `v_writelane_b32` path alongside the new `last_guard` cache. - Updated shader test initializers with new `HostShader` bindless heap/memory fields. Verification on Windows 11 x64 (Rust 1.98.1 MSVC): - `cargo test -p victory-shader`: 252 passed, 0 failed. - `cargo clippy -p victory-shader --all-targets --all-features -- -D warnings`: 0 warnings. - `cargo run -p xtask -- policy`: 182 files ok.
Marvisak commented 2026-11-25 03:03:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T02:35:14Z.


Automated triage for the maintainers.

Merge candidate. The new head is one rebased commit with the same content as before:

  • mask_lane in emit/lower.rs masks the v_readlane_b32/v_writelane_b32 selector to the console wave. A computed MaskData::Host selector stays unmasked.
  • v_writelane_b32 writes through write_i(inst, r, None).
  • The implicit EXEC read (ir::effects) and the structure::Lanes guard are dropped.
  • wave::simulate and resource::Tracer mask the selector too.

This matches the RDNA2 ISA: both instructions ignore EXEC. The wave32/wave64 readback tests in valu_tests.rs now skip cleanly when no device is present. Note: lower.rs ends at 523,623 bytes, about 660 under the policy's 512 KiB limit. The PR still competes with #1336 for the same arms.

CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7150915207 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1312#issuecomment-7150915207). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T02:35:14Z. --- <!-- victory-triage v1 head=bf4837dc66559824cbc8143aecdbe8608891474f verdict=merge-candidate at=2026-11-26T07:20:41Z --> Automated triage for the maintainers. **Merge candidate.** The new head is one rebased commit with the same content as before: - `mask_lane` in `emit/lower.rs` masks the `v_readlane_b32`/`v_writelane_b32` selector to the console wave. A computed `MaskData::Host` selector stays unmasked. - `v_writelane_b32` writes through `write_i(inst, r, None)`. - The implicit EXEC read (`ir::effects`) and the `structure::Lanes` guard are dropped. - `wave::simulate` and `resource::Tracer` mask the selector too. This matches the RDNA2 ISA: both instructions ignore EXEC. The wave32/wave64 readback tests in `valu_tests.rs` now skip cleanly when no device is present. Note: `lower.rs` ends at 523,623 bytes, about 660 under the policy's 512 KiB limit. The PR still competes with #1336 for the same arms. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
ashrafsdrop commented 2026-11-25 12:03:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ashrafsdrop on 2026-11-25T11:30:37Z.


Updated in head d192b2a:

Rebase & Adapter Deduplication

  • Rebased cleanly on latest origin/main.
  • Removed custom DXGI adapter enumeration (all_wave_hosts, open_wave_adapter, AdapterHost) and standardized on host::Host.

CI Runner Graceful Fallback

  • compute_pipeline wave checks skip gracefully when the host device or WARP does not support Wave32/Wave64, eliminating the panic on GPU-less CI runners.
  • Fixed the synthetic test store helper (buffer_store_dword_offen) to set the offen bit (w0 bit 12), ensuring per-lane offset buffers index accurately during execution.

Verification

  • cargo test -p victory-shader (252 passed, 0 failed, 3 ignored).
  • cargo clippy -p victory-shader --all-targets --all-features -- -D warnings (clean).
  • cargo run -p xtask -- policy (182 files ok).
<!-- greyfinch-sync:Marvisak/VIctory:comment:7161139634 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1312#issuecomment-7161139634). Originally posted by [ashrafsdrop](https://github.com/ashrafsdrop) on 2026-11-25T11:30:37Z. --- Updated in head `d192b2a`: ### Rebase & Adapter Deduplication - Rebased cleanly on latest `origin/main`. - Removed custom DXGI adapter enumeration (`all_wave_hosts`, `open_wave_adapter`, `AdapterHost`) and standardized on `host::Host`. ### CI Runner Graceful Fallback - `compute_pipeline` wave checks skip gracefully when the host device or WARP does not support Wave32/Wave64, eliminating the panic on GPU-less CI runners. - Fixed the synthetic test store helper (`buffer_store_dword_offen`) to set the `offen` bit (`w0` bit 12), ensuring per-lane offset buffers index accurately during execution. ### Verification - `cargo test -p victory-shader` (252 passed, 0 failed, 3 ignored). - `cargo clippy -p victory-shader --all-targets --all-features -- -D warnings` (clean). - `cargo run -p xtask -- policy` (182 files ok).
Lyrnc commented 2026-11-26 18:38:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Lyrnc on 2026-11-26T18:38:38Z.


Wave64 hardware check of bf4837d.

Checked against a hardware table measured on an AMD Radeon iGPU (gfx1036, RDNA 2, Ryzen 7 9800X3D) in native
wave64: 64 cross-lane instructions x 8 EXEC masks (all, lo32, hi32, all but lane 0, alternate lanes, lane 40 alone,
lanes 31+32, a sparse mask). Each case was assembled with the same assembler, run through VIctory as a wave64
compute program of 64 threads on the same Radeon through D3D12 (WaveSize 64, dxil.dll validated), and all 64
lanes compared with the hardware. EXEC is narrowed two ways: straight-line (v_cmpx_ne_u32, lowered with a lane
guard) and branched (s_and_saveexec_b64 + s_cbranch_execz, a DXIL if). Windows 11, Rust pinned, debug.
No game files were used.

Tested (merged with #2830 onto main 63bcca4; Radeon, wave64):

  • Straight-line narrowing: v_writelane_b32 d, s21, L for L = 5, 33, 63 is exact in all 24 cases with this PR.
    On main, 14 of 24 are wrong: every case whose lane is outside EXEC keeps its old value (lo32 / lane 33: hardware
    0x777, main 0xdead0021; hi32 / lane 5: hardware 0x777, main 0xdead0005).
  • Branched form: still 14 of 24 wrong with this PR, the same as main: a lane outside the DXIL branch does not run
    the write, so the bypass cannot reach it. (#320's console flow gives 24/24 there.)
  • v_readlane_b32 (lanes 0, 31, 32, 40, 63): unchanged, exact under straight-line narrowing.
  • The lane-index masking is not covered (all lanes in the table are below 64).

Not tested: NVIDIA, out-of-range lane selectors, the title.

AI use: Claude Code (Claude Opus 5.5) built the harness and the hardware table, ran them on the GPU above and wrote this report; the numbers come from those runs.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7200693377 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1312#issuecomment-7200693377). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-26T18:38:38Z. --- Wave64 hardware check of `bf4837d`. Checked against a hardware table measured on an AMD Radeon iGPU (gfx1036, RDNA 2, Ryzen 7 9800X3D) in native wave64: 64 cross-lane instructions x 8 EXEC masks (all, lo32, hi32, all but lane 0, alternate lanes, lane 40 alone, lanes 31+32, a sparse mask). Each case was assembled with the same assembler, run through VIctory as a wave64 compute program of 64 threads on the same Radeon through D3D12 (WaveSize 64, dxil.dll validated), and all 64 lanes compared with the hardware. EXEC is narrowed two ways: straight-line (`v_cmpx_ne_u32`, lowered with a lane guard) and branched (`s_and_saveexec_b64` + `s_cbranch_execz`, a DXIL `if`). Windows 11, Rust pinned, debug. No game files were used. **Tested** (merged with #2830 onto main 63bcca4; Radeon, wave64): - Straight-line narrowing: `v_writelane_b32 d, s21, L` for L = 5, 33, 63 is exact in all 24 cases with this PR. On main, 14 of 24 are wrong: every case whose lane is outside EXEC keeps its old value (lo32 / lane 33: hardware 0x777, main 0xdead0021; hi32 / lane 5: hardware 0x777, main 0xdead0005). - Branched form: still 14 of 24 wrong with this PR, the same as main: a lane outside the DXIL branch does not run the write, so the bypass cannot reach it. (#320's console flow gives 24/24 there.) - `v_readlane_b32` (lanes 0, 31, 32, 40, 63): unchanged, exact under straight-line narrowing. - The lane-index masking is not covered (all lanes in the table are below 64). **Not tested:** NVIDIA, out-of-range lane selectors, the title. **AI use:** Claude Code (Claude Opus 5.5) built the harness and the hardware table, ran them on the GPU above and wrote this report; the numbers come from those runs.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1312:upstream-pr/1312'
git switch 'upstream-pr/1312'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1312'
git switch 'upstream-pr/1312'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1312'
git switch 'upstream-pr/1312'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1312'
git switch 'main'
git merge --squash 'upstream-pr/1312'
git switch 'main'
git merge --ff-only 'upstream-pr/1312'
git switch 'main'
git merge 'upstream-pr/1312'
git push origin 'main'
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
Marvisak/VIctory!1312
No description provided.