Repository navigation
shader: prove staged mesh vertex export mask coverage (Part of #3703) - #3832
Conversation
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed 649cfeb7 (draft) by reading the diff; not built or run.
Verdict: approve. Moving the check to s_endpgm is sound: every lane that wrote POS0 must also write each attribute, in either export order. No MUST.
- SHOULD Run a before/after
m86census onf365f125. Besides the 308 it targets, the export gate changes for staged programs (gfx1013_direct_mesh.inl:1296). An export inside a branch or skip used to pass wheneverexport_limitwas set. Now, with staged indices, it needsstaged_export_guard(), becauselegacy_export_guardonly covers the unstaged case. If a program on main reaches that combination, it would now be refused. The census would show that none does. - Checked, no finding:
covers_position(:409) compares only the count limits. That is exact because every value inlinear_threadsis the flattened thread ID (built throughv_mbcntor the wave-numberv_lshl_add). Masks are recorded only under full EXEC, or from SAVEEXEC with no parent lane, so each one is exactlythread < limit. Walkingmask_parentfrom the position scope is right too: a child mask lies inside its parent.- The operand order is right:
v_cmpx_lt_u32 tid, Ntakessrc[1], andv_cmpx_gt_u32 N, tidtakessrc[0]. - Whole-wave EXECZ skips:
guardednow ANDslane_active(export_lane), so a lane outside EXEC does not store even though the DXIL branch was taken for the whole wave. - Attributes under full EXEC (
"") cover any POS0 scope. A second POS0 or a duplicate PARAM is still refused.
Tests: native_mesh_output_mask_ir (10 cases, 8 refusals) is in the pr filter. It checks the store counts per lane and the and i1 on whole-wave skips.
a0276f2 to
cb62776
Compare
There was a problem hiding this comment.
Re-review on cb627763 (rebased on 5770f14e: clip export now keyed on target 13 with the full clip vector, export lane passed to the position store, s_xor_b64 vcc accepted in the mask forms; the target 13 key and the s_xor_b64 form are main's).
Verdict: approve.
Census, same capture and method as before (6,685 distinct mesh programs), main 5770f14e vs this head:
| Programs | |
|---|---|
| Translate, main / with this PR | 1,047 / 1,047 |
| Lost / gained | 0 / 0 |
| First refusal moved | 308: mesh vertex outputs do not share the position mask → unsupported packed vertex export 303, → unproven packed mesh signature rows 5 |
Same 308 as the earlier head. Checked: the position-mask refusal is gone only where the staged export scratch proves coverage (export_scratch.indices non-empty). The packed-row check still requires position_scope==lane_active without staging. The clip export is recorded only for mesh_clip_control==full_clip_vector.
Update: the first run was on a main that refused 257 programs early (my #3707, #3892; fixed by #3893). I reran main 5770f14e and this head, both with that fix: 308 moved, 0 lost, 0 gained. The numbers above are unchanged.
AI-assisted.
|
Merged Tests, Windows 11 26200 with RTX 5080 and WARP. The mesh filter was
All six mesh PRs (#3832, #3835, #3838, #3842, #3843 and #3846) were also merged together onto |
|
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 this head. The whole-wave shortcut checks the actively intersecting lanes, and only masks whose proven ancestry covers the position export satisfy the staged coverage check.
MSVC x64 Debug (Windows, RTX 4060 Laptop and WARP): built compile_dxil and ran ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^(native_mesh_output_mask_ir|native_direct_mesh|native_mesh_readfirstlane_(warp|hardware))$'. All 4 passed, including both adapters and the fixture's refusal cases. The trial merge against 0b83a346b was clean.
Proves staged mesh vertex export mask coverage at shader end rather than requiring every
PARAM,CLIP, and packed attribute export to followPOS0under the exact samelane_activeSSA token, clearing"mesh vertex outputs do not share the position mask"(308 mesh programs in #3703).Part of #3703. Refs #3641.
(Opened as Draft per #3514 until an active review slot frees.)
Summary
src/gfx1013_direct_mesh.inl:PARAM,CLIP, and packed attribute export'slane_activescope inattribute_scopesand validates ats_endpgm(oncePOS0andposition_scopeare known) thatcovers_position(mask)holds for every declared attribute.thread < limitcount masks (ExportCountMask{limit, wave}viav_cmpx_gt_u32,v_cmpx_lt_u32, lane-linear count guards, ands_and_saveexec_b64fromexact_count_bits) socovers_positionproves coverage across:PARAM/CLIP/packed exports before or afterPOS0under the same mask,"") withPOS0under a narrowed mask,v_cmpx_gt_u32 count, tidvsv_cmpx_lt_u32 tid, countandSAVEEXEC),POS0under a nested child skip of the attribute's mask (mask_parentchain).staged_export_guard()to handle whole-waveEXECZblocks for exact count masks and intersectslane_activeintoguarded(...)(export_lane) when!exec_skip->per_lane, so individual lane masks are honored even whenEXECZbranched on wave nonemptiness.POS0, and duplicatePARAMexports.tests/native_mesh_output_mask_check.py+tests/cmake/native_mesh_output_mask.cmake:native_mesh_output_mask_ir(matches theprCTest preset): 10 validated DXIL cases (checking@meshPositionWritten,@meshPackedIndices, exact lane-indexedstoreVertexOutputcounts beforeemitIndices, andand i1lane intersection on whole-wave count skips) + 8 fail-closed refusal controls.Verification
Host: Windows 11 (
10.0.26200.9974), MSVC C++20/W4(zero warnings on edited lines). Baseorigin/mainf365f125.ctest --preset pr --no-tests=error -R "^native_mesh_output_mask_ir$": 1/1 passed (10 positive + 8 refusals).dev) & Release (release): 3/3 passed in both configs (native_mesh_output_mask_ir,native_direct_mesh,native_direct_container).tests/bidi_controls_check.py,tests/docs_links_check.py,git diff --check origin/main..HEAD: all clean.