shader: settle copy propagation when phis oscillate #54
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!54
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/54/head"
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?
@Sandile-0511 on GitHub · 2026-11-26 11:35 UTC · original
Sandile-0511:fix/copy-propagation-settles→main· +71 −3 · 2 files · 3 commits · merged 2026-11-26 12:57 UTCWhat this changes
Every run of the title logged 22 pixel pieces refused with
GFX10 code at 0x0: copies that do not settle.Tracer::propagate_copiesis an optimistic fixpoint, and its phi rule is not monotone: a phi whose arguments are all copies of one value can see them disagree within a sweep, stand for itself for one sweep, then return to the copy. When such phis feed each other across nested loops the sweeps cycle (period 3 in the reproduction), so raisingMAX_ROUNDSwould not help.The first
MAX_ROUNDSsweeps are unchanged, so every program that settles today gets the same result. After that, a phi that still changes is pinned to stand for itself, as a real join does. That loses copy information for those phis but never names a wrong origin. The loop is bounded and the old error stays as a backstop.The reproducing shape is a register saved to a second register and restored inside an inner loop, inside a loop whose entry value is itself an outer loop's phi. That the 22 real pieces have this shape is a guess; I did not inspect them.
How it was tested
cargo test -p victory-shader: 220 passed, 0 failed, 2 ignored. New testresource::tests::copies_restored_in_nested_loops_settle(13 hand-assembled instructions); it failed before the change with exactlyUnsupported { offset: 0, what: "copies that do not settle" }.cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings(clean, run on a Mac)cargo xtask policy(365 files ok)Checklist
VICTORY_*variable and documented (none added)@LakshanSivakumar on GitHub · 2026-11-26 11:51 UTC · original · requested changes
The nested-loop test reproduces
copies that do not settleon main and passes here. Please add a short note todocs/native-host.mdexplaining that the fallback keeps unsettled phis as joins and can retain less copy information.@Sandile-0511 on GitHub · 2026-11-26 12:30 UTC · original
Added a "Copy propagation that does not settle" note to the translator list in
docs/native-host.md: afterMAX_ROUNDSsweeps a phi that still changes is kept as a join, which never names a wrong origin but can retain less copy information, so something traced through it may be refused later. Programs that settle withinMAX_ROUNDSare unaffected.@LakshanSivakumar on GitHub · 2026-11-26 12:48 UTC · original · approved these changes
Thanks, the earlier requests are addressed and the checks pass (tests incl. Metal, Windows clippy, policy). Approved.