shader: lower pixel EXEC masks and scalar lane spills (Part of #3814) #3834
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3834"
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:09:58Z.
Lowers wave64 pixel entry/post-branch
EXECmask combines (undefined graphics register 126, ~212 stages), G4 (s_and_b64 vcc, exec, vccin both operand orders, 16 stages), and G3 (v_writelane_b32/v_readlane_b32dedicated VGPR scalar spills at constant lanes 0–31, 21 stages) in the direct C++ pixel frontend.Part of #3814. Refs #3640, #3641, #3703.
(Opened as Draft per #3514 until an active review slot frees.)
Summary
src/gfx1013_direct_graphics.inl:undefined graphics register 126): Acceptss_mov_b64 s[dst:dst+1], execin uniform-EXEC CFGs, exposes per-invocation EXEC/saved-EXEC lane bits (exec_bit_available,exec_bit,saved_exec_bit) tov_cndmask_b32,s_mov_b64, ands_and/or/xor/andn2_b64mask logic, while nulling numeric SGPR pairs and SCC so numeric reads stay fail-closed.s_and_b64 vcc, exec, vcc/vcc, vcc, exec): Lowers both operand orders under entry, WQM, and exact predicates while marking SCC undefined (compare_scc_unknown = true) and keeping varying VCC branches refused.v_writelane_b32/v_readlane_b32scalar lane spills): Tracks(vgpr, lane) -> scalar SSAwithin a single unpartitioned block for constant lanes0..31on dedicated non-entry VGPRs never touched as ordinary vectors, requiring wave-uniform numeric scalar sources. Refuses lane ≥ 32, non-constant lanes, vector aliasing, unwritten slots, and partitioned/looping regions.tests/native_pixel_exec_writelane_vcc_check.py+tests/cmake/native_pixel_exec_writelane_vcc.cmake+docs/experiments/native-pixel-exec-writelane-vcc.md:native_pixel_exec_writelane_vcc_controls(runs inprCTest preset) +_warp+_hardware(11 draws matching all 16 pixels on WARP and RTX 5080, plus wrong-EXEC-mask and swapped-spill-slot mismatch controls and thorough fail-closed refusals).Verification
Host: Windows 11 (
10.0.26200.9974), MSVC C++20/W4(zero warnings in edited lines), inbox WARP (10.0.26100.9818), NVIDIA GeForce RTX 5080 (32.0.16.2140; D3D12 debug layer unavailable). Baseorigin/mainf365f125.ctest --preset pr --no-tests=error -R "^native_pixel_exec_writelane_vcc_controls$": 1/1 passed.dev) & Release (release): 15/15 passed in both configs with zero skips.tests/bidi_controls_check.py,tests/docs_links_check.py,git diff --check origin/main..HEAD: all clean.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T08:12:00Z.
Review: APPROVED
Reviewed
afc80395(draft) by reading the diff; not built or run.Verdict: approve. The EXEC bit, mask combines and lane spills are exact for each invocation, and the numeric pairs stay unavailable. No MUST.
ps86census onf365f125. Besides the 249 targeted stages, this widens shared paths for every wave64 pixel stage, not only the compare tail: compare bits are now recorded,v_cndmask/s_mov_b64/s_mov_b32track masks, and the unclaimed-mask release runs.s_and_b64 vcc, exec, xis now taken by the new block (gfx1013_direct_graphics.inl:2942) ahead of the existing WQM reduction. The census would show that no stage that translates today changes its refusal.exec_bit(:2165): the predicate when one is set;1under whole-quad EXEC, where helpers are in the guest EXEC too; otherwise!IsHelperLane. Per-lane AND, OR, XOR and ANDN2 against it give each lane its own guest bit, active or not. It is disabled with kills, discards, packed WQM and loops.compare_scc_unknownalso clears 128, so the relaxeds_cselectand branch checks (:2756,:3271) accept only an SCC written later.:2682): a dedicated VGPR is refused if it is also used as a vector, in either order, because the read and write hooks cover inputs and interpolation. A constant lane, a dependency-free scalar, the same block, no predicate, no exact mode and no full-wave island makev_readlaneof the written slot equal to the scalar.check_graphics_readhas no other user in graphics, and thegraphics_inputoverride keepsgraphics.input.Tests:
_controlsis in theprfilter._warp/_hardware(11 draws, wrong-EXEC and swapped-slot controls) ran only locally.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T10:34:36Z.
Census follow-up for the SHOULD in my review:
f365f125+ this PR alone, same capture and method as #3814 (6,436 distinct pixel stages). Counts only. None lost, no validation failures.f365f125f365f125+ #383449
undefined graphics register 126stages now stop atgraphics wave or control-flow instruction. Of 37graphics wave or control-flow instructionstages, 17 move topixel lane spill requires unpartitioned executionand 12 tographics scalar condition depends on a varying input. None reaches OK yet.Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-02T23:20:55Z.
Merged
main(67862ee4) into this branch. The reviewed commit is unchanged, and no follow-up fix was needed. It keeps the EXEC-mask and spill helpers alongside main's exact-mode transition.Tests, Windows 11 26200 with RTX 5080 and WARP. The filter was
native_pixel_|native_graphics_|native_direct_containerplus this PR's own tests. There were 0 failures and 0 skips, with 15 WARP and 12 RTX 5080 tests per configuration. A full Debug build of every target, including the C++17native_compute_pack_refusal_check, succeeded.Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-03T01:37:52Z.
Merged
main(f3ab02fe, which includes #3847's live-mask lowering) into this branch. The reviewed commit is unchanged.native_pixel_|native_graphics_|native_direct_containerpassed 47/47 in Debug and 47/47 in Release, with 0 failures and 0 skips (18 WARP and 15 RTX 5080 tests per configuration). The PR preset passed 1/1. A full Debug build of every target, including the C++17native_compute_pack_refusal_check, succeeded.Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-03T04:14:07Z.
Merged
main(41a83a9a) into this branch. The conflict with main's varying-VCCZ save/restore handling keeps both sides.native_pixel_|native_graphics_|native_direct_containerpassed 53/53 in Debug and 53/53 in Release, with 0 skips (20 WARP and 17 RTX 5080 tests per configuration). The PR preset passed 1/1. A full Debug build of every target, including the C++17native_compute_pack_refusal_check, succeeded. Marked Ready for review, keeping within 5 non-draft PRs per #3514.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T04:34:03Z.
Review: APPROVED
Independently reviewed
0959ff51and checked the clean combined tree withmaind1d727f1, which includes #3840. Saved-EXEC mask values remain unavailable as numeric SGPR pairs. The scalar spill accepts only constant lanes on a dedicated VGPR in an unpartitioned block and refuses aliases, undefined slots, and nonuniform scalar sources. MSVC Debugctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^native_pixel_(exec_writelane_vcc|masked_region_alu)_(controls|warp|hardware)$'passed 6/6 with no skips. Windows build 26300, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, D3D12 debug layer enabled. Both adapters matched all 16 pixels in each of the 11 new cases and caught the two fixture controls. With the wide-execution spill read locally changed to return zero, both adapters reported 9/16 pixel mismatches on the wave64 spill, and I restored the code.