Shaders: emit waveGetLaneIndex in the entry block for console_lane and thread_id #865
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/865"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by RVZO6 on 2026-11-28T08:06:43Z.
Summary
Fixes two SSA dominance / forward-reference panics (
forward reference outside a phiincrates/victory-shader/src/emit/bitcode.rs) when loweringconsole_lanescompute shaders that have nohalvesorticketcounter (such as full-32 KiB LDS Wave64 compute shaders lowered to Wave32 by #822 when paired with #733 orlower_counted):Lower::console_lane(): Previously returnedself.lane_index()(which emitsdx.op.waveGetLaneIndexintoself.cur) whenhalves.is_none(). Callers such asexchange_halves(at, ...)(called fromballot_atwith an earlier blockat) then emittedcmp(at, pred::IUGE, cl, 32)referencingcldefined in a later blockself.cur, panicking inbitcode.rs. Now emits and cacheswaveGetLaneIndexinself.s.entry(settingflags::WAVE_OPS) socldominates all blocks.Lower::thread_id(): Previously duplicatedconsole_thread()for thehalves.is_none() && ticket.is_none()fallback, callingself.lane_index()(self.cur) and using it insideself.s.m.bin(e, Bin::Add, base, lane)(self.s.entry). Now delegates unconditionally toself.console_thread(), which already emitswaveGetLaneIndexintoself.s.entry(also removing 34 duplicate lines fromlower.rs).Verification
cargo test -p xtask: 6/6 passedcargo test -p victory-shader --lib: 207/207 passedCARGO_FEATURE_PURE=1 cargo check --target x86_64-pc-windows-msvc -p victory-shader --tests: clean, 0 errors