shader: lower additional mesh SAVEEXEC patterns (Part of #3703) #3843
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3843"
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 timbot103 on 2026-12-02T08:42:21Z.
Part of #3703.
Summary
Targets the two #3703 mesh
SAVEEXECrefusal buckets (mesh SAVEEXEC then arm depends on EXEC, 84 programs, andmesh SAVEEXEC VCC test requires an immediate VCC branch, 77 programs):s_and_b64/s_and_b32mask tests at their original PC (setting SCC immediately and capturing the wave-uniform nonempty predicate for scheduled VCC/SCC branches across independent vector/32-bit scalar work, including dead SGPR-pair destinations), plus wave-uniform 32-bitSopcforward SCC branches insideSAVEEXECTHEN arms.find_restore), tracked EXEC mask copies (s_and_b64) and selects (s_cselect_b64 ... exec, 0) vianeeds_exact_exec, andEncoding::Mixops in the vector-only inverse arm. Clobbers, escaping branches, backward loops, and leaked scalar values remain refused.Verification
ctest --preset pr --no-tests=error --output-on-failure -R '^native_mesh_saveexec_exec_vcc_ir$': passed (16 positive DXIL cases + 22 refusal controls).dev) and Release (release): 3/3 passed (native_mesh_saveexec_exec_vcc_ir|native_direct_mesh|native_direct_container), zero skips, zero new C++20/W4warnings on edited lines.tests/bidi_controls_check.py,tests/docs_links_check.py, andgit diff --check origin/main..HEADpassed.#3514's 5-PR ready cap.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T08:48:43Z.
Review: APPROVED
Reviewed
fa774fcb(draft) by reading the diff; not built or run.Verdict: approve. The scheduled VCC and SCC tests are matched only when nothing in between can change what the branch reads, and the new then-arm forms take the exact-EXEC path. No MUST.
m86census onf365f125for the real gain on the 84 + 77. The tests now match across independent work, and a mask copy no longer needs a nested child. Both widen accepted shapes, so the census would also show that no program changes to a different refusal.lower_mesh. #3707 adds the same 32-bit SALU list andlane_freefor loops thatsaveexec_scalar_tail(gfx1013_direct_mesh.inl:610) now holds. Whichever merges second can reuse the other's list. I will do that on #3707 if this lands first.:812): an instruction in between may not read the AND's destination, EXEC, VCCZ or EXECZ, nor write the destination or the mask pair. A VOPC writing VCC, SMEM, or a compare ends the scan, andvcc_testthen refuses. Scalar ALU in between disables only the SCC form. At the AND (:1674), SCC is the proven uniform bit, which equals "AND nonempty" inside a nonempty arm, and the AND's destination is cleared.:803): forward within the arm. Where a proof is needed (after allocation or before an else arm), both inputs must be wave-uniform, and a forward edge into the span is refused.group_flowis cleared for every matched test.s_and_b64 sN, exec, xands_cselect_b64 sN, exec, 0setneeds_exact_exec(:866), so the diamond computes exact masks instead of refusing. Thes_cselect_b64fix keeps an unknown EXEC word empty instead of selecting it.find_restore(:660) accepts onlysaveexec_scalar_tailops before the restore, and records their writes ingap_writes.diamond_joineduses the same list as before.Tests:
native_mesh_saveexec_exec_vcc_ir(16 cases, 22 refusals) is in theprfilter.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T09:23:07Z.
Census follow-up for the SHOULD in my review:
f365f125+ this PR alone, same capture and method as #3703 / #3814 (6,685 distinct mesh programs, 6,436 pixel stages). Counts only.f365f125f365f125+ #384381 programs move off their first refusal:
mesh SAVEEXEC VCC test requires an immediate VCC branch77,unbound numeric SGPR s44. None of them reaches OK yet: each stops at a later wall. The 84mesh SAVEEXEC then arm depends on EXECprograms do not move on this capture. No validation failures.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T20:27:33Z.
Review: APPROVED
Re-review on
b6c4f79b(rebased on5770f14e: the 32-bit SALU list andlane_freehoisted for the two users,full_execadded to the exact-EXEC condition from main).Verdict: approve.
Census, same capture and method as before (6,685 distinct mesh programs), main
5770f14evs this head:SAVEEXEC VCC test requires an immediate VCC branch→SAVEEXEC then arm depends on EXEC77;unbound numeric SGPR s4→s24Same 81 as the earlier head. The hoisted
scalar_alu32set is unchanged in content, and both users now share it.Update: the first run was on a main that refused 257 programs early (my #3707, #3892; fixed by #3893). I reran main
5770f14eand this head, both with that fix: 81 moved, 0 lost, 0 gained. The numbers above are unchanged.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-02T23:05:00Z.
Stacked on #3842, and through it on #3835. This branch includes their commits; please land them first.
845d46f8replaces the C++20starts_withcalls.native_compute_pack_refusal_checkbuilds the frontend as C++17, which main CI compiles but PR CI does not, so this PR would otherwise have broken main's full build after merging.b350ac6dfixes an interaction with #3842. An arm that both copies an EXEC mask and contains a broadcast could drop the exact SAVEEXEC region. The region is now kept, and a varying broadcast that would need a group barrier is refused. The mask-copy and mask-select controls pass in both configurations. Straight SAVEEXEC broadcasts still pass the WARP and RTX 5080 readbacks.Tests, Windows 11 26200 with RTX 5080 and WARP. The mesh filter was
native_direct_mesh|native_direct_container|native_mesh_plus this PR's own tests. Every branch passed a full Debug build of every target, including the C++17native_compute_pack_refusal_check.accepted=1 refused=0). They also fail on a clean67862ee4, and every one of them passed withX2W_SYNC_MESH_REQUESTS=1.All six mesh PRs (#3832, #3835, #3838, #3842, #3843 and #3846) were also merged together onto
67862ee4. That combined tree passed 47/47 in Debug and 47/47 in Release, plus 8/8 under the PR preset. All 15 pairs merge cleanly.Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-02T23:59:45Z.
Merged the updated #3835 (
705d91ab, its fixture now uses a reserved-bit control that does not depend on #3833) into this stacked branch. The merge was clean. On mainc42b7ce3the mesh filter passes in Debug, and in Release apart from the existing asynchronous WARP allocation fixtures, which also fail on clean main and pass withX2W_SYNC_MESH_REQUESTS=1.Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-03T01:30:59Z.
Merged the updated #3842 (main
f3ab02fe). The merge was clean, and the SAVEEXEC controls and inherited active-lane readbacks pass. This PR is still stacked on #3842 and #3835. The remaining failures also fail on clean main:native_mesh_entry_registers_ir(fix PR coming) and the asynchronous WARP allocation fixtures.Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-03T04:01:12Z.
Merged the updated #3842 (main
41a83a9a); the merge was clean. This PR is still stacked on #3842 only, since #3835 has merged. The mesh filter passed 22/22 in Debug. Release passed 19/22; the 3 failures are the existing asynchronous WARP fixtures. The PR preset passed 1/1.Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-03T04:17:23Z.
No longer stacked: #3842 has merged. Merged
main(43055293) into this branch. The two conflicts keep this PR's exact-EXEC guard and its mask-copy and mask-select refusal controls. The diff againstmainnow contains only this PR's SAVEEXEC changes, the C++17-compatible prefix check, and their fixtures. The mesh filter passed 22/22 in Debug. Release passed 19/22; the 3 failures are the existing asynchronous WARP allocation fixtures, which pass withX2W_SYNC_MESH_REQUESTS=1. The PR preset passed 1/1, and the RTX 5080 checks passed 5/5 in each configuration. Marked Ready for review, keeping within 5 non-draft PRs per #3514.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T04:21:32Z.
Review: APPROVED
Independently reviewed
8974c077after the #3842 merge. The clean trial merge onto main0bb85d8fgives tree098ff4149a5bb6e5d62526468728220c06a8b791, byte-for-byte the tree tested from this PR's three changes replayed onto that main. MSVC Debugctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^(native_mesh_saveexec_exec_vcc_ir|native_mesh_buffer_load_format_ir|native_mesh_readfirstlane_active_(controls|warp|hardware))$'passed 5/5. The inherited readbacks passed on WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, Windows build 26300, debug layer enabled, no skips. The new SAVEEXEC cases validate DXIL and the expected refusals. On the preceding source-equivalent SAVEEXEC revisionc1076cc7, forcing the captured branch predicate to zero failed the scheduled-VCC DXIL assertion. The edit was local and restored.