Repository navigation
shader: extend v_readfirstlane_b32 lowering to branched control flow in gfx2hlsl (Part of #1723) - #2060
shader: extend v_readfirstlane_b32 lowering to branched control flow in gfx2hlsl (Part of #1723)#2060tedin7 wants to merge 4 commits into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0cf21551f9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
0cf2155 to
454fd64
Compare
454fd64 to
f9865ac
Compare
…e shader has branches Part of R0Y00#1723. VGPR uniformity is proven per basic block and cleared at every join; refused when any instruction writes exec; scalar sources that can carry a lane mask are excluded program-wide.
…an; document the branch case
f9865ac to
c346072
Compare
|
Thanks @R0Y00. The branch is rebased and pushed as Covered in this head:
Verification (Windows Server 2025, MSVC 14.44, D3D12 WARP, default 3-slot pool):
Note: the unfocused run failed because the generated command was too long for the Windows shell, so I ran the focused targets above. AI-assisted; commands listed were executed locally. |
R0Y00
left a comment
There was a problem hiding this comment.
At c346072c, the branch proof misses values that vary through control flow. I ran a synthetic Stage input that compares varying v0 into VCC, branches on vccz, sets s7 to 1 on the fallthrough arm and 2 on the target arm, then joins for v_mov_b32 v4, s7; v_readfirstlane_b32 s6, v4. The proof accepts it with no refusals, and the common block actually emits v4 = 0x00000002u; s6 = v4; even on the path that assigned 1. The scan tracks scalar dataflow, but the branch condition never taints the two constant writes, and the scalar constant recorded from the last visited block leaks into the join.
Please retain the entry proof from #2183 and refuse this later-block case until the scalar inputs are proven on all incoming paths or redefined in the block itself. Add the two distinct-arm constants as a negative control, alongside a same-block redefinition positive. #2203 changes the same proof area, so please coordinate the shared controls there before updating both branches.
A scalar register written in a later block is only a proven source in a block that redefines it; the value recorded from the last visited arm no longer leaks into the join. Adds the two-arm negative control and a same-block redefinition positive.
b3ad651 to
fc30b13
Compare
Part of #1723
What this unblocks: 719 draw refusals (v_readfirstlane_b32 with branches).
v_readfirstlane_b32was refused in any shader that has a branch. Now a source is proven uniform inside one basic block, even when the shader has branches elsewhere.exec/exec_lo/exec_hi,*saveexec*,v_cmpx*), soexec_knownholds on every path.Tests:
tests/startup_readfirstlane_branch_check.py, registered asstartup_readfirstlane_branchinCMakeLists.txt. It fails onorigin/mainand passes here. It also checks that a join between the proof and the read, and an exec write, are still refused.tests/startup_gfx2hlsl_readfirstlane_uniform_check.py: the "branch after read" case moved from refused to accepted, which is the intended change.Verification: (local Linux run; Win2025 not run, this is a Python-only change)
python3 -B tests/startup_readfirstlane_branch_check.py: passes; the same file against the previousgfx2hlsl.pyraisesv_readfirstlane_b32 requires a proven uniform source.python3 -B tests/startup_gfx2hlsl_*_check.py,tests/startup_uniform_lane_check.py,tests/startup_ngg_slice_check.py: all pass.tests/startup_*_check.pyneed Windows probe binaries or arguments and were not run.AI-assisted; commands listed were executed locally.