Repository navigation
Conversation
RecompLive
added a commit
to RecompLive/victory-fork
that referenced
this pull request
Nov 25, 2026
… (victory #2347, DenRakEiw) Lane masks that pass through a VGPR lane (`v_writelane_b32` / `v_readlane_b32`), through an `Atom::Phi` join (including loop back-edges), or into a `*_co_ci_u32` carry are now tracked, so a program that selects on them lowers instead of being refused. - `structure`: `restored` masks feed SOP mask ops; wave32 `v_readlane` restores keep mask identity; `phi_joins` resolves every phi argument, back edges included; a constant or a join read by `v_cndmask` or `*_co_ci_u32` is resolved where it is used. - `lower`: `mask_dword` forwards a restored mask to the original ballot; `mask_number` takes `andn1` / `orn1`; `pending_masks` skips never-taken edges, maps wave64 high args and reads `masks` or `other`; `mask_operand` unifies `v_cndmask` and carry masks; the signed 64-bit overflow of `v_mad_i64_i32` reaches `lane_bits`. Ported from Marvisak/VIctory#2347 (DenRakEiw) with a conflict resolved against our console-wave refusal in `mask_dword`: the restored-mask forwarding runs first, then the refusal. Six new synthetic tests. (The previous auto-checkpoint 3787b4d pushed this file with conflict markers; this commit is the resolved version and builds.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the lane-mask tracking and lowering gaps identified in #2268 item 4 (separate from #2289's data-phi mask resolution):
Spilled lane masks (
v_writelane_b32/v_readlane_b32):structure.rs:Lanes::stepnow checksself.restoredforFields::Sopso scalar mask ops reading a restored mask keep mask tracking, and tracks Wave32v_readlane_b32restores of tracked masks inself.masks(without markingactiveat the restore block).lower.rs:mask_dwordforwardsst.restoredto the original mask value so ballots are taken at the original write block;mask_numberalso supportsandn1/orn1.Lane-mask phi joins (
Atom::Phi):structure.rs: records incoming arguments ofAtom::Phijoins inphi_joinsand resolves every edge (including loop back-edges) inwrong_joins.lower.rs:pending_masksinfill_phisskipsnever_takenedges, maps Wave64 high args viast.highs, and looks upst.masksorst.other(unblocking constant-initialized mask phis such ass_mov_b32 s0, 0before a loop).Carry-in & carry-out masks:
structure.rs:Lanes::stepresolvessrc[2]viaself.mask(k)for*_co_ci_u32instructions as well asv_cndmask_b32.lower.rs: unifiesv_cndmask_b32and*_co_ci_u32throughmask_operand(supportingNULL,st.masks,st.other, and inline constants), and emits the signed 64-bit overflow carry forv_mad_i64_i32intolane_bits.Testing
structure::tests(restored_mask_feeds_sop_mask_op,loop_mask_phi_with_zero_init_resolves_all_args,carry_in_from_constant_is_tracked) and 3 inemit::lower::tests(loop_mask_phi_initialized_to_zero_lowers,spilled_mask_feeds_sop_and_reads_as_data,carry_in_constant_and_mad_i64_carry_out_lower).cargo test -p victory-shader structure::tests: 14/14 passed (RTX 5090 & WARP).cargo test -p victory-shader emit::lower::tests: 24/24 passed (RTX 5090 & WARP,dxil.dllvalidated).cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.Related to #2268, #1633.
AI-assisted (Gemini 4 Neon).