Repository navigation
startup: opt-in derived Mesh57 state for immediate-allocation DispatchMesh ExecuteIndirect - #3413
SimSalabimse wants to merge 14 commits into
Conversation
Leyukaka
left a comment
There was a problem hiding this comment.
Comment on 35b0d54 (draft). Evidence: reading the diff and the head blobs; git merge-tree against main aff3b1a is clean. Nothing was built or run.
- The derived pipeline uses fixed values where the reviewed path reads them per program.
mesh57_alloc.h:89-94sets 64 threads, topology 2 and wave size 64; the only wave32 signal is ans_mov_b32intoexec_lo(:70-71).native_mesh57.inl:834usesdefault_pso_rasterizer(),:845triangles, andmesh57_alloc.h:223puts the constant block at s8. The reviewed path takes threads, topology and wave size from the profile (native_mesh57.inl:311-312), the rasterizer from the profile (:403) and the SGPR from the mapping entry (:324). The docs state these defaults. The consequence is that a program with culling, another topology, wave32 without anexec_lowrite, or its constant block at another SGPR is forwarded with the defaults, not refused. - A slot 55 failure is stored on its slot 57 base.
derive_slot55_meshpassesbase_infoassource(native_mesh57.inl:679),info = source(:690), andrememberwritesinfo->mesh57_derive_reason(:696). A desktop pipeline refusal with the slot 55 blend override (:876) is then returned at:693for the base itself and for every other slot 55 pipeline on that base. derived-rootdoes not observe the constant. The word is 0 (tests/startup_indirect_draw_indexed.cpp:1118) and the MS only addss_mov_b32 s9, s8(:2414); no later instruction reads s9. A constant that never reaches b0, or the wrong word, still paints (2,0). A non-zero word that drives the export would catch it.- The heap-indexed root with one constant block is only covered as a decision (
tests/mesh57_derive_alloc_check.cpp:228-230). No device mode sets a heap flag on the guest root, so thedeferred_rootbranch (native_mesh57.inl:783) is not run by any test. mesh57_stage_copyandmesh57_fixed_stages_kept(mesh57_alloc.h:122,:132) are called only fromtests/mesh57_derive_alloc_check.cpp. The capture they describe (d3d12_capture.inl:246-259) does not call them, so that test does not fail if the capture changes.- None of the new tests are in the
prctest filter (CMakePresets.json:51: thestartup_indirect_(...|mesh(_xmem_arguments(_skip_wait)?)?|...)_warpalternative does not matchstartup_indirect_mesh_derived*, andmesh57_derive_allocis not listed), and pull request CI runsctest --preset pr(windows.yml:489-493).mesh57_derive_allocneeds no device. - The PR body is behind the head: it cites aed2c0c and 13/13, and says "the guest root must be empty" and "a non-empty root" stays refused, while the head binds one constant block and slot 55 pipelines. The docs record three 420 s runs with the switch on (075e461 "forwarded none", f358a2e "forwarded nothing", 5433113
forwards: 0).
|
A 420 s run on the Windows test PC at 35b0d54, with Last derive census:
I have not bound that root, and I have not treated tag 0 or tag 1 as blend. No reviewed mesh user-SGPR map in the tree covers a five-parameter heap-indexed root. If one exists, what I would need is the user SGPR of each of those five parameters, the user SGPR of the resource heap, and the user SGPR of the sampler heap when 0x800 is set. Is there a reviewed map for this shape, or should it stay refused? AI-Assisted |
35b0d54 to
278f1a9
Compare
X2W_MESH57_DERIVE_STATE=1 builds one desktop mesh pipeline from a single immediate GS_ALLOC_REQ when no reviewed profile was opened, then the existing ExecuteIndirect path forwards it. The switch off leaves every current refusal unchanged. Refs R0Y00#870 Refs R0Y00#2413 Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
X2W_MESH57_DERIVE_STATE only attempts a direct DispatchMesh whose pipeline is slot 57 and has no desktop PSO. Draws and other mesh pipelines stay refused. A slot 57 pipeline with no captured stages stays refused too. Refs R0Y00#870 Refs R0Y00#2413 Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
X2W_MESH57_DXC_DIR supplies dxcompiler.dll and dxil.dll to the slot 57 derivation alone. X2W_NATIVE_SHADERS stays unset for other programs and is only a fallback compiler directory for this path. A missing directory still logs the existing compiler refusal. A present .mesh57-state file is still honored when the native switch did not open it. Refs R0Y00#870 Refs R0Y00#2413 Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
The opt-in now records each DispatchMesh ExecuteIndirect, including calls that never enter slot 57 derivation. The fixed-pair check reports which clause failed, and the heartbeat prints the counts with one sample per reason. Captured stage bytes stay available for a later attempt while the switch is on. Refs R0Y00#870 Refs R0Y00#2413 Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
MSVC does not give two copies of the same reason string the same address, so the census treated the second note as a new reason and kept that sample. Rows now compare the characters. The host check uses two distinct copies. Refs R0Y00#870 Refs R0Y00#2413 Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
A DispatchMesh derivation now copies a single guest constant block of 1..8 dwords into desktop b0, including a heap-indexed root whose only parameter is that block. Descriptor roots and other heap-indexed shapes stay refused by name. A slot 55 pipeline uses its slot 57 base when every patch is a blend record. The heartbeat adds the derived forward count. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
A slot 55 record that is not a blend tag stays refused, and the reason names the tag. The sample lists the first patch tags and sizes and the first guest-root parameter types. A zero pixel length is an empty descriptor span, not a dropped copy. No reviewed mesh user-SGPR map covers a five-parameter heap-indexed root, so that shape stays refused. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Refuse wave32, an unproven thread count, a non-triangle export, a captured rasterizer that is not the bound default, and a constant that is not the word at user SGPR s8. Store a slot 55 refusal on that slot 55 pipeline. The one-constant device modes use a non-zero word in the export, including the heap-indexed root the deferred path binds. The five-parameter heap root stays refused. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
d3d12_xs_device_obj compiles d3d12_capture.inl without X2W_NATIVE_SHADERS. note_pipeline calls the stage-copy helpers, so mesh57_alloc.h is included before that file for every translation unit of d3d12_xs_device.cpp. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
278f1a9 to
6c93fc6
Compare
The three SRV tables and the root SRV no longer all claim t0 in space 0, so the root signature can be created. The shape stays five parameters with the heap-indexed flag, and that root stays refused. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
|
Windows test PC (MSVC, 37/37 passed, ctest exit 0. None skipped. WARP and hardware. At On both WARP and hardware,
Target (2,0) packed RGBA Painted 1/8 at (2,0) No user-SGPR map was added for the five-parameter heap-indexed root. That root was not forwarded ( AI-Assisted |
Leyukaka
left a comment
There was a problem hiding this comment.
Comment on 46be843 (draft); line numbers are on that commit. Evidence is reading the diff and the blobs. Nothing was built or run here. Checks on 46be843: Build and test on Windows, Assemble and translate gfx1013 fixtures and the Linux Python checks pass; the /O2 job is skipped. Only points not in the earlier review on 35b0d54.
-
MUST, code reading. The wave64 claim is wider than the check.
docs/startup-runtime.md:1738says the program is forwarded only when it proves wave64, anddocs/experiments/native-fixed-mesh57.md:129says a 32-bitexecwrite is refused.mesh57_alloc.h:67-74and:90-94flag onlys_mov_b32and eight bitwise SOP2 names with destination 126. Not flagged:- the
*_saveexec_b32and*_wrexec_b32forms the decoder names (gfx1013_isa_tables.inl:59-61): they writeexecimplicitly and their destination field is the save register, sodst == 126never matches; - other 32-bit writers of
exec_lo:s_not_b32,s_movk_i32,s_cselect_b32, shifts, adds; - a wave32 program with no
execwrite at all.
v_mbcnt_lo_u32_b32(:63-64,:117) does not separate the cases: a wave32 program computes its lane id with that same instruction. The accepted fixture (tests/mesh57_derive_alloc_check.cpp:37-40) hasv_mbcnt_loand nov_mbcnt_hi. Scenario: a wave32 mesh program that masks withs_and_saveexec_b32, has one immediate allocation,v_mbcnt_loand a target 20 export returns a layout withwave_size = 64,threads = 64and is forwarded. Either refuse on every 32-bit instruction that can writeexec(by name, including the implicit forms) and require a positive wave64 signal, or state in both docs that wave32 is detected only for the listed spellings. - the
-
SHOULD, code reading. Nine negative cases in
tests/mesh57_derive_alloc_check.cpppass with the check they name removed:no allocation(:83),gap(:87),twice(:91),high(:95),zero(:99),wide(:103),exchange(:107),wave32 exec move(:118),from_register(:122). Each program has nov_mbcnt_loand no export, and each assertion only checks thatderive_immediate_mesh_layoutreturns nothing. Withmesh57_alloc.h:77-78,:81-83,:93-94or:109deleted, the reader still returns no layout at:117(thread count is not proven). Onlyalloc alone,no triangle exportandwave32 exec alu(:48-64) compare the reason. Build each negative from the acceptedtrianglewords with one change, and comparemesh57_read_layout(...).reason. -
SHOULD, code reading. A slot 57 base that was dispatched once passes its blend refusal to slot 55 children whose patch replaces that blend. A direct dispatch on the base stores the
state_block_blendreason on the base (native_mesh57.inl:801-802,stored == shaders). A later slot 55 child with a tag 2 patch reaches:725-726, which returns the base reason beforeblend_overrideis looked at (:799-800). The same child dispatched before the base is built. The same applies toderived mesh desktop pipeline was refused(:924), which was decided with the base blend.derived-slot55-isolate(tests/startup_indirect_draw_indexed.cpp:2649-2674) dispatches the two children only, never the base, so it passes either way.native-fixed-mesh57.md:133says the last blend patch replaces the base blend. Skip the inherited reason when it came from the blend or from pipeline creation and an override is present, and add the base-first order to the test. -
SHOULD, code reading.
mesh57_rasterizer_reasonandMesh57RasterizerView(mesh57_alloc.h:150-165) are called only fromtests/mesh57_derive_alloc_check.cpp:66-81. The runtime decides atnative_mesh57.inl:879-881, and it decides differently: the helper refuses an absent rasterizer (:160-161), the runtime forwards it with the default.native-fixed-mesh57.md:135says slot 57 creation does not pass a rasterizer, so for these pipelines the runtime check does not fire and the culling case from the earlier review is still forwarded. Therasterizercase in the host check does not fail if:879-881changes.
A 32-bit exec write, including saveexec and wrexec, stays wave32. Wave size 64 now requires v_mbcnt_hi or a 64-bit exec write. A slot 55 blend patch retries a base blend or pipeline refusal. An absent rasterizer is not a refusal. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
|
On the review of
The paint list is unchanged: Windows test PC (MSVC, 39/39 passed, ctest exit 0, none skipped. WARP and hardware. That is the previous 37 plus The device shader is 8 bytes longer than at Painted 1/8 at Stayed 0/8 95 passed, 7 skipped, none failed, ctest exit 0. Skipped: Still a draft. No game run on this head. AI-Assisted |
Leyukaka
left a comment
There was a problem hiding this comment.
Re-review of 0f69e4e against our 13:30Z review (diff only, nothing built or run here).
- Point 1 (wave64), fixed:
mesh57_alloc.h:111-127marks*saveexec_b32/*wrexec_b32and any SOP1/SOP2/SOPK 32-bit write with SDST 126 as wave32, and:179-182refuses withderived mesh wave size is not provenwhen there is neitherv_mbcnt_hi_u32_b32nor a 64-bitexecwrite. - Point 3 (slot 55 child inheriting the base blend refusal), fixed:
native_mesh57.inl:726-728skips a base reason listed inmesh57_blend_override_replaces(mesh57_alloc.h:228) when the call has a blend override; device modemesh-derived-slot55-base(tests/startup_indirect_draw_indexed.cpp:2653) covers it. - Point 2 (negatives), fixed: the refusal cases in
tests/mesh57_derive_alloc_check.cpp:154-197are now built from the accepted triangle, so each one differs from an accepted program by the named change only. - Point 4 (rasterizer helper), partly:
mesh57_rasterizer_reason(mesh57_alloc.h:216-222) now returns no reason for an absent rasterizer, which agrees with the runtime, but only the test calls it (tests/mesh57_derive_alloc_check.cpp:142-151). The runtime check stays separate atnative_mesh57.inl:881-883, so the host case does not pin it. - NIT:
from_register(tests/mesh57_derive_alloc_check.cpp:195-197) replaces word 0 only and keeps the literal0x1003, which decodes as a 4-byte VOP2 between them0write andGS_ALLOC_REQ. The case would still be refused by the gap rule if the register-source rule were removed; dropping word 1 isolates it. - NIT:
docs/experiments/native-fixed-mesh57.md:129says "Any 32-bit instruction that writesexecis refused". The reader checks SOP1/SOP2/SOPK destinations and the implicit saveexec/wrexec forms; a VOP writer with SGPR destination 126 (v_readfirstlane_b32,v_readlane_b32) or an SMEM load into s126 is not covered. Narrow the sentence or extend the reader. - NIT: the PR body still cites 46be843 as the verified head.
Nothing here blocks. We approve once the PR is out of draft.
Bring the 125 commits of upstream main since the PR base (including the census/triage/stream-key work) into the opt-in X2W_MESH57_DERIVE_STATE slice. Resolve three content conflicts, keeping both sides' behavior: - tests/startup_indirect_draw_indexed.cpp: keep the derived_mesh guard arg and main's bucket_case/stream_key_case guard args in the arg-validity check. - src/startup_stubs/d3d12_capture.inl: keep the PR's mesh57_reviewed_present and mesh57_derive_reason members and main's guest_stream_key member. - src/startup_stubs/d3d12_xs_device.cpp: keep the PR's plain_constants indexing-match relaxation and main's cached_mesh_root refusal census code. No behavior change beyond the merge: still opt-in, reviewed .mesh57-state still wins, five-parameter root still refused, tags 0/1 still not blend. AI-assisted (Cursor)
Bring the 148 commits of R0Y00 main since the previous merge (45f9045, including slot 86 native bindings, present planes, and mesh57 real-shape work) into the opt-in X2W_MESH57_DERIVE_STATE slice. Resolve five content conflicts, keeping both sides' behavior: - CMakeLists.txt: keep the PR's derived-mesh test modes and main's guarded, empty, and missing-position allocation tests. - CMakePresets.json: keep mesh57_derive_alloc_check and the derived-mesh pr-filter entries, and main's compile_dxil, present-planes, and present-composite targets and filter entries. - docs/experiments/native-fixed-mesh57.md: keep the PR's opt-in allocation section and main's real-shape v6 and partial-EXEC sections. - src/startup_stubs/d3d12_xs_device.cpp: keep the PR's plain_constants field and main's slot 86 heap, texture-map, and Mesh86HeapEntry members. Fold the derived-mesh indexing relaxation into cached_mesh_root_matches so a one-constant non-heap root still matches, without loosening slot 86 heap or texture-map cases. - src/startup_stubs/native_mesh57.inl: keep main's profile_open_failed outcome and profile_error helper, and the PR's mesh57_reviewed_present flag after a successful profile open. No behavior change beyond the merge: still opt-in, reviewed .mesh57-state still wins, five-parameter root still refused, tags 0/1 still not blend. AI-assisted (Cursor)
After merging current main, state_block_blend applies the mesh layout shift itself from the tag at +0x004. The derived-mesh path still passed a pointer already advanced by +0x54, so the reader looked for the tag in the wrong place and refused with "unknown state block A layout". Give it the full block. AI-assisted (Cursor)
Summary
Opt-in runtime derivation of the Mesh57 state for one
graphics/mesh_profile_missingshape, so a directDispatchMeshExecuteIndirectcan be forwarded without a hand-written.mesh57-statefile. Refs #870. Refs #2413.Opened as a draft because it touches the question @Leyukaka asked in #2413 (whether a derivation from the fixed descriptor and state blocks is acceptable, or whether those values must stay hand-reviewed). The switch is off by default and a reviewed
.mesh57-statefile always wins, so the reviewed path in #3308 is unchanged. If derived values are not acceptable on the runtime side, I'm happy to close this or narrow it to a tool that only writes candidate layouts for review.Context: a startup run on the Windows test PC with the refusal census from #3411 refused 653,708
DispatchMeshExecuteIndirectcalls in 420 seconds and forwarded none. Across draw and mesh, the graphics-pipeline census countedgraphics/no_translation446,421 andgraphics/mesh_profile_missing427,428. Most of themesh_profile_missingprograms are outside the shape this PR handles, so this number is not what the flag forwards.X2W_MESH57_DERIVE_STATE=1builds a desktop mesh pipeline only for a directDispatchMeshwhose pipeline is slot 57, has captured stages, and has no reviewed.mesh57-statefile. The program must be one immediateGS_ALLOC_REQ, and depth and stencil must be off. The guest root may be empty, or one 32-bit-constants block of 1 to 8 dwords copied into desktop b0 at user SGPR s8. A heap-indexed flag on that one-constant root does not by itself refuse it. Any other root, including a five-parameter heap-indexed root, stays refused. A slot 55 pipeline reuses that mesh only when its program matches the slot 57 base and every patch record is blend tag 2, or the patch list is empty. A failure on that pipeline is remembered there, not on the base. The existingExecuteIndirectpath then records the call. The rasterizer stays solid, cull none, and depth clip.What stays refused:
graphics/no_translation, including a slot 57 pipeline with no captured stages; slot 86 meshes that only lack a cached stage; any other allocation shape; a guest root that is neither empty nor that one constant block; a slot 55 patch tag other than 2; or depth or stencil enabled. With the switch off this path is not entered.Tests
Windows test PC (MSVC, WARP and hardware), head
46be84356b6a47aa5053873d6c4b062133e86d4f:cmake --build --preset devexit 0, 37/37 passed, ctest exit 0. None skipped.On both backends,
mesh-derived,mesh-derived-dxc,mesh-derived-root,mesh-derived-root-heap, andmesh-derived-slot55paint 1/8 at (2,0)0xffffffff.mesh-derived-slot55-isolatestays 0/8, then paints 1/8. The other derived modes stay 0/80xff000000, includingmesh-derived-root-five. That mode now creates the five-parameter root and logsreason=derived mesh guest root is heap indexedwithroot=5 const=1 other=4 heap=1024 params=t,t,t,srv,c1andreal=0. Unavailable mesh shaders or a missing command signature return 77. The branch is 6 commits behind current main17b662a2and still merges cleanly. It is still based onc04e0dd6.Linux:
g++andclang++with-std=c++17 -Wall -Wextra -Werror -Werror=narrowingon the host reader;tools/run_checks_parallel.py --from-dir tests/checks/python-linuxpassed.AI-assisted (Cursor)