Repository navigation
Description
Part of #2413. Refs #870, #3091, #3094, #3308.
Goal
Translate fixed mesh pipelines (device slot 57) through the native C++ frontend. On main 0614f68c, the shader cache of a start-up run of about 6 minutes (carried over from earlier runs) holds 543 slot 57 requests, all with a gfx2hlsl.py .fail, and that run refused 1,923,473 indirect DispatchMesh commands (graphics-pipeline bucket).
Done when the 543 requests are ranked by C++ refusal here, and each claimed item below is merged or released.
How a GPU program reaches the screen
application (unmodified x64 code)
-> console D3D12 / GDK calls -> stand-ins (src/startup_stubs) -> Windows D3D12
each GPU program is gfx1013 machine code and must be translated to DXIL
compute (slot 67) mesh + pixel (slot 57) vertex + pixel
\ | /
translation: gfx2hlsl.py (--pending, or the watcher with -Translate);
C++ frontend in the stand-in with -NativeShaders;
if no translation exists, the draw or dispatch is refused
|
runtime binding: descriptors in guest memory matched to D3D12 resources
and a manifest
On the native path, a slot 57 pipeline also needs a reviewed <variant>.mesh57-state profile (src/startup_stubs/native_mesh57.inl:251-257), so today every captured request stops there before translation. Offline, compile_dxil --refusals reads req_<key>.m57 requests with their .ps57 and .root files (tools/startup/compile_dxil.cpp:548-629); each needs an entry layout, a .mslayout file beside the request or --mesh-layout FILE, and fails with mesh request has no entry layout otherwise.
Where things stand
First gfx2hlsl.py refusals of the 543: s_cbranch_execz skips code with effects outside active lanes 398, v_readfirstlane_b32 outside the group-index read is not covered 91, exchange shapes 37, loops 17. The C++ frontend handles execz blocks differently, so its ranking is still to be measured.
Claimed (Leyukaka, see #2413)
-
tooling: count slot 57 mesh requests in compile_dxil --refusals(tooling: count slot 57 mesh requests in compile_dxil --refusals #3418) -
shader: derive mesh entry root inputs from the creation root signature(offline; open question in tracking: fixed mesh pipelines (device slot 57) requested at run time, 0 of 298 translated; checklist of claimable items #2413) (shader: derive mesh entry root inputs from the creation root signature #3446) - the C++ refusal ranking of the 543 requests, posted here
-
shader: name the mesh exchange shapes the frontend does not match(shader: name the mesh exchange shapes the frontend does not match #3420) -
shader: branch on VCC from a wave-uniform mesh compare(shader: branch on VCC from a wave-uniform mesh compare #3423) -
shader: refuse mesh VGPRs written under a narrowed EXEC and read after the count exchange(the control showed the gap) (shader: refuse mesh VGPRs written under a narrowed EXEC and read after the count exchange #3422) -
shader: fail closed on stale mesh lane masks and partial VGPRs(shader: fail closed on stale mesh lane masks and partial VGPRs #3450) -
shader: accept readfirstlane of a proven wave-uniform VGPR in the mesh frontend(shader: accept readfirstlane of a proven wave-uniform VGPR in the mesh frontend #3439) -
docs: native mesh frontend refusal and acceptance rules(docs: native mesh frontend refusal and acceptance rules #3447)
Free
Each needs a source-built positive case and a negative control (#870). Claim in #2413 before starting.
pos1and per-thread export order- the rest of tedin7's item 1: inner execz, SCC of a mask op, scalar load with a non-wave-uniform address
- loops outside the group-memory exchanges
v_writelane/v_readlane- depth-only pipelines (the native path needs at least one colour target today)
- a source for the group thread count and topology of a fixed mesh pipeline
Not covered yet
A translated mesh program still needs a profile to draw: thread count, topology, rasterizer state and attachment formats have no automatic source; draft #3413 proposes an opt-in runtime derivation for one allocation shape.
Activity
Leyukaka commentedon Nov 29, 2026
First C++ refusal ranking for the 543 captured slot 57 requests.
Tool:
compile_dxil --refusals <dir> --jobs 8 --json --mesh-layout <file>, built from #3418 (664db4caonmain0614f68c) plus the root-input change (not opened yet). Caller layouts all usedguest_root, wave 64 and a non-zerogroup_stride. Variants tested: threads 64 and 128, maxima equal to threads, triangle topology, with and withoutpacked_parameters. Every variant gave the same counts:v_readfirstlane_b32s_mov_b64With wave 32 or
group_stride0, all 543 stop atunsupported mesh instruction or EXEC state: s_mov_b64. The exchange is matched only when, among other conditions,!layout.wave32 && layout.group_stride(src/gfx1013_direct_mesh.inl:383), so those runs measure the layout, not the programs.These are first refusals only. Fixing one reason can expose later refusals in the same requests.
The top reason is the same heap-selection refusal that leads the compute family in #3224 (333 of the 882 compute programs at
main8ecd30fe). #3023 covers heap view types on the native compute route.Next for #3416: the
v_readfirstlane_b32class (147), then thes_mov_b64class (21). Whether those 21 are exchange shapes failing another matching condition is not established; #3420 would separate them.Leyukaka commentedon Nov 29, 2026
Taking the next item from the ranking above: the 147 requests that stop at
v_readfirstlane_b32. By disassembly and code reading (the tool does not report the pc), the refused read in each is the 32-bit unsigned-division expansion over SGPR inputs (v_cvt_f32_u32/v_rcp_f32/v_mul_f32/v_cvt_u32_f32), whose result is the same in every lane, but the frontend does not record VALU results as wave-uniform.Plan, one PR: record a VALU result as wave-uniform when every source is (no DPP/SDWA, no VCC/EXEC or lane-index source), and accept
s_sub_i32ands_mul_hi_u32, which the shared scalar ALU already implements. A negative control keeps a lane-varyingv_cvt_f32_u32input refused. This moves those requests forward but does not translate them yet: by a static estimate (not measured), the next refusals arev_mul_hi_u32ands_max_u32.Leyukaka commentedon Nov 29, 2026
Status of the
v_readfirstlane_b32/ 32-bit unsigned-division item, both branches onmain212d4b5f, PRs to follow:v_readfirstlane_b32of a proven wave-uniform VGPR is accepted. A VALU result counts as uniform only when it is written under full EXEC from uniform sources; for accumulator ops the accumulator is checked, for 64-bit pair sources the high word too; DPP and SDWA forms are excluded.s_sub_i32ands_mul_hi_u32join the scalar ALU list.s_max_u32andv_mul_hi_u32.Also taking a soundness bug in the mesh frontend on
main212d4b5f:s_or_b64 exec, exec, s[x:y]inside an open lane-skip block (v_cmpx_*+s_cbranch_execz) widens EXEC, but the rest of the block is still emitted under the narrowed lane condition. The program is accepted and the DXIL is wrong, with no refusal: a VGPR write after the widening reaches only the lanes that passed the compare. Found by reading the DXIL thatcompile_dxilemits for a source-built fixture; nothing was run on a GPU.Leyukaka commentedon Nov 29, 2026
Status: five branches on
main212d4b5f, PRs not opened yet.v_readfirstlane_b32, ands_max_u32/v_mul_hi_u32.mesh EXEC write inside a lane-skip block). Narrowings_and_b64/s_andn2_b64, the gather and signed-CMPX join restores, and the restore right after a nested skip closes stay accepted.s_mov_b64first refusals in the ranking are, by disassembly, the group exchange without its EXEC save (60 bytes instead of 64, every other word identical). The matcher accepts that form; a later EXEC restore from a pair that was never saved is still refused. What those 21 requests refuse next is not measured.prepare_native_mesh57: theprofile input bytes differrefusal names the first part that differs (length or content). Accepted and refused profiles are unchanged.Leyukaka commentedon Nov 29, 2026
Still on this. The five changes listed above are committed on top of
main212d4b5f; PRs not opened yet.Leyukaka commentedon Nov 29, 2026
Still on this. The five changes listed above merge cleanly onto the current
maineab7180c; PRs not opened yet.Leyukaka commentedon Nov 29, 2026
Status on
main1a0120ba:--refusalscounts slot 57 requests: merged (1a0120ba).41babe6e).b8c68ee9).d58a9f63).v_readfirstlane_b32of a proven wave-uniform VGPR, pluss_sub_i32/s_mul_hi_u32: open.profile input bytes differnames the first differing part: open.s_max_u32andv_mul_hi_u32: open.Each open PR merges cleanly onto
1a0120ba. Between them (git merge-tree --write-tree, pairwise): #3438 and #3439 conflict intests/native_direct_mesh_check.py, #3439 and #3445 insrc/gfx1013_direct_mesh.inl. No other pair conflicts. I will rebase whichever lands second.Left from the plan: mesh entry root inputs from the creation root signature (offline). It is committed locally on
1a0120baand has no PR yet.Leyukaka commentedon Nov 29, 2026
#3450 (open, head
a87c6f7e, onmaine358cf5f) refuses three mesh program shapes thatmainaccepts and translates to wrong DXIL: a VGPR left partial by writes under narrowed EXEC and read after ans_or_b64/s_and_b64/s_andn2_b64EXEC write that can add lanes; a scalar ALU write toexec_lo/exec_hioutside a lane-skip block, which leaves the lane state on the old mask; and a scalar ALU write tovcc_lo/vcc_hi, whose word is then used as the predicate of every lane.#3439 will be rebased on it once it is merged: its two added SOP2 opcodes (
s_sub_i32,s_mul_hi_u32) go through the same guarded handler.Leyukaka commentedon Nov 29, 2026
Seven slot 57 PRs are open and ready for review. All are mergeable against
mainand their PR checks are green. Order that lets each one merge without carrying another:78693088): counters for each exit of native slot 57 preparation. Depends on: nothing. CI: green.6a9d2a02):sampleLevelat level 0 for a constant-coordinate nonuniformIMAGE_SAMPLE, fixes tests: native_fixed_mesh57_waterfall_fine_hardware fails on main (mip 1 colour read where mip 0 is expected) #3489. Depends on: nothing. CI: green.1014e85f): tool that builds a.mesh57-stateprofile from a runtime capture. Depends on: nothing. CI: green.ea3a90c2): mesh-layout blend words read at +0x124 instead of +0xD0. Depends on: nothing. CI: green.196adf8c): PS-less (depth-only) slot 57 pipelines admitted with a reviewed profile. Depends on: startup: count native slot 57 preparation outcomes #3483 (contains its commit). CI: green.4991e866): bound target formats recorded in a.t57file next to the creation capture. Depends on: shader: admit PS-less slot 57 mesh pipelines with a reviewed profile #3493 (only the last commit is new). CI: green.5b05bac2): depth-only profiles and a draft mode in the profile tool. Depends on: shader: admit PS-less slot 57 mesh pipelines with a reviewed profile #3493, tooling: build slot 57 mesh profiles from runtime captures #3497 and startup: read slot 57 mesh blend words at the shifted offset #3503 (contains their commits). CI: green.1 to 4 are independent of each other and can merge in any order. #3493 is the one that unblocks #3502 and #3505; once 1 to 5 are merged, the last two show only their own commits. #3505 reads the
.t57file from #3502 as an input but does not contain its code.lukaslw-lab commentedon Nov 30, 2026
Call-weighted input for the C++ ranking, from a 360 s native run from a saved scene (details and tree in #3541). Each refused
DispatchMeshkey maps to its.s57variant and request. Offsets are ascompile_dxilprints them, from the start of the.m57:Updated 1 Dec: claims and PR states.
mesh heap slot lacks masked root constant provenance77a438d6,12f152df77a438d6+0x2a0:s_load_dwordx4 s[36:39], s[16:17], s23, slot =s_buffer_load_dword s23, s[36:39], 0x7f8<< 5heap_tokens). Runtime binding open, to build on #3023 stage 3 (#2413 note). Until then the runtime still refuses heremesh EXEC write inside a lane-skip blockf2b3d808,2319d05ef2b3d808+0x70c:s_mov_b64 exec, s[20:21]graphics register undefined on an incoming path: 2653e824362exp pos0 ... doneafterv_cmpx_gt_i32+s_cbranch_execz; the pos0 export is skipped on one pathunsupported mesh instruction or EXEC state: v_readfirstlane_b3233f028d7,88fef29833f028d7+0x370:v_readfirstlane_b32 s10, v8, at a branch joinFurther stops from the 454-request census (request counts, not call-weighted), all mumba17:
s_movk_i32/s_xor_b32: shader: lower s_xor_b32 in the mesh frontend, with s_movk_i32/s_xor_b32 tests (Part of #2413) #3635, merged.v_bfm_b32/v_bcnt_u32_b32: shader: lower v_bfm_b32 and v_bcnt_u32_b32 in the mesh frontend (Part of #2413) #3655, merged.s_and_saveexec_b64inside a lane skip: shader: lower s_and_saveexec_b64 if/else diamonds inside a mesh lane skip (Part of #2413) #3645, open.Census with the open PRs stacked: Kawiu, #2413 (392 captured requests).
v_cvt_f16_f32(10),v_cmpx_eq_i32(7),v_cmpx_lt_f32(6): Kawiu, shader: lower half conversions and three CMPX compares in the mesh frontend (Part of #2413) #3666 (open).v_sub_co_u32,v_subrev_co_u32,v_and_or_b32: SimSalabimse, shader: accept v_sub_co_u32, v_subrev_co_u32 and v_and_or_b32 in the mesh frontend (Part of #2413) #3659 (draft).unsupported mesh heap descriptor address(46). Claim on tracking: fixed mesh pipelines (device slot 57) requested at run time, 0 of 298 translated; checklist of claimable items #2413.These are the top seven slot 57 variants: 2.8 M of the 7.2 M
mesh_profile_missingcalls. Another 7.5 M refused calls go through slot 55 derived pipelines, which #3413 addresses.To reproduce a row, put the three request files in one folder and pass this layout. These are the flags native preparation sets. The vertex and primitive limits are placeholders that do not change these refusals:
Merge pull request #3633 from mumba17/shader/mesh-diamond-restore-gap
Leyukaka commentedon Dec 1, 2026
Next step here: verify one reviewed slot 57 profile end to end.
The call-weighted census above already identifies the slot 57 variants that account for the most refused indirect DispatchMesh calls. Use its archive mapping to select the first variant that the C++ frontend already translates and that has complete captured state and attachment evidence. If a new run is needed, rank the cumulative DispatchMesh refusals by pipeline and record the unmatched and overflow counts separately.
Use the draft and validation tools from #3724 to review the captured state and attachment tuple. Start a second process with the reviewed profile present in the cache from startup. This step depends on the profile identity rule from #3748 or #3730, and on one .t57 producer (#3736 or #3502); none is merged. Record profile readiness and indirect DispatchMesh forwards for the selected pipeline. Repeat with that profile removed and the workload held fixed.
Acceptance requires at least one ready profile and one forwarded indirect DispatchMesh attributed to the selected pipeline with the reviewed profile installed. Record the first lowering or binding refusal if readiness or forwarding remains zero. Use a source-built control to exercise the ready and missing-profile outcomes.
Related: #2413, #3724, #3736 / #3502 (attachment capture), #3748 / #3730 (profile identity), #3531 (published-pair control).
shader: lower literal FMAs, straight SAVEEXEC and reflected POS1 in mesh
runtime: accept strided table byte buffers and committed inputs in na…
shader: lower literal FMAs, straight SAVEEXEC and reflected POS1 in mesh
shader: broadcast lane-0 value for full-EXEC mesh v_readfirstlane_b32…
tests: read back multi-wave mesh v_readfirstlane_b32 broadcasts on GPU
runtime: accept strided table byte buffers and committed inputs in na…
shader: broadcast lane-0 value for full-EXEC mesh v_readfirstlane_b32…
tests: read back multi-wave mesh v_readfirstlane_b32 broadcasts on GPU
shader: lower literal FMAs, straight SAVEEXEC and reflected POS1 in mesh
shader: lower literal FMAs, straight SAVEEXEC and reflected POS1 in mesh
shader: broadcast lane-0 value for full-EXEC mesh v_readfirstlane_b32…
tests: read back multi-wave mesh v_readfirstlane_b32 broadcasts on GPU
shader: broadcast lane-0 value for full-EXEC mesh v_readfirstlane_b32…
runtime: accept strided table byte buffers and committed inputs in na…
shader: lower literal FMAs, straight SAVEEXEC and reflected POS1 in mesh
shader: lower literal FMAs, straight SAVEEXEC and reflected POS1 in m…