shader: relax WaveSize(64) for uniform single-wave LDS compute shaders #3406

Open
github-bot wants to merge 6 commits from github-bot/gh-3406 into main AGit
Owner

@⁠danielibabet on GitHub · 2026-11-26 22:45 UTC · original
danielibabet:pr/nvidia-wave-invariant → main · +434 −4 · 3 files · 6 commits · open

Wave32-only hosts (such as NVIDIA) reject any compute pipeline whose DXIL metadata specifies \WaveSize(64)\ (\E_INVALIDARG / 0x80070057).

Previously, \lower.rs\ forced \WaveSize(64)\ whenever a Wave64 compute shader used LDS with <= 64\ threads (without \console_lanes) because the console compiler omits \s_barrier\ inside a single 64-lane wave.

This PR relaxes \WaveSize(64)\ in two safe cases:

  1. **\ hreads <= 32**: the workgroup fits inside a single Wave32 warp natively, so \WaveSize(64)\ is omitted with zero extra barriers.
  2. \32 < threads <= 64\ with uniform LDS accesses (\can_sync_wave64_lds): when every \ds_*\ LDS instruction (excluding swizzle/permute/nop) has no per-lane \EXEC\ guard, \WaveSize(64)\ is omitted and DXIL group barriers (\dx.op.barrier(1 | 8)) are emitted around LDS reads/writes/atomics so two Wave32 warps synchronize cleanly.

Tested on RTX 4070 (Windows 11):

  • \cargo test -p victory-shader wave64_lds -- --test-threads=1\ (3 passed; 0 failed)
  • \cargo clippy -p victory-shader --all-targets -- -D warnings\
  • \cargo xtask policy\
  • Live GTA VI testing reduced \
**@⁠danielibabet** on GitHub · 2026-11-26 22:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406) `danielibabet:pr/nvidia-wave-invariant` → `main` · +434 −4 · 3 files · 6 commits · open Wave32-only hosts (such as NVIDIA) reject any compute pipeline whose DXIL metadata specifies \WaveSize(64)\ (\E_INVALIDARG / 0x80070057\). Previously, \lower.rs\ forced \WaveSize(64)\ whenever a Wave64 compute shader used LDS with \<= 64\ threads (without \console_lanes\) because the console compiler omits \s_barrier\ inside a single 64-lane wave. This PR relaxes \WaveSize(64)\ in two safe cases: 1. **\ hreads <= 32\**: the workgroup fits inside a single Wave32 warp natively, so \WaveSize(64)\ is omitted with zero extra barriers. 2. **\32 < threads <= 64\ with uniform LDS accesses (\can_sync_wave64_lds\)**: when every \ds_*\ LDS instruction (excluding swizzle/permute/nop) has no per-lane \EXEC\ guard, \WaveSize(64)\ is omitted and DXIL group barriers (\dx.op.barrier(1 | 8)\) are emitted around LDS reads/writes/atomics so two Wave32 warps synchronize cleanly. Tested on RTX 4070 (Windows 11): - \cargo test -p victory-shader wave64_lds -- --test-threads=1\ (3 passed; 0 failed) - \cargo clippy -p victory-shader --all-targets -- -D warnings\ - \cargo xtask policy\ - Live GTA VI testing reduced \
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:06:50 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 22:47 UTC · original · approved these changes

LGTM — verified on RTX 5090 and VICTORY_WARP=1 (Windows / D3D12) against origin/main (63bcca4).

  • Relaxing WaveSize(64) for uniform single-wave LDS compute shaders enables them to run on 32-lane hosts (like NVIDIA RTX) without losing correctness.
  • cargo test -p victory-shader --lib wave64_lds_tests:: -- --test-threads=1: all passed on RTX 5090 and VICTORY_WARP=1.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 192 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 22:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#pullrequestreview-6081237959) · **approved these changes** LGTM — verified on RTX 5090 and `VICTORY_WARP=1` (Windows / D3D12) against `origin/main` (`63bcca4`). - Relaxing `WaveSize(64)` for uniform single-wave LDS compute shaders enables them to run on 32-lane hosts (like NVIDIA RTX) without losing correctness. - `cargo test -p victory-shader --lib wave64_lds_tests:: -- --test-threads=1`: all passed on RTX 5090 and `VICTORY_WARP=1`. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 192 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠Jackster on GitHub · 2026-11-26 23:02 UTC · original

Windows 11, 63bcca4 + this PR:

  • cargo test -p victory-shader --lib --features host wave64_lds: 3 passed — wave64_lds_within_32_threads_drops_wave_size, wave64_lds_64_threads_uniform_drops_wave_size_and_emits_barriers, wave64_lds_64_threads_guarded_keeps_wave_size_64.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.

These are translation-level tests, so they run on any host. Synthetic only. AI-assisted.

**@⁠Jackster** on GitHub · 2026-11-26 23:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#issuecomment-7205201391) Windows 11, `63bcca4` + this PR: - `cargo test -p victory-shader --lib --features host wave64_lds`: 3 passed — `wave64_lds_within_32_threads_drops_wave_size`, `wave64_lds_64_threads_uniform_drops_wave_size_and_emits_barriers`, `wave64_lds_64_threads_guarded_keeps_wave_size_64`. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. These are translation-level tests, so they run on any host. Synthetic only. AI-assisted.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 23:13 UTC · original · requested changes

Thanks for looking at relaxing WaveSize(64) on single-wave Wave64 compute shaders that share LDS on Wave32 hosts. There are three blocking correctness issues with the current barrier-insertion approach:

  1. Group barriers can be emitted inside divergent control flow (crates/victory-shader/src/emit/lower.rs:25-48, 655-660, 3385-3388, 3488-3566):
    can_sync_wave64_lds only checks x.st.guards[b][i]. When LDS instructions sit inside a divergent branch block (e.g., s_and_saveexec_b64 + s_cbranch_execz, if/else, or a divergent loop), EXEC is already narrowed by control flow so the structurizer leaves guard == None. can_sync_wave64_lds treats those accesses as workgroup-uniform, drops WaveSize(64), and emit_lds_barrier() emits dx.op.barrier(80, 9) in divergent control flow — where one 32-lane wave can reach the barrier while the other skips it, violating DXIL/D3D12 rules and risking a GPU hang / TDR.
  2. Missing barrier between LDS reads and subsequent writes/atomics (crates/victory-shader/src/emit/lower.rs:3385-3388, 3486-3566):
    ds_read inserts a barrier before the read, and ds_write / ds_* atomics insert a barrier after the write/atomic. A ds_read followed by a ds_write or ds_add_* (straight-line or across loop iterations) has no barrier between the read and the modifying operation, allowing wave 0 (0..31) to overwrite LDS slots before wave 1 (32..63) reads them.
  3. v_readfirstlane_b32 changes behavior when split across two Wave32 waves (crates/victory-shader/src/emit/lower.rs:607-660, 6766-6778):
    Non-waterfall v_readfirstlane_b32 (waveReadLaneFirst.i32) is not included in console_lanes. Running 64 threads as two Wave32 waves causes v_readfirstlane_b32 to broadcast two different values instead of one, which can corrupt LDS writes or cause Atom::Uniform scalar branches to diverge between the two waves (triggering the divergent-barrier hang above).
  4. Test coverage (crates/victory-shader/src/emit/wave64_lds_tests.rs:45-94):
    The new tests only assert wave_size and lds_wave32_sync flags on Lowered, without checking actual emitted barrier instructions/ordering, divergent s_cbranch_execz branches, dxil.dll validation, or hardware/WARP execution.

To make this safe, can_sync_wave64_lds needs to verify workgroup-uniform control-flow reachability for every LDS block (and reject non-waterfall v_readfirstlane_b32 / other cross-32-lane dependencies), ensure WAR ordering between reads and subsequent writes/atomics, and add end-to-end DXIL + GPU/WARP tests.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 23:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#pullrequestreview-6081384219) · **requested changes** Thanks for looking at relaxing `WaveSize(64)` on single-wave Wave64 compute shaders that share LDS on Wave32 hosts. There are three blocking correctness issues with the current barrier-insertion approach: 1. **Group barriers can be emitted inside divergent control flow (`crates/victory-shader/src/emit/lower.rs:25-48, 655-660, 3385-3388, 3488-3566`)**: `can_sync_wave64_lds` only checks `x.st.guards[b][i]`. When LDS instructions sit inside a divergent branch block (e.g., `s_and_saveexec_b64` + `s_cbranch_execz`, `if/else`, or a divergent loop), `EXEC` is already narrowed by control flow so the structurizer leaves `guard == None`. `can_sync_wave64_lds` treats those accesses as workgroup-uniform, drops `WaveSize(64)`, and `emit_lds_barrier()` emits `dx.op.barrier(80, 9)` in divergent control flow — where one 32-lane wave can reach the barrier while the other skips it, violating DXIL/D3D12 rules and risking a GPU hang / TDR. 2. **Missing barrier between LDS reads and subsequent writes/atomics (`crates/victory-shader/src/emit/lower.rs:3385-3388, 3486-3566`)**: `ds_read` inserts a barrier **before** the read, and `ds_write` / `ds_*` atomics insert a barrier **after** the write/atomic. A `ds_read` followed by a `ds_write` or `ds_add_*` (straight-line or across loop iterations) has no barrier between the read and the modifying operation, allowing wave 0 (`0..31`) to overwrite LDS slots before wave 1 (`32..63`) reads them. 3. **`v_readfirstlane_b32` changes behavior when split across two Wave32 waves (`crates/victory-shader/src/emit/lower.rs:607-660, 6766-6778`)**: Non-waterfall `v_readfirstlane_b32` (`waveReadLaneFirst.i32`) is not included in `console_lanes`. Running 64 threads as two Wave32 waves causes `v_readfirstlane_b32` to broadcast two different values instead of one, which can corrupt LDS writes or cause `Atom::Uniform` scalar branches to diverge between the two waves (triggering the divergent-barrier hang above). 4. **Test coverage (`crates/victory-shader/src/emit/wave64_lds_tests.rs:45-94`)**: The new tests only assert `wave_size` and `lds_wave32_sync` flags on `Lowered`, without checking actual emitted barrier instructions/ordering, divergent `s_cbranch_execz` branches, `dxil.dll` validation, or hardware/WARP execution. To make this safe, `can_sync_wave64_lds` needs to verify workgroup-uniform control-flow reachability for every LDS block (and reject non-waterfall `v_readfirstlane_b32` / other cross-32-lane dependencies), ensure WAR ordering between reads and subsequent writes/atomics, and add end-to-end DXIL + GPU/WARP tests.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 23:18 UTC · original

I found two gaps at 434f687 with the same small Wave64 LDS exchange on app-local WARP. Each lane writes its ID, reads the opposite half, replaces its own slot, then reads the opposite half again.

Group size Original ID reads on 434f687 Replacement reads on 434f687 7ecac72
16 0/16 8/16 16/16 on both reads
32 0/32 16/32 32/32 on both reads
64 32/64 64/64 64/64 on both reads

At 64 threads a later store can get ahead of an earlier read. At 16 and 32 threads, dropping the fixed wave width can still leave multiple host waves without a fence. The follow-up inserts a group fence before each LDS instruction in the eligible uniform path. It also retains WaveSize(64) when a branch can bring only some lanes to an LDS instruction, even when that instruction has no separate EXEC guard. That branch case was checked at translation only.

The controls repeated in two WARP processes and the follow-up in three. The affected suites passed 60 tests with one ignored. Strict shader Clippy in both configurations and asset policy passed. The barrier flags match DXC's thread-group and shared-memory definitions.

@⁠danielibabet, could you rerun the exchange test on the RTX 4070 and check the title pipeline count with this change? If you fold it in, please retain the Git author or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 23:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#issuecomment-7205437438) I found two gaps at `434f687` with the same small Wave64 LDS exchange on app-local WARP. Each lane writes its ID, reads the opposite half, replaces its own slot, then reads the opposite half again. | Group size | Original ID reads on `434f687` | Replacement reads on `434f687` | [`7ecac72`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/7ecac728ea322cd9a4bc7dde3731e0265221eb9d) | | --- | --- | --- | --- | | 16 | 0/16 | 8/16 | 16/16 on both reads | | 32 | 0/32 | 16/32 | 32/32 on both reads | | 64 | 32/64 | 64/64 | 64/64 on both reads | At 64 threads a later store can get ahead of an earlier read. At 16 and 32 threads, dropping the fixed wave width can still leave multiple host waves without a fence. The follow-up inserts a group fence before each LDS instruction in the eligible uniform path. It also retains `WaveSize(64)` when a branch can bring only some lanes to an LDS instruction, even when that instruction has no separate EXEC guard. That branch case was checked at translation only. The controls repeated in two WARP processes and the follow-up in three. The affected suites passed 60 tests with one ignored. Strict shader Clippy in both configurations and asset policy passed. The barrier flags match [DXC's thread-group and shared-memory definitions](https://microsoft.github.io/DirectXShaderCompiler/coverage/home/runner/work/DirectXShaderCompiler/DirectXShaderCompiler/include/dxc/DXIL/DxilConstants.h.html#L1901). @⁠danielibabet, could you rerun the exchange test on the RTX 4070 and check the title pipeline count with this change? If you fold it in, please retain the Git author or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
Author
Owner

@⁠danielibabet on GitHub · 2026-11-26 23:19 UTC · original

Thanks @⁠fuzeofficlal for the thorough review! Fixed all four points:

  1. Workgroup-uniform control-flow reachability (crates/victory-shader/src/emit/wave64_lds.rs):
    • can_sync_wave64_lds now propagates divergence forward from any non-uniform LaneExit::Branch (where when has non-Atom::Uniform atoms) and LaneExit::Indirect, and rejects any LDS instruction sitting in a divergent block (divergent[b]) in addition to per-lane EXEC guards (x.st.guards[b][i]).
  2. WAR ordering (crates/victory-shader/src/emit/lower.rs):
    • Lower::ds now emits emit_lds_barrier() both before and after ds_read* (covering both RAW and WAR hazards across straight-line and loop iterations) in addition to after ds_write* / LDS atomics.
  3. v_readfirstlane_b32 (wave64_lds.rs):
    • can_sync_wave64_lds now rejects any non-waterfall v_readfirstlane_b32 (not in x.res.waterfall.reads) so WaveSize(64) is preserved whenever wave-first broadcasts occur.
  4. Tests (crates/victory-shader/src/emit/wave64_lds_tests.rs):
    • Exposed lds_barriers: u32 (dx.op.barrier call count) on Lowered under #[cfg(test)] and verified exact barrier counts (3 for ds_write + ds_read, 0 otherwise).
    • Added wave64_lds_64_threads_divergent_branch_keeps_wave_size_64 (s_and_saveexec_b64 + s_cbranch_execz) and wave64_lds_64_threads_readfirstlane_keeps_wave_size_64.
    • Added Validator::validate in wave64_lds_64_threads_uniform_drops_wave_size_and_emits_barriers (skipping only pre-SM 6.6 Unknown shader model on older local dxil.dll).

Verified locally:

  • cargo test -p victory-shader wave64_lds_tests -- --test-threads=1 (5 passed; 0 failed)
  • cargo clippy -p victory-shader --all-targets -- -D warnings
  • cargo xtask policy (193 files ok)
**@⁠danielibabet** on GitHub · 2026-11-26 23:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#issuecomment-7205443020) Thanks @⁠fuzeofficlal for the thorough review! Fixed all four points: 1. **Workgroup-uniform control-flow reachability (`crates/victory-shader/src/emit/wave64_lds.rs`)**: - `can_sync_wave64_lds` now propagates divergence forward from any non-uniform `LaneExit::Branch` (where `when` has non-`Atom::Uniform` atoms) and `LaneExit::Indirect`, and rejects any LDS instruction sitting in a divergent block (`divergent[b]`) in addition to per-lane `EXEC` guards (`x.st.guards[b][i]`). 2. **WAR ordering (`crates/victory-shader/src/emit/lower.rs`)**: - `Lower::ds` now emits `emit_lds_barrier()` **both before and after** `ds_read*` (covering both RAW and WAR hazards across straight-line and loop iterations) in addition to after `ds_write*` / LDS atomics. 3. **`v_readfirstlane_b32` (`wave64_lds.rs`)**: - `can_sync_wave64_lds` now rejects any non-waterfall `v_readfirstlane_b32` (not in `x.res.waterfall.reads`) so `WaveSize(64)` is preserved whenever wave-first broadcasts occur. 4. **Tests (`crates/victory-shader/src/emit/wave64_lds_tests.rs`)**: - Exposed `lds_barriers: u32` (`dx.op.barrier` call count) on `Lowered` under `#[cfg(test)]` and verified exact barrier counts (`3` for `ds_write` + `ds_read`, `0` otherwise). - Added `wave64_lds_64_threads_divergent_branch_keeps_wave_size_64` (`s_and_saveexec_b64` + `s_cbranch_execz`) and `wave64_lds_64_threads_readfirstlane_keeps_wave_size_64`. - Added `Validator::validate` in `wave64_lds_64_threads_uniform_drops_wave_size_and_emits_barriers` (skipping only pre-SM 6.6 `Unknown shader model` on older local `dxil.dll`). Verified locally: - `cargo test -p victory-shader wave64_lds_tests -- --test-threads=1` (5 passed; 0 failed) - `cargo clippy -p victory-shader --all-targets -- -D warnings` - `cargo xtask policy` (193 files ok)
Author
Owner

@⁠danielibabet on GitHub · 2026-11-26 23:22 UTC · original

Great catch @⁠andrewpozdnakov7-jpg — thanks for the app-local WARP repro!

Even with threads <= 32, hosts whose native wave width is narrower than 32 lanes (like WARP) still split the group across multiple host waves and need group barriers around uniform LDS accesses.

Updated pr/nvidia-wave-invariant (HEAD now includes Co-authored-by: andrewpozdnakov7-jpg <[email protected]>):

  • Enabled lds_wave32_sync (group barriers before/after ds_read* and after ds_write* / LDS atomics) for all uniform single-wave Wave64 LDS shaders (threads <= 64, including 16 and 32 threads) instead of skipping <= 32.
  • Combined with 55ad0f3, can_sync_wave64_lds also enforces workgroup-uniform control-flow reachability and rejects non-waterfall v_readfirstlane_b32.

Verified locally on RTX 4070 (Windows 11):

  • cargo test -p victory-shader wave64_lds_tests -- --test-threads=1 (5 passed; 0 failed)
  • cargo clippy -p victory-shader --all-targets -- -D warnings
  • cargo xtask policy (193 files ok)
**@⁠danielibabet** on GitHub · 2026-11-26 23:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#issuecomment-7205491298) Great catch @⁠andrewpozdnakov7-jpg — thanks for the app-local WARP repro! Even with `threads <= 32`, hosts whose native wave width is narrower than 32 lanes (like WARP) still split the group across multiple host waves and need group barriers around uniform LDS accesses. Updated `pr/nvidia-wave-invariant` (`HEAD` now includes `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`): - Enabled `lds_wave32_sync` (group barriers before/after `ds_read*` and after `ds_write*` / LDS atomics) for all uniform single-wave `Wave64` LDS shaders (`threads <= 64`, including `16` and `32` threads) instead of skipping `<= 32`. - Combined with `55ad0f3`, `can_sync_wave64_lds` also enforces workgroup-uniform control-flow reachability and rejects non-waterfall `v_readfirstlane_b32`. Verified locally on RTX 4070 (Windows 11): - `cargo test -p victory-shader wave64_lds_tests -- --test-threads=1` (5 passed; 0 failed) - `cargo clippy -p victory-shader --all-targets -- -D warnings` - `cargo xtask policy` (193 files ok)
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 23:35 UTC · original · requested changes

Thanks for adding wave64_lds.rs reachability checks, wrapping ds_read with pre/post barriers (closing the WAR/read-to-atomic gap), and rejecting non-waterfall v_readfirstlane_b32! Two P0 divergent-barrier issues still remain in 48cb3944:

  1. image_atomic_* emits emit_lds_barrier() outside can_sync_wave64_lds's check (crates/victory-shader/src/emit/lower.rs:8647-8649, crates/victory-shader/src/emit/wave64_lds.rs:67-94):
    if self.lds_wave32_sync { self.emit_lds_barrier(); } is also inserted at the end of image_atomic_* (a texture UAV atomic, not a Fields::Ds LDS op), whereas can_sync_wave64_lds only checks Fields::Ds { gds: false, .. } blocks. A 64-thread shader with a uniform ds_write followed by an image_atomic_* inside a divergent s_and_saveexec_b64 + s_cbranch_execz branch passes can_sync_wave64_lds, drops WaveSize(64), and emits a workgroup barrier inside divergent control flow (hanging when only one Wave32 executes it). (image_atomic_* does not operate on LDS and shouldn't emit an LDS barrier here—or must be checked by can_sync_wave64_lds.)
  2. Scalar mask-modifying instructions materialized via waveActiveBallot can diverge an Atom::Uniform branch across Wave32s (crates/victory-shader/src/emit/wave64_lds.rs:12-25, 86-94, crates/victory-shader/src/structure.rs:1207-1225, 1364-1378, crates/victory-shader/src/emit/lower.rs:416-438, 1672-1680, 1850-1888):
    When console_lanes is false, instructions like s_bitset1_b32 s20, 0 on a v_cmp mask can read a waveActiveBallot result whose low 32-bit word differs between Wave64 and two contiguous Wave32s (0 vs 0xffffffff). A downstream scalar comparison such as s_cmp_eq_u32 s20, 1 is still classified as Atom::Uniform, letting a divergent branch into an LDS block pass can_sync_wave64_lds.

(Non-blocking note: existing compute s_barrier outside Fields::Ds has the same exposure if WaveSize(64) is dropped and s_barrier sits inside a divergent branch; also consider adding a hardware/WARP execution test covering WAR ordering and uniform loops.)

**@⁠fuzeofficlal** on GitHub · 2026-11-26 23:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#pullrequestreview-6081518241) · **requested changes** Thanks for adding `wave64_lds.rs` reachability checks, wrapping `ds_read` with pre/post barriers (closing the WAR/read-to-atomic gap), and rejecting non-waterfall `v_readfirstlane_b32`! Two P0 divergent-barrier issues still remain in `48cb3944`: 1. **`image_atomic_*` emits `emit_lds_barrier()` outside `can_sync_wave64_lds`'s check (`crates/victory-shader/src/emit/lower.rs:8647-8649`, `crates/victory-shader/src/emit/wave64_lds.rs:67-94`)**: `if self.lds_wave32_sync { self.emit_lds_barrier(); }` is also inserted at the end of `image_atomic_*` (a texture UAV atomic, not a `Fields::Ds` LDS op), whereas `can_sync_wave64_lds` only checks `Fields::Ds { gds: false, .. }` blocks. A 64-thread shader with a uniform `ds_write` followed by an `image_atomic_*` inside a divergent `s_and_saveexec_b64` + `s_cbranch_execz` branch passes `can_sync_wave64_lds`, drops `WaveSize(64)`, and emits a workgroup barrier inside divergent control flow (hanging when only one Wave32 executes it). (`image_atomic_*` does not operate on LDS and shouldn't emit an LDS barrier here—or must be checked by `can_sync_wave64_lds`.) 2. **Scalar mask-modifying instructions materialized via `waveActiveBallot` can diverge an `Atom::Uniform` branch across Wave32s (`crates/victory-shader/src/emit/wave64_lds.rs:12-25, 86-94`, `crates/victory-shader/src/structure.rs:1207-1225, 1364-1378`, `crates/victory-shader/src/emit/lower.rs:416-438, 1672-1680, 1850-1888`)**: When `console_lanes` is false, instructions like `s_bitset1_b32 s20, 0` on a `v_cmp` mask can read a `waveActiveBallot` result whose low 32-bit word differs between Wave64 and two contiguous Wave32s (`0` vs `0xffffffff`). A downstream scalar comparison such as `s_cmp_eq_u32 s20, 1` is still classified as `Atom::Uniform`, letting a divergent branch into an LDS block pass `can_sync_wave64_lds`. *(Non-blocking note: existing compute `s_barrier` outside `Fields::Ds` has the same exposure if `WaveSize(64)` is dropped and `s_barrier` sits inside a divergent branch; also consider adding a hardware/WARP execution test covering WAR ordering and uniform loops.)*
Author
Owner

@⁠danielibabet on GitHub · 2026-11-26 23:49 UTC · original

Thanks @⁠fuzeofficlal for catching both P0s! Fixed in HEAD:

  1. image_atomic_* (crates/victory-shader/src/emit/lower.rs):
    • Removed the stray if self.lds_wave32_sync { self.emit_lds_barrier(); } from image_atomic_* (image_atomic_* does not operate on LDS).
  2. Scalar mask-modifying instructions & s_barrier (crates/victory-shader/src/emit/wave64_lds.rs):
    • can_sync_wave64_lds now rejects shaders where a non-EXEC-writing scalar instruction (Fields::Sop) reads a lane_mask (x.st.masks), preventing waveActiveBallot results (e.g. s_bitset1_b32 + s_cmp_eq_u32) from diverging Atom::Uniform branches across two Wave32 waves.
    • Also rejects s_barrier inside divergent[b].
  3. Tests (crates/victory-shader/src/emit/wave64_lds_tests.rs):
    • Added wave64_lds_64_threads_scalar_mask_mod_keeps_wave_size_64 (s_bitset1_b32 + s_cmp_eq_u32 branch -> keeps WaveSize(64) and lds_barriers == 0).

Verified locally:

  • cargo test -p victory-shader wave64_lds_tests -- --test-threads=1 (6 passed; 0 failed)
  • cargo clippy -p victory-shader --all-targets -- -D warnings
  • cargo xtask policy (193 files ok)
**@⁠danielibabet** on GitHub · 2026-11-26 23:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#issuecomment-7205888151) Thanks @⁠fuzeofficlal for catching both P0s! Fixed in `HEAD`: 1. **`image_atomic_*` (`crates/victory-shader/src/emit/lower.rs`)**: - Removed the stray `if self.lds_wave32_sync { self.emit_lds_barrier(); }` from `image_atomic_*` (`image_atomic_*` does not operate on LDS). 2. **Scalar mask-modifying instructions & `s_barrier` (`crates/victory-shader/src/emit/wave64_lds.rs`)**: - `can_sync_wave64_lds` now rejects shaders where a non-`EXEC`-writing scalar instruction (`Fields::Sop`) reads a `lane_mask` (`x.st.masks`), preventing `waveActiveBallot` results (e.g. `s_bitset1_b32` + `s_cmp_eq_u32`) from diverging `Atom::Uniform` branches across two Wave32 waves. - Also rejects `s_barrier` inside `divergent[b]`. 3. **Tests (`crates/victory-shader/src/emit/wave64_lds_tests.rs`)**: - Added `wave64_lds_64_threads_scalar_mask_mod_keeps_wave_size_64` (`s_bitset1_b32` + `s_cmp_eq_u32` branch -> keeps `WaveSize(64)` and `lds_barriers == 0`). Verified locally: - `cargo test -p victory-shader wave64_lds_tests -- --test-threads=1` (6 passed; 0 failed) - `cargo clippy -p victory-shader --all-targets -- -D warnings` - `cargo xtask policy` (193 files ok)
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-27 00:05 UTC · original · requested changes

Thanks for the quick turnaround in 9ca8096b — moving emit_lds_barrier() strictly into ds() resolved the image_atomic_* issue, and wave64_lds_tests (6 passed on both hardware and WARP), emit::lower::tests (33 passed), policy, clippy, and formatting on the touched hunks all pass (lower.rs is 523,071 B, under 512 KiB).

However, a few mask-escape paths remain in can_sync_wave64_lds that can still cause the two Wave32 waves to diverge at an Atom::Uniform branch or alter LDS values:

  1. Missing x.st.highs and non-SOP mask-as-data paths (wave64_lds.rs:84-89, lower.rs:416-439):

    • The new check in can_sync_wave64_lds only inspects Fields::Sop and only checks x.st.masks.contains_key(&r), missing reads of x.st.highs (the upper dword of a 64-bit lane mask, including implicit destination reads/writes on the high dword).
    • Fields::Smem (for example s_buffer_load_dword using a tracked mask SGPR as its offset) is skipped by both can_sync_wave64_lds and reads_mask_as_data (lower.rs:433). That materializes a Wave32-only waveActiveBallot word in mask_dword (lower.rs:1852), which can then drive an s_cmp + s_cbranch_scc* (Atom::Uniform) branch so only one Wave32 executes an LDS op/barrier.
    • v_cndmask_b32 is wholly exempt from reads_mask_as_data (lower.rs:428-430), so a tracked mask SGPR passed as a data operand (not the condition) can likewise materialize a Wave32 ballot before an LDS write.
  2. Test encoding mismatch (wave64_lds_tests.rs:147):

    • In wave64_lds_64_threads_scalar_mask_mod_keeps_wave_size_64, 0xBEB4_1D80 encodes s_bitset1_b32 s52, 0 rather than s20 (0xBE94_1D80). Because s20 is unmodified, the test currently passes via s_cmp_eq_u32 s20, 1 hitting reads_mask_as_data, rather than exercising the s_bitset1_b32 guard. Also consider adding a hardware/WARP execution test verifying cross-wave LDS visibility (not only barrier counts).
**@⁠fuzeofficlal** on GitHub · 2026-11-27 00:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#pullrequestreview-6081843052) · **requested changes** Thanks for the quick turnaround in `9ca8096b` — moving `emit_lds_barrier()` strictly into `ds()` resolved the `image_atomic_*` issue, and `wave64_lds_tests` (6 passed on both hardware and WARP), `emit::lower::tests` (33 passed), `policy`, `clippy`, and formatting on the touched hunks all pass (`lower.rs` is `523,071 B`, under 512 KiB). However, a few mask-escape paths remain in `can_sync_wave64_lds` that can still cause the two Wave32 waves to diverge at an `Atom::Uniform` branch or alter LDS values: 1. **Missing `x.st.highs` and non-SOP mask-as-data paths (`wave64_lds.rs:84-89`, `lower.rs:416-439`)**: - The new check in `can_sync_wave64_lds` only inspects `Fields::Sop` and only checks `x.st.masks.contains_key(&r)`, missing reads of `x.st.highs` (the upper dword of a 64-bit lane mask, including implicit destination reads/writes on the high dword). - `Fields::Smem` (for example `s_buffer_load_dword` using a tracked mask SGPR as its offset) is skipped by both `can_sync_wave64_lds` and `reads_mask_as_data` (`lower.rs:433`). That materializes a Wave32-only `waveActiveBallot` word in `mask_dword` (`lower.rs:1852`), which can then drive an `s_cmp` + `s_cbranch_scc*` (`Atom::Uniform`) branch so only one Wave32 executes an LDS op/barrier. - `v_cndmask_b32` is wholly exempt from `reads_mask_as_data` (`lower.rs:428-430`), so a tracked mask SGPR passed as a data operand (not the condition) can likewise materialize a Wave32 ballot before an LDS write. 2. **Test encoding mismatch (`wave64_lds_tests.rs:147`)**: - In `wave64_lds_64_threads_scalar_mask_mod_keeps_wave_size_64`, `0xBEB4_1D80` encodes `s_bitset1_b32 s52, 0` rather than `s20` (`0xBE94_1D80`). Because `s20` is unmodified, the test currently passes via `s_cmp_eq_u32 s20, 1` hitting `reads_mask_as_data`, rather than exercising the `s_bitset1_b32` guard. Also consider adding a hardware/WARP execution test verifying cross-wave LDS visibility (not only barrier counts).
Author
Owner

@⁠danielibabet on GitHub · 2026-11-27 00:11 UTC · original

@⁠fuzeofficlal Thanks for catching those mask-escape paths and the encoding typo! Fixed in ef308f5:

  1. High-dword and non-SOP mask-as-data paths:
    • \wave64_lds.rs: \can_sync_wave64_lds\ now checks both \x.st.masks\ and \x.st.highs\ across \Fields::Sop\ and \Fields::Smem\ (reads and scalar high-dword writes).
    • \lower.rs\ (
      eads_mask_as_data): now inspects \Fields::Smem\ (\data, \ase, \soffset) and checks the data operands (\ .src.iter().take(2)) of \ cndmask_b32\ and _co_ci\ rather than exempting those instructions entirely.
  2. Test encoding & regression coverage:
    • Fixed \
**@⁠danielibabet** on GitHub · 2026-11-27 00:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#issuecomment-7206256851) @⁠fuzeofficlal Thanks for catching those mask-escape paths and the encoding typo! Fixed in ef308f5: 1. **High-dword and non-SOP mask-as-data paths**: - \wave64_lds.rs\: \can_sync_wave64_lds\ now checks both \x.st.masks\ and \x.st.highs\ across \Fields::Sop\ and \Fields::Smem\ (reads and scalar high-dword writes). - \lower.rs\ (\ eads_mask_as_data\): now inspects \Fields::Smem\ (\data\, \ase\, \soffset\) and checks the data operands (\ .src.iter().take(2)\) of \ _cndmask_b32\ and \_co_ci_\ rather than exempting those instructions entirely. 2. **Test encoding & regression coverage**: - Fixed \
Author
Owner

@⁠upipibi on GitHub · 2026-11-27 00:29 UTC · original

Run of head ef308f5e on an RTX 3070 8 GB (Ampere, wave32 only, SM 6.6), driver 616.56, Windows 11, with main 63bcca43 as the control. No game files used.

cargo test -p victory-shader --lib --features host --locked -- --test-threads=1 wave64_lds, 3 runs on head: 9 passed; 0 failed each time. All nine emit::lower::wave64_lds_tests pass, including the three added in ef308f5 (cndmask_data, scalar_mask_mod, smem_mask_offset keep WaveSize(64)).

Negative control: this head's wave64_lds_tests.rs and its mod line applied to main don't compile. There are 27 errors, all E0609: no field wave_size, lds_wave32_sync or lds_barriers on emit::lower::Lowered. So the tests need the PR's code.

Full lib, --skip heap_direct_texture_reads_mark_their_heap_index on both trees (that test aborts with 0xC0000005 on this card on main too):

  • head: 307 passed; 3 failed; 3 ignored
  • main: 298 passed; 3 failed; 3 ignored
  • The same 3 tests fail on both trees (stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride, stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, synthetic_tests::gathers_at_a_level_match_the_hardware). The +9 on head are the new tests.

One limit: these tests lower the shader and run the dxil.dll validator. They create no D3D12 device, so this doesn't show a WaveSize(64) pipeline being refused or accepted on wave32 hardware, or the LDS exchange result from the WARP repro. That would need a test that creates the pipeline on the card.

AI-assisted (Claude Code, Claude Opus 5.5): ran the tests and wrote this.

**@⁠upipibi** on GitHub · 2026-11-27 00:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#issuecomment-7206505436) Run of head `ef308f5e` on an RTX 3070 8 GB (Ampere, wave32 only, SM 6.6), driver 616.56, Windows 11, with `main` `63bcca43` as the control. No game files used. `cargo test -p victory-shader --lib --features host --locked -- --test-threads=1 wave64_lds`, 3 runs on head: `9 passed; 0 failed` each time. All nine `emit::lower::wave64_lds_tests` pass, including the three added in ef308f5 (`cndmask_data`, `scalar_mask_mod`, `smem_mask_offset` keep WaveSize(64)). Negative control: this head's `wave64_lds_tests.rs` and its `mod` line applied to `main` don't compile. There are 27 errors, all E0609: no field `wave_size`, `lds_wave32_sync` or `lds_barriers` on `emit::lower::Lowered`. So the tests need the PR's code. Full lib, `--skip heap_direct_texture_reads_mark_their_heap_index` on both trees (that test aborts with 0xC0000005 on this card on `main` too): - head: `307 passed; 3 failed; 3 ignored` - main: `298 passed; 3 failed; 3 ignored` - The same 3 tests fail on both trees (`stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride`, `stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `synthetic_tests::gathers_at_a_level_match_the_hardware`). The +9 on head are the new tests. One limit: these tests lower the shader and run the `dxil.dll` validator. They create no D3D12 device, so this doesn't show a WaveSize(64) pipeline being refused or accepted on wave32 hardware, or the LDS exchange result from the WARP repro. That would need a test that creates the pipeline on the card. AI-assisted (Claude Code, Claude Opus 5.5): ran the tests and wrote this.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-27 00:34 UTC · original · requested changes

Thanks for updating the tests and tightening the x.st.highs, Fields::Smem, and v_cndmask_b32/_co_ci_ checks — wave64_lds_tests (9/9 on hardware and WARP), emit::lower::tests (33/33), clippy, and xtask policy all pass, and wave64_lds_tests.rs:161 now encodes s_bitset1_b32 s20, 0 (0xBE94_1D80).

Two issues still block approval:

  1. Multi-SGPR scalar operands only check the first register (lower.rs:442-445) + uncovered Fields variants

    • reads_mask_as_data checks i.read(Reg::S(code)).is_some_and(is_mask), which only inspects the base register of a scalar pair (Operand::Scalar { code, count } with count > 1). If the low word (s20) of a mask pair s[20:21] is overwritten while the high word (s21 in x.st.highs) stays live and is read via s[20:21] in a 64-bit VALU instruction (reproduced with v_lshlrev_b64 v[2:3], v1, s[20:21] feeding ds_write_b32), reads_mask_as_data returns false and lowering proceeds with wave_size = None and lds_wave32_sync = true. Checking all registers code..code + count closes this path.
    • reads_mask_as_data (lower.rs:418-441) and can_sync_wave64_lds (wave64_lds.rs:85) also omit other instructions that can carry scalar mask operands (such as Fields::Buffer { soffset, .. } and Fields::Flat { saddr, .. }).
  2. Formatting (lower.rs:431)

    • rustfmt --edition 2024 --check fails on the newly edited Fields::Valu(v) if matches!(i.name(), "v_cndmask_b32") || i.name().contains("_co_ci_") => arm at crates/victory-shader/src/emit/lower.rs:434-436 (it fits on one line).
**@⁠fuzeofficlal** on GitHub · 2026-11-27 00:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#pullrequestreview-6081993667) · **requested changes** Thanks for updating the tests and tightening the `x.st.highs`, `Fields::Smem`, and `v_cndmask_b32`/`_co_ci_` checks — `wave64_lds_tests` (9/9 on hardware and WARP), `emit::lower::tests` (33/33), `clippy`, and `xtask policy` all pass, and `wave64_lds_tests.rs:161` now encodes `s_bitset1_b32 s20, 0` (`0xBE94_1D80`). Two issues still block approval: 1. **Multi-SGPR scalar operands only check the first register (`lower.rs:442-445`) + uncovered `Fields` variants** - `reads_mask_as_data` checks `i.read(Reg::S(code)).is_some_and(is_mask)`, which only inspects the base register of a scalar pair (`Operand::Scalar { code, count }` with `count > 1`). If the low word (`s20`) of a mask pair `s[20:21]` is overwritten while the high word (`s21` in `x.st.highs`) stays live and is read via `s[20:21]` in a 64-bit VALU instruction (reproduced with `v_lshlrev_b64 v[2:3], v1, s[20:21]` feeding `ds_write_b32`), `reads_mask_as_data` returns `false` and lowering proceeds with `wave_size = None` and `lds_wave32_sync = true`. Checking all registers `code..code + count` closes this path. - `reads_mask_as_data` (`lower.rs:418-441`) and `can_sync_wave64_lds` (`wave64_lds.rs:85`) also omit other instructions that can carry scalar mask operands (such as `Fields::Buffer { soffset, .. }` and `Fields::Flat { saddr, .. }`). 2. **Formatting (`lower.rs:431`)** - `rustfmt --edition 2024 --check` fails on the newly edited `Fields::Valu(v) if matches!(i.name(), "v_cndmask_b32") || i.name().contains("_co_ci_") =>` arm at `crates/victory-shader/src/emit/lower.rs:434-436` (it fits on one line).
Author
Owner

@⁠danielibabet on GitHub · 2026-11-27 00:36 UTC · original

Follow-up while testing on RTX 4070:

  • \wave64_lds.rs: allow pure lane-mask \Fields::Sop\ ops whose scalar destination is tracked in \x.st.masks\ (e.g. \s_or_b64, \s_mov_b64, \s_cselect_b64), matching
    eads_mask_as_data, while still rejecting \x.st.highs\ and non-mask scalar/SMEM uses.
  • \wave64_lds_tests.rs: fixed \
**@⁠danielibabet** on GitHub · 2026-11-27 00:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#issuecomment-7206604357) Follow-up while testing on RTX 4070: - \wave64_lds.rs\: allow pure lane-mask \Fields::Sop\ ops whose scalar destination is tracked in \x.st.masks\ (e.g. \s_or_b64\, \s_mov_b64\, \s_cselect_b64\), matching \ eads_mask_as_data\, while still rejecting \x.st.highs\ and non-mask scalar/SMEM uses. - \wave64_lds_tests.rs\: fixed \
Author
Owner

@⁠zzm1234560621-prog on GitHub · 2026-11-27 00:49 UTC · original

Verification on a Wave32-only Intel host (Arc, Xe-LPG, driver 32.0.101.6127), which is the class of adapter the relaxation is for — ef308f5 on top of 63bcca4:

cargo test -p victory-shader --lib -- wave64_lds
test result: ok. 9 passed; 0 failed; 0 ignored

cargo test -p victory-shader --lib
304 passed, 7 failed, 3 ignored

The seven failures are this adapter's standing set on unmodified 63bcca4 (#3196: three BVH tests one ULP off, arithmetic_matches_the_hardware and the MAD signed zero which #3212 fixes, image_atomics_of_64_bits and the view-heap test covered by #3203/#3178, and fspx_…dot_products). So no new failure here, and the 304 over the 295 baseline includes the 9 new tests.

cargo clippy … -D warnings: clean. cargo xtask policy: 193 files ok.

Two things worth saying about the shape of the evidence, since they bound what this adds:

  1. The new tests are lowering-only. They read lowered.wave_size, lds_wave32_sync, lds_barriers and run the DXIL validator; no device is created (the whole selection finishes in 0.02 s). So what I have verified on the Intel side is that the metadata the relaxation emits is what the tests say, on a host that refuses WaveSize(64).
  2. The device half of the claim is still the author's RTX 4070 result. If you want it on a 32-lane Intel too, the shortest check is a device test that takes the first case's words ([32, 1, 1], 16 dwords of LDS) through Host::compute_pipeline/dispatch and asserts it creates and runs where an unrelaxed WaveSize(64) program does not — I can write and run that here if it is wanted, either in this PR or as a follow-up.

No conflict with #3242 (that one only touches synthetic_tests.rs's assertions about which waves a device can run; this one changes what lower.rs emits).

No game files. AI-assisted (Claude).

**@⁠zzm1234560621-prog** on GitHub · 2026-11-27 00:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#issuecomment-7206787044) Verification on a **Wave32-only Intel** host (Arc, Xe-LPG, driver 32.0.101.6127), which is the class of adapter the relaxation is for — `ef308f5` on top of `63bcca4`: ``` cargo test -p victory-shader --lib -- wave64_lds test result: ok. 9 passed; 0 failed; 0 ignored cargo test -p victory-shader --lib 304 passed, 7 failed, 3 ignored ``` The seven failures are this adapter's standing set on unmodified `63bcca4` (#3196: three BVH tests one ULP off, `arithmetic_matches_the_hardware` and the MAD signed zero which #3212 fixes, `image_atomics_of_64_bits` and the view-heap test covered by #3203/#3178, and `fspx_…dot_products`). So no new failure here, and the 304 over the 295 baseline includes the 9 new tests. `cargo clippy … -D warnings`: clean. `cargo xtask policy`: 193 files ok. Two things worth saying about the shape of the evidence, since they bound what this adds: 1. **The new tests are lowering-only.** They read `lowered.wave_size`, `lds_wave32_sync`, `lds_barriers` and run the DXIL validator; no device is created (the whole selection finishes in 0.02 s). So what I have verified on the Intel side is that the *metadata* the relaxation emits is what the tests say, on a host that refuses `WaveSize(64)`. 2. **The device half of the claim is still the author's RTX 4070 result.** If you want it on a 32-lane Intel too, the shortest check is a device test that takes the first case's words (`[32, 1, 1]`, 16 dwords of LDS) through `Host::compute_pipeline`/`dispatch` and asserts it creates and runs where an unrelaxed `WaveSize(64)` program does not — I can write and run that here if it is wanted, either in this PR or as a follow-up. No conflict with #3242 (that one only touches `synthetic_tests.rs`'s assertions about which waves a device can run; this one changes what `lower.rs` emits). _No game files. AI-assisted (Claude)._
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-27 01:11 UTC · original · requested changes

Thanks for fixing the v_cndmask_b32 encoding in wave64_lds_tests.rs:199 (0x0202_0214). wave64_lds_tests (9/9 on RTX 5090 and WARP), emit::lower::tests (33/33), clippy, and xtask policy pass.

However, the two blockers in lower.rs from the previous round are still present in 174e8d9b, and the new !writes_mask exemption makes the saved-mask case easier to reach:

  1. Multi-SGPR scalar pairs and Fields::Buffer/Fields::Flat still bypass reads_mask_as_data (lower.rs:416-445)

    • reads_mask_as_data still checks only i.read(Reg::S(code)).is_some_and(is_mask) (lower.rs:442), skipping registers code + 1..code + count. With the new !writes_mask exemption in wave64_lds.rs:86-93, a sequence like s_mov_b64 s[20:21], vcc; s_mov_b32 s20, 0; v_lshlrev_b64 v[2:3], v1, s[20:21]; ds_write_b32 ... now passes can_sync_wave64_lds and drops WaveSize(64) while reading s21 (x.st.highs) as data.
    • Fields::Buffer { soffset, .. } and Fields::Flat { saddr, .. } are also still unhandled in reads_mask_as_data (lower.rs:418-441) and can_sync_wave64_lds (wave64_lds.rs:85).
  2. Formatting (lower.rs:431)

    • rustfmt --edition 2024 --check still reports formatting drift on the Fields::Valu(v) if matches!(i.name(), "v_cndmask_b32") || i.name().contains("_co_ci_") => arm at crates/victory-shader/src/emit/lower.rs:434-436.
**@⁠fuzeofficlal** on GitHub · 2026-11-27 01:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/3406#pullrequestreview-6082187843) · **requested changes** Thanks for fixing the `v_cndmask_b32` encoding in `wave64_lds_tests.rs:199` (`0x0202_0214`). `wave64_lds_tests` (9/9 on RTX 5090 and WARP), `emit::lower::tests` (33/33), `clippy`, and `xtask policy` pass. However, the two blockers in `lower.rs` from the previous round are still present in `174e8d9b`, and the new `!writes_mask` exemption makes the saved-mask case easier to reach: 1. **Multi-SGPR scalar pairs and `Fields::Buffer`/`Fields::Flat` still bypass `reads_mask_as_data` (`lower.rs:416-445`)** - `reads_mask_as_data` still checks only `i.read(Reg::S(code)).is_some_and(is_mask)` (`lower.rs:442`), skipping registers `code + 1..code + count`. With the new `!writes_mask` exemption in `wave64_lds.rs:86-93`, a sequence like `s_mov_b64 s[20:21], vcc; s_mov_b32 s20, 0; v_lshlrev_b64 v[2:3], v1, s[20:21]; ds_write_b32 ...` now passes `can_sync_wave64_lds` and drops `WaveSize(64)` while reading `s21` (`x.st.highs`) as data. - `Fields::Buffer { soffset, .. }` and `Fields::Flat { saddr, .. }` are also still unhandled in `reads_mask_as_data` (`lower.rs:418-441`) and `can_sync_wave64_lds` (`wave64_lds.rs:85`). 2. **Formatting (`lower.rs:431`)** - `rustfmt --edition 2024 --check` still reports formatting drift on the `Fields::Valu(v) if matches!(i.name(), "v_cndmask_b32") || i.name().contains("_co_ci_") =>` arm at `crates/victory-shader/src/emit/lower.rs:434-436`.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3406/head:github-bot/gh-3406'
git switch 'github-bot/gh-3406'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3406'
git switch 'github-bot/gh-3406'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3406'
git switch 'github-bot/gh-3406'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3406'
git switch 'main'
git merge --squash 'github-bot/gh-3406'
git switch 'main'
git merge --ff-only 'github-bot/gh-3406'
git switch 'main'
git merge 'github-bot/gh-3406'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3406
No description provided.