Shaders: a select on a lane mask held as a number keeps the console's lanes (release lowered it without them; debug hit the cross_lane assertion) #308
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!308
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-308"
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?
@compaccount1-coder on GitHub · 2026-11-26 15:20 UTC · original
compaccount1-coder:fix/select-on-numeric-mask→main· +33 −0 · 2 files · 1 commits · openWhat and why
v_cndmask_b32on a lane mask the code holds as a number (not onestructuretracks as lanes: a constant bit pattern, or one loaded from memory) is lowered to the lane's own bit of that number (lane_bit,lower.rs~9279). That bit is the console's only where host lanes are the console's, which is whatconsole_lanesis for.The check that sets
console_laneslooks for the cross-lane instructions, masks read as data (reads_mask_as_data, which skipsv_cndmask_b32on purpose), guards on constant masks (lane_constant_masks, whose comment says masks only selects read are not followed) and wave-wide branches. A select on a numeric mask is in none of them, so a compute program whose only cross-lane code is such a select was lowered without console lanes:play.ps1runs;diaginheritsrelease): noWaveSizeand no relabelling, so each lane took the bit of whatever host lane it landed in;debug_assert!(self.s.threads.is_none() || self.console_lanes)incross_lanefires. The assertion states exactly the invariant that was missed.The change
selects_on_mask_data(st, i)(av_cndmask_b32whose mask operand reads a value that is not inst.masks, the same lookup the lowering does) now counts forconsole_lanes, besidereads_mask_as_data. About 15 lines. The other two numeric-mask paths (Atom::Opaque/Atom::Constantinboolean) were already guarded byif self.console_lanes, and carry-ins refuse untracked masks, so this select was the only gap.Tested
wave64_tests::a_select_on_a_mask_held_as_a_number_keeps_the_consoles_lanes: an every-other-lane select (s_mov_b32 vcc_lo, 0x55555555;v_cndmask_b32) in a wave32 program of 64 threads.cross_lanefires.--release:wave_sizeisNone.Some(32), in both.cargo test -p victory-shader: everything else passes as before. The only failures are the three validator tests that need a newer Windows SDK'sdxil.dllthan this PC has (10.0.22621), the same as without this change. Clippy is clean, and rustfmt reports nothing new.spill::build→structure→resource::track→io::raise→emit::emit. 500,000 programs, about 54,000 emitted; this was the one panic, found from a load into s[103:106] (VCC) followed by a select on VCC.Not run: the title's own shaders, since I have no game files. I have not seen a title shader with only this kind of select. The change can only turn
console_laneson for compute programs that contain one, so a shader census before and after (victory shaders) would show whether any title program changes.AI-assisted: yes (Claude Code)
🤖 Generated with Claude Code
@illuminatedfellow on GitHub · 2026-11-26 16:48 UTC · original
Independent confirmation: fuzzing the translator on Linux (mutated test programs and random words through
ir::build→structure→resource::track→io::raise→lower, debug assertions on) hitdebug_assert!(self.s.threads.is_none() || self.console_lanes)incross_lanefrom thev_cndmask_b32numeric-mask path (lower.rs~9278) 18 times in 800,000 programs. With this PR'slower.rschange applied toc9c932c, all five cases I replayed lower without hitting it.(Written with Claude Opus 5.5.)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.