Shaders: s_min/s_max set SCC from the comparison; v_readlane/v_writelane lanes wrap #404
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!404
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-404"
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 00:19 UTC · original
simbaui4life:fix/salu-minmax-scc-lane-masks→main· +65 −5 · 3 files · 2 commits · openTwo lowering faults, found by differential testing of the translator against an independent RDNA2 interpreter on the GPU (the harness is #403; this PR does not need it). One commit on
014d52d.Cause
s_min_{i,u}32/s_max_{i,u}32set SCC when S0 is chosen (S0 < S1 for min, S0 > S1 for max). The lowering gave no SCC of its own, so the genericD != 0was used, and ans_cselect_b32ors_cbranch_scc0/1after a min/max took the wrong side whenever the two disagree. Example:s_min_u32 s0, 5, 3gives SCC 0 on the console and 1 here. Marvisak/VIctory's lowering already sets SCC this way.v_readlane_b32/v_writelane_b32take the lane from S1[4:0] (wave32) or S1[5:0] (wave64). Here, a select past the wave read the wrong lane's value or wrote no lane. On the console it wraps.What this does
emit/lower.rs: min/max return the comparison as SCC. readlane/writelane mask a console lane withwave - 1. A computed lane that is a host lane (MaskData::Host, pixel/vertex programs) is left as it was.TRANSLATOR_VERSION1 → 2. #353 and #354 also go 1 → 2, so whichever lands later needs the next number.v_writelanewrite a lane EXEC leaves out, which this PR does not do.Tested (RTX 4070 Ti, driver 621.01, Windows 11 26200; wave64 programs on 32-lane host waves)
cargo clippy -p victory-shader --all-targets -- -D warnings, the same with--all-features, andcargo test -p victory-shader(302 passed, 0 failed).Not tested: in the game (no game data here), AMD hardware, and how many of the title's programs change (
victory shaderswould say).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. TRANSLATOR_VERSION 1 -> 2. Co-Authored-By: Claude Opus 5.5 <[email protected]>@UwUCammie on GitHub · 2026-11-27 00:43 UTC · original
I ported this to the AMD fork and found one more place that needs the lane mask. The scalar spill pass runs before lowering, so it used to treat lane 36 and lane 4 as separate slots in wave32. The backport normalizes constant selectors in IR before that pass.
The IR test and both hardware fixtures passed on my RX 7900 XT under Wine with RADV 26.3.1. AMD backport
@simbaui4life on GitHub · 2026-11-27 15:26 UTC · original
Thanks, you're right:
unspillmatched constant lanes before the lowering wrapped them, so in wave32 lanes 36 and 4 were two slots there.I took your normalization from jtrudeau1530/VIctory-7900XTX#38 into this PR (
e86d7a6, credited in the commit):lane_wrapped_fieldsinir::buildandunspill. The new IR testa_constant_lane_past_the_wave_is_its_lane_modulo_the_wavechecks that the lanes alias in wave32 and stay apart in wave64. It fails without the change.This branch:
cargo test -p victory-shader303 passed, clippy-D warningsclean, also with--all-features(RTX 4070 Ti).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.