startup: lower constant-lane SGPR spills on wave64 lanes and in vertex stages in gfx2hlsl (Part of #1723) #2704
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2712"
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 tedin7 on 2026-11-26T03:08:05Z.
Part of #1723
What this unblocks: constant-lane SGPR spills (
v_writelane_b32 vN, sM, k/v_readlane_b32 sD, vN, k) in wave64 programs (lanes 32..63) and in vertex stages now translate instead of being refused ("lane 40 outside 0..31", "lowered in pixel stages only").Extends #2637, #2524 and #2127: they cover pixel lanes 0..31 (with branches) and the slot 57 mesh stage; the lane range and the vertex stage were still refused.
What changed
The slot model (one scalar per (VGPR, lane)) only needs the two instructions to touch lane k and to ignore EXEC, which holds in every stage. So:
SPILL_LANES = 64) and the vertex stage joins pixel and mesh (SPILL_STAGES);v_readlane/v_writelane). So k and k+32 name one slot in wave32 and two in wave64: a spill VGPR whose lanes include such a pair stays refused by name (require_spill_lanes_apart, new in this PR; it applies to pixel and vertex stages only, because slot 57 mesh is always wave64 and keeps lanes k and k+32 as two slots).What stays refused
Lane 64 and up, register-chosen lanes, compute stages, a VGPR with any non-spill use, and any branches outside the pixel proof of #2524 (vertex stages with branches stay refused).
Tests
New
tests/startup_gfx2hlsl_spill_wave64_check.py(registered inCMakeLists.txt, noted indocs/experiments.md): wave64 pixel slots, the vertex stage, two VGPRs holding lanes 8 and 40, the k/k+32 pair refusal, and adrawmode with a CPU reference and wrong-lane / ignored-overwrite mutations.startup_gfx2hlsl_sgpr_spill_check.pynow expects lane 64 and the k/k+32 pair refused and the vertex stage accepted. Onorigin/mainthe new check fails (wave64 pixel slots translate,vertex stage slots translate,lanes 8 and 40 of two different VGPRs are accepted); with the change it passes.Verification
python3 -B tests/startup_gfx2hlsl_spill_wave64_check.py: PASS (fails onorigin/main);... binary llvm-mc-19: PASSpython3 -Bofstartup_gfx2hlsl_sgpr_spill_check.py,startup_gfx2hlsl_spill_branches_check.py,startup_mesh57_lane_spill_check.pyand the otherstartup_mesh57_*_check.py: PASStests/startup_gfx2hlsl_*_check.pyrun with no arguments on this branch and onorigin/main: same result per script (export_null_drawandmul24_align_drawneed a compiler and renderer and exit 1 on both); the only new script isspill_wave64_check.6c16fcd62): dev 28/28 and release 28/28 passed (spill_wave64 controls, warp and hardware, sgpr_spill, mesh57). The review found one regression, fixed inbcb42f915(the pair rule no longer runs for the mesh stage;startup_mesh57_lane_spill_check.pynow keeps lanes 3 and 35 of one VGPR translating, and fails without the fix). Win2025 (Windows Server 2025) on the fixed headbcb42f9150: dev 28/28 and release 28/28 passed (startup_gfx2hlsl_spill_wave64_controls/_warp/_hardware, startup_mesh57_lane_spill (controls), _warp, hardware, startup_gfx2hlsl_sgpr_spill*; one mesh57 hardware test skipped by design).Copy-paste (build and run the spill tests):
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:35:38Z.
Independent Stage-2 review of head
bcb42f9150: PASS.startup_mesh57_lane_spill_check.py:got 'unsupported: ... one slot in wave32 and two in wave64', want 'ok').s_mov_b32 exec_lo, 0before the lane ops still translates (both instructions ignore EXEC).vsdropped from SPILL_STAGES,lane + 32->lane + 33.--no-skip-build,--targets offscreen_check --regex '^startup_gfx2hlsl_(sgpr_spill|spill_wave64|spill_branches)|^startup_mesh57': dev 28/28 and release 28/28 passed on this head, includingstartup_gfx2hlsl_spill_wave64_warp/_hardwareandstartup_mesh57_lane_spill_warp/_hardware.Marked Ready. @MasterDomino
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T03:35:42Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
bcb42f9ℹ️ About Codex in GitHub
Your 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.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T05:39:57Z.
Review: APPROVED
Reviewed the constant-lane spill proof and ran the host spill, branch, wave64 and mesh57 controls with main
651577a0combined. The synthetic pixel, vertex and mesh draw checks passed on WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, both on Windows 11 build 26200. The lane and overwrite mutants were caught. An unknown-size VS/PS still refuses lane pairs that could alias, and slot 57 retains its two distinct wave64 lanes.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T05:12:15Z.
Checked the automated review comment from 03:35Z on head
bcb42f915. It is only a status summary: code review "Completed",has_any_findings: false,has_unresolved_findings: false. There is no finding to fix and no review thread to resolve, so no code change.Commands run:
gh pr view 2712 --json comments,reviewsand a GraphQLreviewThreadsquery (0 threads).AI-assisted; commands listed were executed locally.