Shaders: fix RPO resource tracking, SMEM alignment, raw VCC branch, and readlane/writelane semantics (#1249) #1336
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!1336
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1336"
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?
@wbkepler on GitHub · 2026-11-24 17:32 UTC · original
wbkepler:shader/rdna2-isa-and-rpo-fixes→main· +381 −21 · 5 files · 2 commits · openSummary
Fixes five RDNA2 shader ISA and CFG tracking bugs identified in #1249:
VIC-BT-024(crates/victory-shader/src/resource.rs): Iterateresource::track()inreverse_postorder(&p.blocks)rather than raw vector index order so descriptor/waterfalls_loads in higher-indexed blocks (such as copies appended bystructure::split_irreducible()) populateout.scalarbefore lower-indexed consumers inspect them.VIC-BT-025(crates/victory-shader/src/emit/lower.rs): Mask eachs_buffer_load_dword*address term (base,offset,soffset) independently with& !3u32before summing (matching RDNA2 silicon wheresoffset = 3, offset = 3resolves to byte+0, not+4).VIC-BT-026(crates/victory-shader/src/structure.rs): Evaluates_cbranch_vccz/s_cbranch_vccnzon rawvccinstead ofvcc & exec(matching RDNA2 scalar VCC branch semantics;v_cmpalready writesvccunderexec).VIC-BT-030(crates/victory-shader/src/emit/lower.rs,wave.rs): Mask theS1lane-select operand ofv_readlane_b32andv_writelane_b32toS1 & 31(Wave32) /S1 & 63(Wave64) beforewaveReadLaneAt/lane_id == lane.VIC-BT-031(crates/victory-shader/src/emit/lower.rs): Lowerv_writelane_b32unconditionally without gating the destination write onEXECso SGPR spills to inactive lanes in divergent control flow are preserved.Testing
resource.rs,structure.rs,emit/wave.rs, andemit/lower.rs.cargo clippy -p victory-shader --all-targets— cleancargo test -p victory-shader— 126 passed, 0 failed (1 ignored benchmark)cargo xtask policy— 154 files ok(AI-assisted implementation and verification.)
@dpalacios69 on GitHub · 2026-11-24 18:26 UTC · original
Independent check on Linux of head
da23e89, merged onto currentmain(ffe310e; a fast-forward):cargo test -p victory-shader --lockedpasses (102 passed, 0 failed, 1 ignored). The 6 test(s) it adds run on Linux and pass.cargo clippy -p victory-shader --all-targets -- -D warningsshows nothing of its own, only the two unused-import errors inemit/mod.rsthatmainalready has on Linux. No GPU run. AI-assisted; no game data.@sinan-cmyk on GitHub · 2026-11-24 19:50 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head
da23e89ontomainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,724 with this PR.No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 126, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@wbkepler on GitHub · 2026-11-24 21:05 UTC · original
Follow-up pushed in
4eead6e, prompted by a comparison with #1312 by @ashrafsdrop, who gets the credit for this exception:v_readlane_b32host lanes: this PR masked every lane index by the console wave. In a pixel or vertex program, a computed lane (MaskData::Host) is a host lane, so on a 64-lane AMD host wave the mask cut off lanes 32–63. Those lanes are now left unmasked, the same exception #1312 makes. Constant (console) lanes andv_writelane_b32are still masked. This had no effect on 32-lane NVIDIA hosts.resource.rs): thev_writelane/v_readlaneSGPR spill matcher now compares constant lanes modulo the wave too. Without that, a spill to lane 35 would not match its restore from lane 3 once the lowering wraps them.a_computed_host_lane_in_a_pixel_program_is_not_masked: in a pixel program, a computed lane 35 reacheswaveReadLaneAtas 35, not 3.Verified with clippy
-D warnings(victory-shader + victory diagnostics),cargo test -p victory-shader(127 passed) andcargo xtask policy.Note for the maintainer: this PR and #1312 overlap on the readlane/writelane lane masking and the
write_ichange. Either one can land first, and the other will need a rebase.AI-assisted (Claude Code); checked on Windows 11 / RTX 5090.
@Marvisak on GitHub · 2026-11-25 01:22 UTC · original
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/lower.rs,crates/victory-shader/src/emit/wave.rs,crates/victory-shader/src/structure.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.