tracking: fixed mesh pipelines (slot 57) through the native C++ frontend #3418
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#3418
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Leyukaka on GitHub · 2026-11-28 23:56 UTC · original
Part of #2413. Refs #870, #3091, #3094, #3310.
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 agfx2hlsl.py.fail, and that run refused 1,923,473 indirectDispatchMeshcommands (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
On the native path, a slot 57 pipeline also needs a reviewed
<variant>.mesh57-stateprofile (src/startup_stubs/native_mesh57.inl:251-257), so today every captured request stops there before translation. Offline,compile_dxil --refusalsreadsreq_<key>.m57requests with their.ps57and.rootfiles (tools/startup/compile_dxil.cpp:548-629); each needs an entry layout, a.mslayoutfile beside the request or--mesh-layout FILE, and fails withmesh request has no entry layoutotherwise.Where things stand
First
gfx2hlsl.pyrefusals of the 543:s_cbranch_execz skips code with effects outside active lanes398,v_readfirstlane_b32 outside the group-index read is not covered91, 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(#3420)shader: derive mesh entry root inputs from the creation root signature(offline; open question in #2413) (#3448)shader: name the mesh exchange shapes the frontend does not match(#3422)shader: branch on VCC from a wave-uniform mesh compare(#3425)shader: refuse mesh VGPRs written under a narrowed EXEC and read after the count exchange(the control showed the gap) (#3424)shader: fail closed on stale mesh lane masks and partial VGPRs(#3452)shader: accept readfirstlane of a proven wave-uniform VGPR in the mesh frontend(#3441)docs: native mesh frontend refusal and acceptance rules(#3449)Free
Each needs a source-built positive case and a negative control (#870). Claim in #2413 before starting.
pos1and per-thread export orderv_writelane/v_readlaneNot 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 #3415 proposes an opt-in runtime derivation for one allocation shape.
@Leyukaka on GitHub · 2026-11-29 00:56 UTC · original
First C++ refusal ranking for the 543 captured slot 57 requests.
Tool:
compile_dxil --refusals <dir> --jobs 8 --json --mesh-layout <file>, built from #3420 (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 #3226 (333 of the 882 compute programs at
main8ecd30fe). #3023 covers heap view types on the native compute route.Next for #3418: the
v_readfirstlane_b32class (147), then thes_mov_b64class (21). Whether those 21 are exchange shapes failing another matching condition is not established; #3422 would separate them.@Leyukaka on GitHub · 2026-11-29 01:05 UTC · original
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 on GitHub · 2026-11-29 02:25 UTC · original
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 on GitHub · 2026-11-29 04:24 UTC · original
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 on GitHub · 2026-11-29 06:06 UTC · original
Still on this. The five changes listed above are committed on top of
main212d4b5f; PRs not opened yet.@Leyukaka on GitHub · 2026-11-29 07:49 UTC · original
Still on this. The five changes listed above merge cleanly onto the current
maineab7180c; PRs not opened yet.@Leyukaka on GitHub · 2026-11-29 09:19 UTC · original
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): #3440 and #3441 conflict intests/native_direct_mesh_check.py, #3441 and #3447 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 on GitHub · 2026-11-29 11:23 UTC · original
#3452 (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.#3441 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 on GitHub · 2026-11-29 18:53 UTC · original
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 #3491. 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: #3485 (contains its commit). CI: green.4991e866): bound target formats recorded in a.t57file next to the creation capture. Depends on: #3495 (only the last commit is new). CI: green.5b05bac2): depth-only profiles and a draft mode in the profile tool. Depends on: #3495, #3499 and #3505 (contains their commits). CI: green.1 to 4 are independent of each other and can merge in any order. #3495 is the one that unblocks #3504 and #3507; once 1 to 5 are merged, the last two show only their own commits. #3507 reads the
.t57file from #3504 as an input but does not contain its code.@lukaslw-lab on GitHub · 2026-11-30 13:29 UTC · original · edited 2026-12-01 01:25 UTC
Call-weighted input for the C++ ranking, from a 360 s native run from a saved scene (details and tree in #3543). 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: #3637, merged.v_bfm_b32/v_bcnt_u32_b32: #3657, merged.s_and_saveexec_b64inside a lane skip: #3647, 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, #3668 (open).v_sub_co_u32,v_subrev_co_u32,v_and_or_b32: SimSalabimse, #3661 (draft).unsupported mesh heap descriptor address(46). Claim on #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 #3415 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:
@Leyukaka on GitHub · 2026-12-01 15:47 UTC · original
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 #3726 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 #3750 or #3732, and on one .t57 producer (#3738 or #3504); 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, #3726, #3738 / #3504 (attachment capture), #3750 / #3732 (profile identity), #3533 (published-pair control).
@Leyukaka on GitHub · 2026-12-02 20:48 UTC · original
Slot 57 profiles: a scan for the registers the mesh-layout blocks still hide is up in #3891.
It tests every aligned offset of creation blocks A and B against the gfx10 field definitions and against evidence held outside the blocks (pixel exports and interpolation, the
.t57tuple), the same approach that placed the blend words in #1216. Three independent capture corpora of about 320 variants each agree on every row:CB_COLOR_CONTROL: A+0x0D0 in the mesh layout (same base asCB_BLENDat A+0x124), the only candidate passing the field test in three captures; no field is read yet.DB_ALPHA_TO_MASK: A+0x0B4, provisional (reserved bits only; the word also passes thePA_SU_SC_MODE_CNTLpredicate).SPI_PS_IN_CONTROL: two candidates, A+0x0B0 matched in every informative variant.CB_SHADER_MASK: ambiguous between A+0x0C4 and A+0x0CC.PA_SU_SC_MODE_CNTL: ambiguous, five candidates.CB_TARGET_MASK,SPI_PS_INPUT_ADDR/_ENA,PA_SC_AA_MASK: unresolved.The PR carries the tool, a synthetic check with three negative controls and the offsets only; no captured values.
Still open: the mesh entry dimensions are not in these blocks. I am deriving them from the mesh program itself and will follow up separately.
Question: does anyone have a source for where
CB_TARGET_MASKorSPI_PS_INPUT_ADDRsit in the slot 57 creation blocks, or a capture set where variants bind more targets than their pixel program exports? That would separate the two mask words.