Translate compute selects with numeric lane masks #69
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/69"
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 Marvisak/VIctory. Originally posted by flapwarp78 on 2026-11-24T00:10:56Z.
What changed
v_cndmask_b32can read a mask held as ordinary scalar data. The emitter now reads the mask words from that instruction's SSA operands and tests the bit for the current console lane. Wave64 uses both words, even if different instructions wrote them.The compiler retries with a fixed wave size only when a live numeric select blocks translation.
Verification
The recovered shader requires wave64. In-game execution is still unverified.
upstream-sync referenced this pull request2026-11-24 06:52:17 +00:00
Imported from Marvisak/VIctory. Originally posted by tedin7 on 2026-11-24T00:48:03Z.
checked: PR head
18f3937(merge-base35b054e), Linux x86_64 (Debian, kernel 6.12), rustc/cargo 1.98.1, throwaway worktree, no game files used.Ran (shader crate only):
cargo test -j4 -p victory-shader: 52 passed, 0 failed (includesselect_tests::selects_from_independently_written_mask_words).origin/main9aef3d9(clean merge): 57 passed, 0 failed.cargo clippy -j4 -p victory-shader --tests: no new warnings (only the existingconstant_color is never usedwarning inemit/mod.rstests).lower.rsandstructure.rsreverted to the merge-base and the new test module kept, the test fails withUnsupported { offset: 44, what: "a select on an untracked mask" }. With the PR it passes, so the test does guard the change.Review notes:
select(cond, src1, src0)), wave64 reads both dwords from the SSA operands of the select, and the retry only happens for compute and only for that specific error, so other stages and other errors keep today's behaviour.SFI0is set only when the select result is used (all three wave32/wave64 cases). It does not check which lanes pick which value, and no DXIL validation runs incargo test. The lane 31/32 check and the validator run described in the PR come from your external harness, which I could not rerun here.st.masks(by low dword), the new code recordsselect_masksonly whenmask()reports the mask as derived at that point of the pass. I could not build a case where the two differ and all existing tests pass, but a mask that only entersmaskslater in a pass (loop-carried) is the place I would look, and the real-shader scan you describe is the right check for it.origin/mainand trial merges are clean with #25, #48, #73, #101, #110, #116, #126, #127. It conflicts with #54 in theconsole_lanescomputation inLower::new(#54 rewrites that closure; the fix is to add thenumeric_selects && numeric_select(...)clause into #54's version).Not verified: Windows runtime, GPU, in-game execution, or the 2,682-shader scan (needs game data I did not use).
Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T00:59:50Z.
Tested
18f3937on Arch Linux x86_64, rustc 1.98.1: pass.cargo test -p victory-shader: 52 passed, 0 failed (2 test binaries), including the test this PR adds.victory-gpuE0425; the shader crate itself is green.No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).
Imported from Marvisak/VIctory. Originally posted by ordis-labs on 2026-11-24T15:00:48Z.
Measured this on current main (
ffe310e) over the 1.0.2.1shaders.rpf(translate --list --validate, outcomes matched program by program). It needed a small local rebase:structure.rsnow has main'spaired_masksnext to this PR'sselect_masks(kept both), and the test'sresource::trackcall takesSome(&st)sinceffe310e."A select on an untracked mask" disappears for all 288 programs main refuses with it, and nothing that validates on main breaks. Only 2 fully validate yet. The rest stop at the next gap: 205 at "a descriptor read only as data", 33 at "a descriptor's address or format read as data", 32 at "a structured buffer of unknown stride" (which #704 covers).
cargo test -p victory-shader: 106 passed, and the only failures are the same 15 GPU tests that fail on main here (Windows 10, no SM 6.6 device).Tested and written up with Claude's help.
Pull request closed