shader: thread a constant-flag mesh edge past its VCC test (Part of #3703) #3958
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3958
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3956"
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?
@mumba17 on GitHub · 2026-12-03 17:43 UTC · original
mumba17:shader/mesh-unbound-numeric-sgpr→main· +112 −0 · 2 files · 1 commits · openPart of #3705 (group 1 of
unbound numeric SGPR sN, claimed in #3705).Problem
A scalar branch skips a block of buffer reads. Both paths then join, and right after the join a VGPR flag decides a VCC branch over the code that reads what the block loaded:
v_cmp_eq_u32 vcc, K, vF, thens_andn2_b64 vcc, exec, vcc, thens_cbranch_vccnz Tover the reads.On the skip path the flag is a constant other than K, so VCC equals EXEC and the branch is always taken: the reads are reached only from the load path. The frontend merged both paths at the join, so a loaded SGPR became a phi with the skip path's unrelated value, and the first numeric read refused with
unbound numeric SGPR sN.Change
lower_mesh, forward joins: when a join with two or more incoming edges is followed directly by exactly that flag test (onlyv_mov_b32copies,s_nopands_waitcntaround it), and EXEC is full or the guard of an entered EXECZ skip, any edge whose flag VGPR holds a known constant (a literal) other than K is sent straight to T. That edge's register file gets the region's VGPR copies applied without emitting IR. VCC words are left unbound on that edge and SCC is set to 1. Every other edge keeps the existing path, and the VCC branch is lowered as before for those edges.Not threaded:
Tests (
native_direct_mesh)flag-join-threads-skip-edge:s21 == 0skipss_buffer_load_dword s20andv7 = -1, withv7 = 0set before the skip. After the join,v_cmp_eq_u32 vcc, -1, v7+s_andn2_b64+s_cbranch_vccnzjumps overs_cmp_lg_u32 s20, 0+s_cselect_b32 s22, 1, 2, and the export reads s22. The check requires that the skip edge carriesv7 = 0into the branch target and that s22 isphi [0, …], [select 1/2, …].flag-join-threads-in-lane-skip: the same join inside an enteredv_cmpx_eq_u32+ EXECZ lane skip.unbound numeric SGPR s20):flag-join-unknown-flag: the skip edge's flag isv7 = s21, uniform but not a known constant;flag-join-rewritten-flag:v7 = -1is written after the join, so the read is reachable from both paths.flag-join-threads-skip-edgefails withunbound numeric SGPR s20. With the after-join rewrite check removed,flag-join-rewritten-flagtranslates and the test fails.Census
Native Mesh86 capture, 6,685 distinct programs, one
compile_dxil … gfx1013-container-ms-texture-heaprun each, release build, main8cb022dbvs this branch:unbound numeric SGPR sNunproven packed mesh signature rows, 13 reachunsupported packed vertex export.graphics register undefined on an incoming path: 5 translate, 10 reachunsupported packed vertex export. No other program changes its first refusal.Counts only; request bytes stay local.
Checks
ctest --preset pr -j 4(Windows, RTX 3090, debug): 349/351 passed,native_direct_meshincluded. The 2 failures,native_compute_implicit_lod_controlsandnative_wave_virtual_derivative_controls, also fail on main locally (this SDK's validator is 1.7, the modules declare 1.8). They fail the same way when rerun serially.native_direct_meshagainst the release build with and without the change, as above.AI-assisted (Claude Code).
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.