Shaders: emit waveGetLaneIndex in the entry block for console_lane and thread_id #865
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!865
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@RVZO6 on GitHub · 2026-11-28 08:06 UTC · original
RVZO6:fix/console-lane-thread-id-entry-block→main· +14 −43 · 1 files · 1 commits · merged 2026-11-28 19:39 UTCSummary
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 errorsFixes two SSA forward-reference panics ('forward reference outside a phi' in bitcode.rs) when lowering console_lanes compute shaders without a halves or ticket counter (e.g. full-32 KiB LDS Wave64 shaders lowered to Wave32 in #822, or counted dispatches on ticketless console_lanes shaders): - console_lane() returned self.lane_index() (emitted into self.cur) when exchange/halves were none, which exchange_halves(at, ...) then referenced in an earlier block at; emit and cache waveGetLaneIndex in self.s.entry. - thread_id() called self.lane_index() (into self.cur) and added it in self.s.entry; delegate unconditionally to console_thread(), which already emits waveGetLaneIndex in self.s.entry.