From d7422b49d818fc5276b998b138f6d974837fb42a Mon Sep 17 00:00:00 2001 From: notquiteog Date: Wed, 25 Nov 2026 14:08:31 -0600 Subject: [PATCH] Shaders: take the wave-wide form as a last resort on 32-lane hosts A console wave64 compute program that no other form takes off 64-lane waves keeps WaveSize(64), so a host whose waves are 32 lanes (NVIDIA) refuses its pipeline and every dispatch of it is dropped. The wave-wide form (`widen`) is exact, but it is off unless VICTORY_WAVE_WIDE=1, because it lost a card on two particle programs. Those programs have another form and return before this point. It is now also tried last of all, after every other form has left the program on 64-lane waves, where the only other outcome is the pass not running. VICTORY_WAVE_WIDE=0 leaves such programs refused, as before; =1 is unchanged. On an RTX 5060 Ti (32-lane waves) this makes host pipelines for sr_tracing:CS_Tiling_Generate_Opaque (2cc4c197ee29e291) and GpuParticleUpdate:CS_Visibility (369cbe906ea72764); both pass the DXIL validator. Programs whose thread group is several console waves are not helped: `widen` refuses those. Co-Authored-By: Claude Fable 5.2 --- crates/victory-shader/src/emit/mod.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/crates/victory-shader/src/emit/mod.rs b/crates/victory-shader/src/emit/mod.rs index ba72c9be7d..423c39f99a 100644 --- a/crates/victory-shader/src/emit/mod.rs +++ b/crates/victory-shader/src/emit/mod.rs @@ -509,6 +509,29 @@ pub fn emit( } } } + // Last of all, with the wave-wide form not asked for: a program that no other form + // takes off 64-lane waves is refused by a 32-lane host, and its dispatches are + // dropped (`sr_tracing:CS_Tiling_Generate_Opaque` and `GpuParticleUpdate:CS_Visibility` + // on an RTX 5060 Ti). The wave-wide form is exact and makes a pipeline for those two, + // so it is tried here, where the only other outcome is the pass not running at all. + // The programs that lost a card with it had another form and never reach this point. + // `VICTORY_WAVE_WIDE=0` leaves them refused, as before. + if !wide_on && std::env::var_os("VICTORY_WAVE_WIDE").is_none_or(|v| v != "0") { + let deep = form(ir::without_skips(p, true)); + let bases = [ + deep.as_ref().map(|f| &f.0), + forms[1].1.as_ref().map(|f| &f.0), + forms[0].1.as_ref().map(|f| &f.0), + Some(p), + ]; + if let Some(base) = bases.into_iter().flatten().next() { + let again = widen(c, native, base, why); + report("wave-wide branches (last resort)", &again); + if done(&again) { + return again.map(|(shader, _)| shader); + } + } + } } // SCC of a mask operation joined with a scalar test behind a per-lane skip (the 32-lane // trace programs): right once the wave takes that skip together ([`widen`]; the