shader: broadcast mesh readfirstlane at full-EXEC joins #3894
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3894"
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 lambirou on 2026-12-02T23:15:57Z.
Summary
The direct C++ mesh frontend refused
v_readfirstlane_b32of an unproven VGPR after a wave-varying SCC or VCC branch, even when both arms rejoined with full guestEXEC.group_flowstayed false from the branch condition, although lane 0 was active in every guest wave at the join.The existing lowering already knows how to make this read exact: one shared-memory word per guest wave, published by lane 0 and read after a group barrier. This change accepts that path at a converged program point under full
EXEC. It still refuses a narrowedEXEC, an open branch arm, an open lane skip, a pending branch edge or a source outside the VGPR class.For a source proven uniform, the existing direct copy is unchanged. For a non-empty narrowed
EXEC, the translator still needs a lowest-active-lane selection, which is outside this change (see #3842).Tests
tests/native_direct_mesh_check.py: the branch-join fixture with a wave-varying SCC condition now emits two shared broadcasts; the same join afterv_cmpxstill refuses withunsupported mesh instruction or EXEC state: v_readfirstlane_b32. The existing per-wave scalar case after a join now asserts its two broadcasts; the fall-through-before-join control still refuses.tests/native_mesh_readfirstlane_check.py: builds source.m57fixtures with and without the branch join, then checks wave32 and wave64 lane-0 values through the draw path. Each valid readback reportspixels=1024 mismatches=0; each swapped-wave control reportspixels=1024 mismatches=1024.docs/experiments/mesh-readfirstlane-full-exec.md.Verification
Commit
c25d81e4on Debugdevfromorigin/main517854f0.native_direct_mesh: passed,268.40 s.native_mesh_readfirstlane_warp: passed,6.84 s; WARPMicrosoft Basic Render Drivervendor0x1414, device0x008c, driver10.0.26100.10068, mesh shader tier0xA, WARP lane count 4.native_mesh_readfirstlane_hardware: passed,89.69 s; AMD Radeon RX 9060 XT vendor0x1002, device0x7590, driver32.0.32029.2010, mesh shader tier0xA, host wave widths 32 and 64. D3D12 debug layer unavailable in this run.python -B tests/docs_links_check.py: passed, 257 Markdown files and 967 links.git diff --check origin/main..HEAD: clean.Build and test on Windowspassed in7m41s,Assemble and translate gfx1013 fixturesin3m56s, andRun platform-independent Python checks on Linuxin6m20s.No skip was observed. The call-weighted census in #3416 has not been rerun here, so this PR does not claim a new translated-request count; it removes the reported refusal at converged full-
EXECjoins.Part of #3703. Refs #3416.
Overlaps the same lowering block as #3842. This PR only removes the
group_flowgate for converged full-EXECjoins; it does not add lowest-active-lane selection under narrowedEXEC.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T23:29:34Z.
Review: APPROVED
Reviewed
c25d81e4. The pending-edge, active-arm and EXEC checks still prevent the broadcast inside divergent regions. The existing scalar loop body pre-scan does not admit a vector lane read, and the end-of-program path refuses while a forward edge is pending. On Windows 11 build 26300 / MSVC Debug,ctest --preset dev --no-tests=error -j 1 -V -R '^(native_direct_mesh|native_mesh_readfirstlane_(warp|hardware))$'passed 3/3, with no skips. WARP10.0.26100.9818and RTX 4060 Laptop32.0.16.1656ran with the debug layer enabled. The wave32 and wave64 branch joins each matched all 1,024 pixels, and the swapped-lane controls mismatched all 1,024 under the original reference. Restoring just the old!group_flowcheck made the new branch-join compile fixture refusev_readfirstlane_b32at+0x20. Removing the mutation restored all three passes. Required CI passed, and the trial merge withmainc42b7ce3is clean. #3842 remains the separate narrowed-EXEC implementation and will need to preserve these full-EXEC cases when rebasing its overlapping block.