Repository navigation
shader: lower pixel live-mask alpha kills (Part of #3814) - #3847
Conversation
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed 9074d442 (draft) by reading the diff and running an offline pixel census of this PR alone; not otherwise built or run.
Verdict: approve. The kill polarity is right (the v_cmpx selects lanes to kill), the live mask stays one lane bit, and everything after the kill is lane-local. No MUST.
Census, f365f125 + this PR alone, same capture as #3814 (6,436 pixel stages): 272 → 546 translate (+274), none lost, no validation failures. 274 stages leave graphics wave or control-flow instruction, and 2 move to unsupported live-mask kill suffix.
- NIT This conflicts with #3829 and #3834 (
gfx1013_direct_graphics.inl), with #3828 and #3833 (the same three harness files, a third extension ofstartup_flat_param), and with #3826 (mesh86-pixel-execz.md). #3829 also adds its ownlane_aliveandcovered_lane()change, so the two PRs need one shared notion of "alive" when they meet. - Checked, no finding:
- Polarity (
gfx1013_direct_graphics.inl:2148):killed = cmp,discard(killed),lane_alive &= !killed. Heres_andn2_b64 sK, sK, execis only a filter (its pair and SCC are cleared), and inverted operand orders are rejected infind. - Coverage:
lane_alivestarts as!IsHelperLaneat the save (:2138).covered_lane()returns it afterwards (:2112), so the exact predicate and the post-killbuffer_atomic_addboth drop killed lanes.s_and_b64 exec, sC, sKneedssCtagged as entry coverage.s_mov_b64 exec, sKafter a WQM save keeps whole-quad mode, and the suffix must then be lane-local (:2177). - Shape (
gfx1013_graphics_wqm.inl:41): the first branch is thescc0guard to the EXP_NULL tail, there is no export ors_endpgmbefore the kill, the live pair is not clobbered, and the final group is exports with DONE only on the last. The skips and the null tail are removed only when the whole shape matches. The suffix (local_tail) allows only loads, explicit-LOD images and lane-local ALU, so nothing reads a discarded lane.
- Polarity (
Tests: _controls (11 cases, 27 refusals) is in the pr filter. The color and atomic-after-kill draws ran only locally.
9519b14 to
7947b4e
Compare
lukaslw-lab
left a comment
There was a problem hiding this comment.
Re-review on 7947b4e9 (rebased on 5770f14e, filters now clear compare masks and SCC, stale-compare-mask control).
Verdict: approve. It now conflicts with main and needs a rebase.
Census, same capture and method as before (6,436 distinct pixel stages), main 5770f14e vs this head:
| Stages | |
|---|---|
| Translate, main / with this PR | 272 / 546 |
Gained (all from graphics wave or control-flow instruction) |
274 |
| Lost / first refusal moved | 0 / 2 (graphics branch on a wave mask → unsupported live-mask kill suffix) |
Same result as the earlier head: this doubles the translating pixel stages on this capture.
Checked:
findaccepts only the documented shape: the reachings_mov_b64 sK, execsave, then per guardv_cmpx_*_f32→s_andn2_b64 sK, sK, exec→s_cbranch_scc0to the shared dead tail → an AND/MOV restore. Any other branch, export or clobber ofsK/EXEC returns without a match.- A filter now drops both halves of
sK, its compare-mask entries and SCC, so a laterv_cndmaskon that pair refuses (unproven graphics CNDMASK source). - A restore from a pair other than
sKneeds the saved exact entry coverage, both infind(reachings_mov_b64 sC, exec) and at emission (tag0). - With WQM helper lanes still live, the suffix allows only local ALU and the final exports. Loads and the raw atomic add need exact coverage, and the atomic is predicated on the surviving coverage bit.
AI-assisted.
A live-mask save already snapshots raster coverage. Reuse that SSA value as each kill narrows it, so atomic guards use the surviving coverage directly. Keep the helper check for unsaved alpha-test kills, whose keep bits do not include raster coverage. Exercise chained kills with atomic and depth readbacks, including a zero-survivor counter.
The native compute pack refusal fixture compiles a C++17 copy of the shared frontend. The preceding v_cmpx_ prefix match guarantees enough characters for the suffix check.
|
Merged
GPU results:
Tests, Windows 11 26200 with RTX 5080 and WARP. The filter was
|
|
Marked Ready for review now that #3827 and #3829 have merged, keeping to 5 non-draft PRs per #3514. CI is green at this head. All 17 open PRs from this batch were also merged together onto main |
R0Y00
left a comment
There was a problem hiding this comment.
Independently reviewed fec8b3a. The live-mask proof checks reaching coverage saves, CMPX/filter polarity and exact coverage for atomic side effects. MSVC Debug, Windows build 26300: ctest --preset dev --no-tests=error -j 1 -R "^(native_pixel_live_mask_kill_(controls|warp|hardware)|native_graphics_wqm_(ir|warp|hardware))$" passed 6/6. WARP and RTX 4060 Laptop (616.56), debug layer enabled, each matched 126 color pixels, 1,024 depth pixels and four atomic counts, with three wrong-reference controls caught. Permitting the reversed filter negated the reversed control. The restored head passed.
Part of #3814 (follow-up to #3829's 2 Dec census breakdown).
Summary
Lowers the dominant wave64 live-mask alpha-kill triple identified in #3829's census follow-up (105 of 106 remaining G1 stages, ~566 real pixel stages):
killed = cmp_result,dx.op.discard(killed),lane_alive = lane_alive & ~killed) and strictly rejects inverteds_andn2_b64operand orders, overwritten/escaped live masks, and revived pre-kill masks.mrt0..7) and depth (mrtz) exports, WQM exact-coverage restoration (s_and_b64 exec, sC, sKwith proven entry-coverage tag"0"), resetsexact_after_wqmif a later chained kill restores a WQM live mask vias_mov_b64 exec, sK, and gates post-killbuffer_atomic_addthrough survivinglane_alivecoverage.--startup-pixel-atomictooffscreen_check(without altering--startup-pixel-words) to verify real GPU atomic counters after kill, and updatesdocs/experiments/mesh86-pixel-execz.md+docs/experiments/native-pixel-live-mask-kill.md.Verification
compile_dxil,offscreen_check, andnative_pixel_ir_dumpin Debug (dev) and Release (release) with zero new C++20/W4warnings on edited lines.ctest --preset pr --no-tests=error --output-on-failure -R '^native_pixel_live_mask_kill_controls$': passed (11 validated DXIL cases + 27 refusal controls).dev) and Release (release): 7/7 passed (native_pixel_live_mask_kill|native_pixel_wqm|native_graphics_wqm|native_direct_container), zero skips, plusoffscreen_check --self-testin both builds.10.0.26100.9818) and NVIDIA GeForce RTX 5080 (32.0.16.2140) on Windows 11 (26200.9974): verified 126 color pixels (7×3 odd edges exercising WQM helper coverage), two atomic-after-kill counters matching surviving pixel count12, and wrong-reference failures.tests/bidi_controls_check.py,tests/docs_links_check.py, andgit diff --check origin/main..HEADpassed.#3514's 5-PR ready cap.