shader: admit s_nop and satisfied waits in pixel_aot masked regions #1016
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1023"
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 MasterDomino on 2026-11-23T21:52:46Z.
Refs #987
Stage 1 as approved in #987:
s_nopand waits whose counters are already satisfied in the tracked state may sit inside a masked region, under either opener, with or without thes_cbranch_execzskip. Scalar ALU (stage 2) and scalar loads stay out.Change
tools/pixel_aot.py, region check only:s_nop <imm>is admitted.vmcnt:sample_destis empty (no sample, title or scratch load outstanding);lgkmcnt:pendingis empty (no scalar load outstanding);expcnt: never busy, because onlys_endpgmmay follow an export;vscnt: refused once any scratch store has been lowered, because the store counter is not tracked.sample_destandpendingonly through a wait, and overwriting an outstanding destination is already refused. So an empty set means nothing is outstanding, and the admitted wait resolves nothing whether the wave runs or skips it.Wait would resolve outstanding <counter> work in a masked region. This includes waits whose count would not block (for examplevmcnt(3)with one sample outstanding), because exact outstanding counts are not tracked.s_waitcnt_depctr, other hints and all other scalar instructions stay refused. The save pair, restore target, skip placement and EXEC rules are unchanged.Admitted forms:
s_waitcntwith any ofvmcnt,lgkmcntandexpcnt(or0), ands_waitcnt_vmcnt,_lgkmcnt,_expcntand_vscntwithnull.Tests
tests/pixel_aot_check.py:check_region_wait_controls(runs with the other controls):s_buffer_load_dwordx4(scalar load and sample outstanding) or after itslgkmcnt(0)(sample only), and each case must give the message that names the busy counter. In the second positionlgkmcntwaits are admitted whilevmcntwaits ands_waitcnt 0are refused.s_waitcnt_vscnt null, 0x0after a scratch store is refused, while the same program without the wait is accepted.s_waitcnt_depctr,s_inst_prefetchands_clausestay refused, and ans_nopbetween the opener and the skip is refused.check_region_wait_draw, new CTest entriespixel_aot_region_waits_warpand_hardware: the ramp region with every admitted form, under both openers and with and without the skip, on mixed (0.5), full (10) and empty (-1) masks. A reference with the writes applied to every lane must mismatch.binaryfixtures.check_masked_controlsandcheck_cmpx_controlsuseds_waitcnt lgkmcnt(0)in a fully drained region. Stage 1 admits that, so the entry is nows_inst_prefetch 0x3, which stays refused.check_region_wait_controlscovers which waits stay refused.s_nop 0is no longer in the region-body refusal list.docs/experiments.mddocuments the rule, the controls and the measured draws.Results
Environment:
79c0be8oncd87907(main),devpreset. The full suite rows below ran on the same change rebased on2d8a0cc; after the final rebase ontocd87907(nopixel_aotchanges upstream in between) the controls, the LLVM round trip, the coverage/docs/bidi checks and all eight region draws (exec_regions,cmpx_regions,region_body,region_waitson WARP and hardware) were rerun and pass.1002:7550), driver 32.0.31044.16, and in-box WARPpython -B tests/pixel_aot_check.py(controls)python -B tests/pixel_aot_check.py binary <llvm-mc> <llvm-objcopy> <LLVM-C.dll>with LLVM 15.0.7ctest --preset dev --no-tests=error -R '^pixel_aot_region_waits_(warp|hardware)$' -Vctest --preset dev --no-tests=error -E '_hardware$' -j 8bvh_wave64_warp,wave_shuffle_warp: WARP lane range 4..4)ctest --preset dev --no-tests=error -R '_hardware$' -j 1main: #958, #369, #1011, andpixel_aot_dpp_extra_hardware(new with #423; its subnormal case expects NaN in channel 2 and gets0x80000010; WARP passes).form_coverage_check,docs_links_check,bidi_controls_check(andrdna2_tools_check,shader_census_checkbefore the rebase)Negative controls:
tools/pixel_aot.pychange reverted, the controls fail at the first admitted form (Instruction cannot run in a masked region: s_nop 0).Wait would resolve outstanding lgkm work ... s_waitcnt lgkmcnt(0).Execution skip does not target the matching restorewhen the new fixtures' skip label is moved inside the body.Limits:
AI-assisted.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T21:58:54Z.
I reproduced
s_waitcnt_expcnt s5, 0x0being accepted under both openers at79c0be85. The existing export-wait parser also accepts an SGPR outside a masked region. I pushedfcb34088to keep that existing path and reject the SGPR operand inside either opener. The focused WARP and RTX 4060 Laptop draws, Python controls and LLVM 15 binary round trip all pass.