shader: intersect definitions at joins in the pixel input mask scan #2790
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2798"
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 R0Y00/Xbox2Windows. Originally posted by RenzoWit35 on 2026-11-26T10:11:44Z.
Follow-up to #1669, for the branch-skipped definition reported in its review. In that case a forward conditional branch skips a write to v2, and the join then reads v2. The scanner reported v2 as neither live-in nor ambiguous, so a mask without v2 could rank as consistent. #1669 was merged before this fix was pushed, so it comes as a separate PR.
Change
tools/startup/ps_input_scan.py:must_defined()computes, for each instruction, the vector registers written on every path from the entry. It is a forward fixpoint over bit sets that intersects the incoming edges at each join.s_endpgmands_branchdo not fall through. A branch with an unknown target joins every instruction. Code that no path reaches keeps the previous linear rule.branch_of()factors out the branch decoding thatcontrol_flow()already did.tests/startup_ps_input_scan_check.py:diamond_skipskips the v2 write; its live-in set is[1, 2].diamond_bothwrites v2 on both edges; its live-in set is[1].ps.header pair32@8must stay the unique full match.alias_blockhas the same shape (a forward branch skipsv_mov_b32 v4, v0), so its expected live-in set becomes[0, 1, 4]. Its pair evidence was already dropped and still is.consistent()and the cachedJudgepath.tag_values()returns for context-run, context-index, byte-address and mm tags.docs/experiments.mddescribes the join rule.Unchanged: mask agreement and packed-position agreement are reported apart, and packed agreement does not vote. Output is aggregates only. No runtime code is touched.
Verification
Environment: Windows 11, Python 3.14.5, branch cut from current
main.python -B tests/startup_ps_input_scan_check.py:ps_input_scan checks passed.mainfails withAssertionError: ('alias_block', ([0, 1], [], [])). Beforealias_blockwas updated, the standalone diamond corpus gaveverdict: unique full match ps.header pair32@16: the decoy won, with 8 tight against 7.PAIR_BITS, settingCONTEXT_INDEX['ena']to 0x1B4, and replacingmust_defined()with "everything defined".run_checks_parallel.pylist (203 checks) on this branch: everything passes excepttests/dxc_cache_check.py. That one fails in asubprocess.runof its DXC stub on this Windows machine, and this PR does not touch DXC or the stub.Not run: the Linux job. The change is pure Python with no path or platform handling.
Evidence and follow-up
Limitation: a read on a path that never runs, such as a lane-masked read of an undefined register, now counts as live-in. That can make the right location fail C1, but it cannot make a mask without that register pass.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:16:12Z.
Review: COMMENTED
Review of head
8d97c0caagainst origin/main. Verdict: sound, no blocking findings.What I checked
must_defined()is a forward must-analysis: intersect at joins, entry state empty,s_endpgm/s_branchdo not fall through, unknown-target branches join everywhere, unreachable code keeps -1 so the old linear rule stays in charge. The sets only lose bits, so the loop ends.not writtenORnot defined on every path), and the loop/ambiguous rule is unchanged. That matches the PR text.control_flow()now reusesbranch_of()and gives the same targets, spans andunknownas before.gfx2hlsl.py, the generated HLSL or the pixel inputs, so no D3D12 readback test is needed.Commands run (Linux worktree at this head)
python3 tests/startup_ps_input_scan_check.py-> passespython3 tests/docs_links_check.py-> passes;python3 tests/bidi_controls_check.py-> passesgit diff --check origin/main...HEAD-> cleannot everywhere >> register & 1clause -> check fails (AssertionError)value &= out[p]changed to|=(union instead of intersection) -> check fails (AssertionError)Not done by this review: the Windows run (pending, will be posted as a receipt) and CI on this head was still pending when I looked.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:16:41Z.
Win2025 WARP receipt for head
8d97c0ca(Python-only change: the pipeline builds nothing for these files).Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
8d97c0ca1b70886fec7917e39cc28e30c5477477:tests/startup_ps_input_scan_check.pyok (7.3s)12.5sCommand:
x2w_pipe.py win2025 2798 --wait 7200 --keep-release --py-checks tests/startup_ps_input_scan_check.py(log linePYCHECK name=tests/startup_ps_input_scan_check.py rc=0).AI-assisted; commands listed were executed locally.