Shaders: s_min/s_max set SCC from the comparison; v_readlane/v_writelane lanes wrap #404
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from avatarmanz/VIctory-7900XTX. Originally posted by simbaui4life on 2026-11-27T00:19:01Z.
Two 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
Imported from avatarmanz/VIctory-7900XTX. Originally posted by UwUCammie on 2026-11-27T00:43:59Z.
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
Imported from avatarmanz/VIctory-7900XTX. Originally posted by simbaui4life on 2026-11-27T15:26:12Z.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.