shader: lower one-armed pixel CMPX skips with scalar loads and SALU #3828
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3828"
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-02T07:15:49Z.
Lowers wave64 pixel one-armed
v_cmpx_*skips with scalar loads and SALU inside the arm, in the scalar tail between the skip target and EXEC restore, and after the restore (item W2 of #3814).Part of #3814. Refs #3640, #3641, #3703.
Summary
src/gfx1013_direct_graphics.inl(pixel_readonly_arms):wave_scalar(const Inst&)accepting scalar loads (Encoding::Smemwithdst + memory_count <= 106; decoder only admits loads) and ordinarySop1/Sop2/Sopk/SopcSALU on SGPRs/constants while rejectingexec,movrel,pc,reg,wqm,rfe,loop,vskip,waitcnt,call,branch,fork,join, and special-register operands (VCC,EXEC,M0,VCCZ,EXECZ,SCC).Smem (op >= 8)/s_mov_b32towave_scalar; all arm-written scalars and SCC remain expired at the join so arm-conditional scalar writes cannot leak into the tail or post-restore code.v_cmpx_*scalar-tail recognition between thes_cbranch_execzjoin and restore (wave_scalar,s_waitcnt,s_nop,s_clause), emittingscalar_tail_mergesat the join so tail results stay live past the restore while the restore itself is a no-op.s_or_b64 exec, exec, parent(either operand order) as a one-armed CMPX restore, expiring SCC at the restore.s_and_saveexec, ors_and_saveexecmasks.tests/offscreen_check.cpp,tests/startup_flat_param.cpp,tests/desktop_gpu.h:--startup-pixel-wordswith an optional 6th argument (1..64comma-separated hex words) bound as a root SRV att0so pixel stages loading from a root address can be read back on WARP and hardware GPUs; added CLI self-test cases.tests/native_pixel_cmpx_scalar_tail_check.py+tests/cmake/native_pixel_cmpx_scalar_tail.cmake:salu-tail,arm-loads,tail-loads,after-restore-loads,or-restore-tail) verified for DXIL structure (br i1,phi, no wave ops,rawBufferLoadplacement in arm vs post-join) and GPU readback (including swapped/all-arm/none-arm mismatch controls and whole-wave all-arm/none-arm tail runs).Verification
Host: Windows 11 (
10.0.26200.9974), MSVC C++20/W4(zero warnings on edited targets), inbox WARP (10.0.26100.9818), NVIDIA GeForce RTX 5080 (32.0.16.2140).dev) & Release (release):native_pixel_cmpx_scalar_tail_controls: passed in both configs (5 positive + 26 refusals).native_pixel_cmpx_scalar_tail_warp: passed in both configs (WARP readback + negative mismatch controls + whole-wave runs).native_pixel_cmpx_scalar_tail_hardware: passed in both configs (RTX 5080 readback + negative mismatch controls + whole-wave runs).offscreen_check --self-test: passed in both configs.native_direct_container,native_pixel_dxil,native_pixel_cmpx_discard_warp,native_pixel_cmpx_if_else_{controls,warp},native_pixel_compare_mask_{warp,hardware,container,ir},native_graphics_wqm_{hardware,warp,ir},native_graphics_sampler_heap_{warp,hardware},native_graphics_interface_library,native_graphics_vertex_vcc_join_{warp,hardware},startup_flat_param_{controls,warp,hardware}(23/23 built pixel/graphics tests passed in both Debug and Release).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-02T07:31:45Z.
Review: APPROVED
Reviewed
733f6b27by reading the diff; not built or run.Verdict: approve. The tail is wave-level scalar work that the guest runs on both paths of the skip. Arm results expire at the join, and the OR restore equals the parent. Each guard fails closed. No MUST.
docs/experiments/mesh86-pixel-execz.mddescribes these read-only arms. The new forms are not mentioned there: scalar loads and SALU in the arm, a scalar tail before the restore, and thes_or_b64 exec, exec, sNrestore.ps86census onf365f125before and after would show the real gain. This can come in a follow-up._controls:native_pixel_cmpx_scalar_tail_warpis not in theprpreset filter.pixel_readonly_arms, around the saved-compare block and theif (!closed || inner…)line (gfx1013_direct_graphics.inl:927). Whichever merges second needs a rebase.scalar_widthcounts SOPKs_cmpk_*(whosedstis a source) as a write. This refuses more than needed, but nothing is wrong.:878, throughrestore.pc).wave_scalarexcludes SOPP, so no branch fits in the tail.expiredis applied at:2412, before the no-op return at:2470. So SCC really expires at the skipped OR restore, and the tail's first instruction is not expired.:892). The tail gets its own clobber check (:925).Tests:
_controlsreaches the tail scan, the OR restore and 26 refusals, including tail reads of arm scalars, SCC across the OR restore and branches into the tail._warp/_hardwareread back arm and tail values with swapped, all-arm and none-arm controls. CI ran_controlsonly.Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-02T08:33:17Z.
@lukaslw-lab Thanks for the review and approval! Understood on updating
docs/experiments/mesh86-pixel-execz.mdand theps86census follow-up.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T10:07:19Z.
Review: APPROVED
Independent Windows Debug result at
733f6b27:ctest --preset dev --no-tests=error -j 1 -R '^native_pixel_cmpx_scalar_tail_(controls|warp|hardware)$' --output-on-failurepassed 3/3. The positive scalar tails, refusal controls and both pixel readbacks passed. Windows 11 26300.9974, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, with the offscreen fixture's D3D12 debug layer enabled.