Shaders: s_min/s_max set SCC from the comparison; v_readlane/v_writelane lanes wrap (port of avatarmanz#404) #71
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!71
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-71"
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?
@simbaui4life on GitHub · 2026-11-27 16:14 UTC · original
fix/salu-minmax-scc-lane-masks→main· +64 −4 · 2 files · 2 commits · closed without mergingA port of avatarmanz/VIctory-7900XTX#404, review fix included. Two commits on
d12eb1b.Cause
s_min_{i,u}32/s_max_{i,u}32set SCC when S0 is chosen. The lowering gave no SCC of its own, so the genericD != 0was used. Ans_cselectors_cbranch_sccafter a min/max then took the wrong side whenever the two disagree, for examples_min_u32 s0, 5, 3: SCC 0 on the console, 1 here.v_readlane_b32/v_writelane_b32take the lane from S1[4:0] (wave32) or S1[5:0] (wave64). A select past the wave read the wrong lane or wrote no lane here.unspillmatched constant lanes before they were wrapped, so in wave32 lanes 36 and 4 were two slots. UwUCammie found this; their version is in jtrudeau1530/VIctory-7900XTX#38.What this does
emit/lower.rs: min/max return the comparison as SCC, and readlane/writelane mask a console lane withwave - 1. Host lanes (MaskData::Host) are unchanged.ir.rs:lane_wrapped_fieldswraps constant lanes beforeir::buildandunspillsee them.Tested (RTX 4070 Ti, driver 621.01)
a_constant_lane_past_the_wave_is_its_lane_modulo_the_wavefails without the change.-D warningsis clean.Not tested: in the game (no game data here).
No game data in the commits.
🤖 Generated with Claude Code
s_min_{i,u}32 and s_max_{i,u}32 set SCC when S0 is chosen (S0 < S1 for min, S0 > S1 for max). The lowering returned no SCC, so the generic D != 0 was used: s_cselect or s_cbranch_scc after a min/max took the wrong side whenever the result was nonzero but S1 was chosen (or zero with S0 chosen). Marvisak/VIctory's lowering already does this. v_readlane_b32 and v_writelane_b32 take the lane from S1[4:0] (wave32) or S1[5:0] (wave64). A select past the wave read 0 or wrote no lane here; it now wraps as on the console. Lanes that are host lanes (pixel/vertex programs with a computed lane) are unchanged. Both were found by differential testing of the translator against an independent RDNA2 interpreter on the GPU. Ported from avatarmanz/VIctory-7900XTX#404. No version bump here: the shader cache is keyed by the build. Co-Authored-By: Claude Opus 5.5 <[email protected]>@Dukestar69 on GitHub · 2026-11-27 16:31 UTC · original · approved these changes
LGTM — verified on Windows (RTX 5090):
SCC = Some(t)fors_min_*/s_max_*and maskingv_readlane_b32/v_writelane_b32lanes towave - 1(both inlower.rsand inir.rs::lane_wrapped_fieldsbeforeunspill) matches RDNA2 ISA semantics cleanlycargo test -p victory-shader --lib ir::(11/11, includinga_constant_lane_past_the_wave_is_its_lane_modulo_the_wave) andemit::tests::(21/21) passedcargo clippy -p victory-shader --all-targets -- -D warningspassed with 0 warningscargo xtask policypassed (279 files ok)Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Pull request closed