startup: accept forward branches outside the slot 57 group-memory exchanges (Part of #2413) #2540
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2548"
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 Leyukaka on 2026-11-25T20:29:03Z.
Part of #2413 (claim). #2447 refused any branch outside the two group-memory exchanges of a slot 57 mesh program. This accepts forward branches in the code before the first exchange and after the second.
Accepted:
s_branch;s_cbranch_scc0/scc1on SCC proven wave-uniform;s_cbranch_execz.They are emitted through
Stage's existing block dispatch. The group barrier and allocation block stays outside the pc dispatch, so every path runs it.mesh_skeletonkeeps its straight-line proofs, made path-aware:s_cbranch_execz: the skipped range may hold only predicated lane writes, because the model skips per lane where the guest skips per wave. Ans_branchin it may land at or past the execz target, overs_nop/s_waitcnt/s_clauseonly. This is thes_branch .elseover.empty: s_nopof a compiled if/else.s_and_saveexec_b64of a fresh VCC and itss_andn2_b64complement.Still refused: loops, a branch entering or crossing an exchange,
s_cbranch_vccz/vccnz,s_setpc/s_call/s_swappc, a branch bypassing an export, an earlys_endpgm, other uses of a saved EXEC mask, unreachable code after a branch, and an SCC branch on a value not proven wave-uniform. Each has a control except the non-uniform SCC refusal (inStage), which has none yet.Tests (Windows 11, Python 3.14, DXC from the Windows SDK 10.0.26100), on main
780f3c0plus this commit:python -B tests/startup_mesh57_skeleton_check.py: ok. New controls:s_setpc_b64;s_cbranch_execz, inside the range and past the target;s_cbranch_vcczands_cbranch_vccnz, an earlys_endpgm, a read of the saved EXEC pair, and unreachable code after an unconditional branch.... draw <dxc> offscreen_check warpandhardware: ok. 5 draws each, including both SCC branches and the if/else, match the CPU model (1024 pixels, 0 mismatches). WARP: Microsoft Basic Render Driver. Hardware: NVIDIA GeForce RTX 5080.startup_gfx2hlsl_watch_check,startup_translator_check,startup_gfx2hlsl_join_symbols_check,startup_gfx2hlsl_loop_constants_check,startup_gfx2hlsl_refusals_check,startup_compute_translate_check,startup_gfx2hlsl_waitcnt_depctr_checkandstartup_gfx2hlsl_capture_check.Mutation checks, run by hand. The controls fail on each:
s_branchlanding past the target over a scalar write.Measured on a local capture (counts only, inputs private): at main
396e7e2, 279 slot 57 requests stopped ata branch outside the group-memory exchanges. On this branch (main780f3c0plus this commit) none of them translates yet. Their next first refusals:a branch enters or crosses a group-memory exchange: 162. In each, ans_cbranch_execzbetween the two exchanges targets the first instruction of the count exchange, and the range it skips holdsds_write/ds_read: a third group-memory exchange that the accepted shape does not model. Accepting a branch that lands on an exchange start would also need a proof of the EXEC mask the exchange is entered with, so it is left out here.s_cbranch_vccz(76) ands_cbranch_vccnz(1) on a wave-wide condition.ce530846(v_cmp_class_f32_e64,v_fma_f32with NEG on an integer or literal source): 34.So this removes the branch refusal itself. The third exchange and VCC branches are the next steps for these programs.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:31:42Z.
Review: COMMENTED
Review of head
a7fe4e4f(comment only, no approval).Verdict: code and fixture tests look sound. I found no bug. No other open or merged PR covers this slice (#2447 is the base it extends).
Checked
python3 -B tests/startup_mesh57_skeleton_check.py: ok.python3 tests/docs_links_check.py: ok.python3 tests/bidi_controls_check.py: ok.git diff --check origin/main...HEAD: clean.tools/startup/gfx2hlsl.py, each makes the new test fail (then reverted):s_cbranch_execzskipped-range refusal removed: fails.Notes
vccz/vccnz, earlys_endpgm, saved-mask, unreachable-code and non-uniform SCC refusals have no control yet. A small follow-up would close that.AI-assisted; commands listed were executed locally.