fix(shader): accept overwritten VGPR inputs in counted indexed writes #457
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!457
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-457"
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?
@jeremygold02 on GitHub · 2026-11-24 03:39 UTC · original
jeremygold02:codex/counted-movreld-phi→main· +0 −0 · 0 files · 2 commits · openShader lowering
A pixel shader can use
v_movreld_b32to initialize a range of VGPRs that held barycentric inputs at entry. The IR tracks the old value of every possible destination. On main,fill_phiscan reject a later color export withbarycentrics read directlyeven when the indexed writes cover that register before the first observable read.Allow an undefined incoming value when the translator can prove that an unguarded indexed move overwrites it on that edge or that a counted loop initializes the slot before its only exit. The loop case follows the SSA values for M0, the unit increment, the SCC comparison and the branch. It preserves the value carried on the backedge and requires that the old value has no other consumer.
This runs on the default translation path and requires no raw barycentric input in the emitted shader. Shaders that actually consume incoming barycentrics still receive the existing refusal. The raw-input paths proposed in #281, #442 and #453 address that separate use case.
Verification
[1.0, 0.0, 0.5, 0.5]bit for bit. Both emitted shaders passed Windows SDK DXIL validation. Main rejected the indexed shader. Ending the loop after one iteration still produces the expected refusal.Refs #97.
@sebastianspicker on GitHub · 2026-11-24 11:10 UTC · original
Tested
efcd753against currentmainffe310e(macOS, Rust 1.98.1).The branch merges without conflicts, but the new test no longer compiles there. #566 changed
resource::trackto take the structured program as a fourth argument:Building
stfirst fixes it, the same waymainnow does inlowers:With that change, on the merge with
main:cargo test -p victory-shader: 97 passed, 1 ignored.indexed_move_initializes_an_input_before_its_first_usefails withmain'slower.rsand passes with this branch's.x86_64-pc-windows-msvc,--all-targets -D warnings) is clean.Container::parseplusemit::translatein 90 s, no panic.I haven't checked the hardware result or reviewed each refusal case in the fixture; this is only the build, test and regression side.
AI-assisted.
@alexdeliu on GitHub · 2026-11-24 17:23 UTC · original
Merged onto
main@ffe310eb, this PR (efcd753a) no longer compiles its tests.crates/victory-shader/src/emit/mod.rs:661callsresource::trackwith 3 arguments. Since6638098cit takes a 4th,lanes: Option<&Structured>; main's tests passSome(&st)withlet st = structure::structure(&p).unwrap();.Checked with CI's steps (both clippy runs with
-D warnings,cargo test --workspace) on Windows 11, AMD RX 9070. Every open PR: https://gist.github.com/alexdeliu/ef9ef0ebc1776ff104b5aa8eaea18e87@jeremygold02 on GitHub · 2026-11-24 17:36 UTC · original
@alexdeliu Thanks for catching this. I merged
mainatffe310ebinto this PR and fixed the fixture in08b681c2. It now computesstbefore callingresource::trackand passesSome(&st), matching the other tests on main.The focused regression test and both CI Clippy commands passed locally on Windows 11.
cargo test --workspace --lockedalso passed with 343 tests passed, 0 failed, and 6 ignored.@alexdeliu on GitHub · 2026-11-24 17:46 UTC · original
@jeremygold02 rechecked
08b681c2merged ontomain@ffe310ebon the RX 9070: both CI clippy runs are clean andcargo test --workspacepasses (343 tests).@Marvisak on GitHub · 2026-11-25 00:19 UTC · original · edited 2026-11-26 01:22 UTC
Automated triage for the maintainers.
Proposed close: already in
main. Your proof was ported onto the current lowering inf342dcf("Shaders: inputs a counted v_movreld loop overwrites first need no value", credited to this PR):Lower::overwritten_movreld_edgeandLower::counted_movreld_indexincrates/victory-shader/src/emit/lower.rs, used from the fill-phis arm, with your 15-case test asindexed_move_initializes_an_input_before_its_first_useincrates/victory-shader/src/emit/mod.rs. The latest push (d00ddae) is a merge ofmainthat leaves no difference frommain. Thank you for the work and the hardware verification; it made the bloom downsample shader translate.This PR will be closed in 48 hours unless you push a change that adds something
mainlacks or a maintainer removes the label.Generated by Claude Code
@jeremygold02 on GitHub · 2026-11-25 02:58 UTC · original
@Marvisak I rebased this branch onto
mainat940d32f6and resolved the conflict inemit/lower.rs. The new head is2cc715e1. All 15 focused regression cases passed locally, including Windows SDK validation for both positive cases. GitHub now reports the branch merges cleanly. This is ready for the content review requested in triage. The CI run passed both Clippy configurations and the workspace tests.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.