Translate compute selects with numeric lane masks #69
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!69
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/69/head"
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?
@flapwarp78 on GitHub · 2026-11-24 00:10 UTC · original
flapwarp78:shader/numeric-compute-select→main· +144 −11 · 2 files · 1 commits · closed without mergingWhat 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.
@tedin7 on GitHub · 2026-11-24 00:48 UTC · original
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).
@DaviTostes on GitHub · 2026-11-24 00:59 UTC · original
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).
@ordis-labs on GitHub · 2026-11-24 15:00 UTC · original
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