shader: a phi read only through another phi keeps its missing incoming value #699
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/699"
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 Marvisak/VIctory. Originally posted by arthercz on 2026-11-24T07:02:26Z.
Closes #604.
The emitter refused a branch on a live
s_memtimeread but accepted the same read through two conditional joins:fill_phissubstitutes zero for a missing incoming value of a phi no reader marks, andLower::getmarked only the phi a comparison reads directly. A phi whose value flows solely into another phi's arguments was never marked, so its missing timestamp value silently became zero instead of surfacing the refusal the direct read gets.The fix follows incoming phi dependencies from the phis actual readers mark (fixpoint) before the substitution decision. A dead phi (read by nothing live) still lowers with the zero substitution, matching the issue's expectation.
The regression test is Dathinel's probe from the issue (test-only commit 4b2ea70f), applied unmodified; it compares the direct and the twice-joined read and expects the dead-timestamp variant to keep lowering.
Verified:
cargo test -p victory-shader --features host a_missing_value_stays_missing_through_two_live_joinspasses;cargo test --workspace266 passed;cargo clippy --workspace --all-featuresclean.Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T07:16:33Z.
Review: APPROVED
Tested on Windows 11 MSVC (rustc 1.98.1):
Fixpoint propagation correctly ensures phis whose values flow exclusively into subsequent join phis retain their missing incoming status rather than erroneously substituting zero.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T08:05:05Z.
Review: COMMENTED
Heads-up on the branch shape: this PR's diff against
mainincludes #692's fmt commit, #691's WinRT speech commit, and a WARP opt-out commit — only the tip commitdb0257e("shader: a phi read only through another phi…") is this PR's own change. That's why it's unmergeable/conflicting as-is. Retargeting the base or rebasing onto main after #691/#692 land would make the actual change reviewable.Reviewed the tip commit itself (52+/7- in
emit/lower.rs):fill_phisnow transitively propagates "read" fromread_phisthrough phi incoming args, so a phi consumed only by another phi is treated as read — a missing incoming value now raisesStop::Retryinstead of being zero-substituted on its way to a live read. Dead phis keep the zero substitution. The comment explains exactly this.lowersgained anrsrc2parameter) exercise the branch-on-live-timestamp-read path.Verification on macOS 26 arm64, rustc 1.98.1:
cargo test -p victory-shader --lockedon the head: 57 passed / 0 failed (against its own base). The change is in the portable lowering path, so this is real coverage; the GPU-visible outcome still needs the Windows shader run.Imported from Marvisak/VIctory. Originally posted by iurysf on 2026-11-24T08:16:39Z.
Measured offline against main
c2e7254withvictory translate --list --validateover the title'sshaders.rpf+ executable (26,096 programs), dxil.dll 1.9.2602.17, comparing outcomes program by program:s_memtimecase in #604.AI-assisted.
Imported from Marvisak/VIctory. Originally posted by slint6614-dev on 2026-11-24T09:30:31Z.
Measured on the full retail shader pack (26,503 containers) with
victory translate --validate --pipelines(pipelines on an AMD RX 9070, Windows 11, dxil.dll from SDK 10.0.26100). Counts are emitted / validated / pipelines.This PR conflicts with current main (
lower.rs), so it was measured on its own base against main1f858b0, which predates #612 (VS/PS 12272 / 12172, CS 1693 / 1670, MS 8191 / 8129).With this PR: VS/PS 12220 / 12130, CS 1440 / 1417, MS 8163 / 8101. That is the same loss of 323 validated programs (42 VS/PS, 253 CS, 28 MS) as the merged #612 shows (see my measurement there), with the same refusal reasons. So it fixes #604 the same way, but it now duplicates #612.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:27:40Z.
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.The fix for #604 (a phi read only through another phi is live) is already in main through #612 (commit
3dd467c), and this copy carries a workspace-wide cargo fmt.If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed