Skip to content

startup: opt-in derived Mesh57 state for immediate-allocation DispatchMesh ExecuteIndirect - #3413

Draft
SimSalabimse wants to merge 7 commits into
R0Y00:mainfrom
SimSalabimse:cursor/mesh-ei-first-slice
Draft

SimSalabimse wants to merge 7 commits into
R0Y00:mainfrom
SimSalabimse:cursor/mesh-ei-first-slice

Conversation

@SimSalabimse

Copy link
Copy Markdown
Contributor

Summary

Opt-in runtime derivation of the Mesh57 state for one graphics/mesh_profile_missing shape, so a direct DispatchMesh ExecuteIndirect can be forwarded without a hand-written .mesh57-state file. 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-state file 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 DispatchMesh ExecuteIndirect calls in 420 seconds and forwarded none. Across draw and mesh, the graphics-pipeline census counted graphics/no_translation 446,421 and graphics/mesh_profile_missing 427,428. Most of the mesh_profile_missing programs are outside the shape this PR handles, so this number is not what the flag forwards.

X2W_MESH57_DERIVE_STATE=1 builds a desktop mesh pipeline only for a direct DispatchMesh whose pipeline is slot 57, has captured stages, and has no reviewed .mesh57-state file. The program must be one immediate GS_ALLOC_REQ, the guest root must be empty, and depth and stencil must be off. The existing ExecuteIndirect path 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 non-empty root, or depth or stencil enabled. With the switch off this path is not entered.

Tests

Windows test PC (MSVC, WARP and RTX hardware), head aed2c0c:

ctest --preset dev -j 1 --no-tests=error -R 'mesh57_derive_alloc|startup_indirect_mesh_derived': build exit 0, 13/13 passed, ctest exit 0.

startup_indirect_mesh_derived_{warp,hardware} forwards one group and reads white at (2,0). derived-off, derived-bad, derived-depth, derived-reviewed, and derived-untranslated keep the clear color. Unavailable mesh shaders or a missing command signature return 77.

Linux: g++ and clang++ with -std=c++17 -Wall -Wextra -Werror -Werror=narrowing on the host reader; tools/run_checks_parallel.py --from-dir tests/checks/python-linux passed.

AI-assisted (Cursor)

cursoragent and others added 2 commits November 28, 2026 23:31
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>
cursoragent and others added 5 commits November 29, 2026 00:01
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants