Shader emitter accepts an unsupported timestamp read after two SSA joins #604
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#604
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@Dathinel on GitHub · 2026-11-24 05:26 UTC · original
On Windows x64 at
d2a4bae1, the shader emitter rejects a branch that reads an unsupporteds_memtimeresult directly, but accepts the same read after two conditional assignments. The timestamp is still observable when the workgroup has X = 0 and Y = 1.The synthetic compute shader enables the X and Y group-id SGPRs (
rsrc2 = 3 << 7). Its relevant operations are:a scalar memory read as dataI would expect the two live reads to agree. Reading the group id at the final branch instead makes the timestamp dead and should still lower. This concerns the emitter's acceptance decision; the experiment used no game data or native hardware reference.
Lower::getmarks the phi used by the final comparison. The earlier phi is read only by the later phi. Infill_phis, an unmarked phi may substitute zero for a missing incoming value. Following incoming phi dependencies from the actual readers made the live and dead controls pass locally.Reproducer: test-only commit 4b2ea70f. To run it on the stated base, apply the test-only commit, then run:
On the original emitter, the assertion prints
left: None(joined) andright: Some("a scalar memory read as data")(direct). I found this while testing #521; it also reproduces on unmodifiedmainwith only the test added. AI tools assisted with the reproducer and independent review.@LAKSHYA-cmd-tech on GitHub · 2026-11-24 07:50 UTC · original
PR #699 (
shader: a phi read only through another phi keeps its missing incoming value) addresses this issue directly.In
fill_phis, PR #699 properly tracks incoming phi dependencies through multiple joins rather than only marking immediately read phis, ensuring that an unlowered/missing incoming value (such ass_memtime'sa scalar memory read as data) correctly propagates its missing status through cascaded phi nodes instead of being silently substituted with zero.We verified PR #699 against your reproducer
a_missing_value_stays_missing_through_two_live_joins, and the test passes cleanly on Windows 11 MSVC.@Dathinel on GitHub · 2026-11-24 08:04 UTC · original
Thanks for checking #699. I reran the two-join regression on its head
db0257e2and also applied the two-phi loop fixture previously tested on #612. Both pass. With the loop fixture, the live timestamp is refused just like a direct read, while the dead timestamp and constant controls both lower. #612 at3dd467ccgave the same results on these inputs.I'd review #612 first for this issue. Both PRs carry the same two-join regression. #612 changes one file. The phi fix in #699 is also a one-file commit, but the full branch includes three earlier commits covering formatting, narration and WARP selection. Either fix would cover the reproduced case.
One integration detail if using #699's tip alone: on
main@db89843, keep both the new regression andscalar_bit_tests_lowerfrom #117. The latter still callslowers(&words); passing the previous default aslowers(&words, 0)resolved E0061. With those tests preserved,cargo test --frozen -p victory-shader --libreported 79 passed and 1 ignored on Windows. AI-assisted.