Skip to content

P0: identify and fix the first GPU blocker for a visible 3D scene draw #3541

Not planned

Description

@R0Y00

Status update · 1 December 2026

Superseded by #3641 for the scene readback and presentation proof. The first verified binding failures are now tracked in #3639 and #3640. The native path and direct dispatch diagnostics merged in #3638. Visible scene geometry remains unverified.

Refs #870, #1759 and #3310. Target main.

Goal — Reproduce one scene draw that changes an expected color or depth pixel before composition, using the native C++ path. Compare against the same scene in a reference capture and fix the earliest verified divergence that prevents the draw or corrupts its inputs.

Slot 86 is a candidate: the reference runtime creates Mesh PSOs from streams even when slot 57 deserialization is refused, and X2W currently rejects some slot 86 root layouts. Indirect argument production is another candidate: #3310 matched 48 records by resource and byte offset that stayed at (0,1,1). A frequently submitted draw is a good starting point, but a once-per-scene compute or bake pass can be a prerequisite for many draws.

  • Select a reference draw with a measurable scene-target contribution. Match its shader identities, root bindings and target state on current main. Trace the producers of the resources it reads and report the first divergence. Keep the Python fallback disabled and use existing C++-generated cache artifacts where available.
  • Fix the verified blocker for that draw. If the slot 86 PSO or resource binding fails, trace the required MS/PS translation, root mapping and desktop descriptor. If a GPU-written indirect mesh record is involved, use gpu: trace a GPU-written DispatchMesh argument through its producer and descriptor history #3310 to trace the producer SRV/UAV, backing resource, byte offset and queue fence. Read the same 12 bytes after the write and before consumption, and verify the reads agree and that X is nonzero.
  • On the same scene, show that the repaired path submits the draw and changes an expected scene-target pixel before composition. Record the commit, exact command, adapter/driver and debug-layer result. Add a source-built regression for the behavior that changed, with a negative control.

Publish title-neutral, sanitized results and source-built fixtures.

Activity

  1. added
    help wanted
    priority: P0
    on Nov 30, 2026
  2. changed the title [-]P0: render the first verified 3D scene draw through slot 86[/-] [+]P0: identify and fix the first GPU blocker for a visible 3D scene draw[/+] on Nov 30, 2026
  3. lukaslw-lab commented on Nov 30, 2026

    @lukaslw-lab
    Contributor

    I'll take the trace on a live native run (current main + #3599, from a saved scene, 360 s). Correction to the first version of this comment: the 4 slot 86 pipelines (2 × 0x400, 2 × 0xc00) are created but never reach ExecuteIndirect in any of our runs (up to 360 s), matching mumba17's 545 s run on #3545. The placeholder count I quoted counts placeholder command signatures, not slot 86. The largest refusals on the same run are slot 57 DispatchMesh: no_translation 8.31 M and mesh_profile_missing 7.39 M calls by 360 s. I'll trace the most-submitted of those pairs, find which keys they are and why each is refused, and report the first one that blocks a scene-target write. The fixed slot 57 pass in #3560 stays a second pre-composition candidate.

  4. lukaslw-lab commented on Nov 30, 2026

    @lukaslw-lab
    Contributor

    First results for the trace claimed above. On a 360 s native run from a saved scene, every indirect DispatchMesh is refused, and no slot 57 mesh pipeline is prepared natively.

    Bucket Calls What it is
    mesh_profile_missing 7.18 M slot 57 fixed mesh pipelines; all top keys match captured variants
    no_translation 7.50 M slot 55 derived pipelines of mesh bases (the only console path outside 57/86 in indirect_graphics_match_code)

    The native slot 57 preparation counters end at ready 0, profile_absent 10,726, unsupported_stage_or_descriptor 13,388.

    A .mesh57-state profile alone would not make these draw. The top requests by refused calls stop at the mesh frontend first (offline gfx2hlsl.py):

    Request Calls First refusal
    77a438d6e76ca6d7 772 k s_cbranch_execz skips code with effects outside active lanes
    f2b3d808dc09473c 547 k same
    3e82436207e34109 473 k v_readfirstlane_b32 outside the group-index read is not covered
    12f152dfa2a751f6 354 k s_cbranch_execz ...
    33f028d7d49277d3 266 k group-index exchange, s_mov_b64 absent

    All five share one creation root: three tables, a root SRV and two root constants, with flags 0xc00.

    Next, I'll write a .mslayout for 77a438d6 and report its C++ frontend refusal here. I'll also post the call-weighted list on #3416 to help order the ranking there.

    Tree: main 077bff3a + #3599 + #3506 #3516 #3464 #3521 #3097 #3472. X2W_INDIRECT_PIPELINE_KEYS=1, X2W_MESH57_CAPTURE_STATE=1, Agility SDK, native-only. RTX 3080 Ti (driver 32.0.16.1047), Windows 10 19045, debug layer off. 6,685 frames, 0 errors.

  5. lukaslw-lab commented on Nov 30, 2026

    @lukaslw-lab
    Contributor

    Correction to my last comment: the s_cbranch_execz refusals came from gfx2hlsl.py. The C++ frontend gets past that shape. Its first refusals for the same requests, with the flags native preparation sets, are:

    • mesh heap slot lacks masked root constant provenance: 77a438d6, 12f152df (1.13 M calls). In 77a438d6 the heap slot is read from a buffer, s_buffer_load_dword << 5 → s_load_dwordx4 (+0x28c–0x2a0 in the .m57). This is the slot 57 counterpart of the GPU-selected index in P0: bind GPU-selected buffer SRVs for slot 86 mesh draws #3545.
    • mesh EXEC write inside a lane-skip block (0.78 M), graphics register undefined on an incoming path: 265 (0.47 M) and v_readfirstlane_b32 (0.42 M).

    The full table, with offsets and reproduction steps, is on #3416. I'm taking the heap-slot row (claim in #2413).

  6. Not-Saii commented on Nov 30, 2026

    @Not-Saii
    Contributor

    Findings from a native-only run on a different host, for a direct draw that is separate from the DispatchMesh trace above.

    Environment: Windows 11 build 26300, NVIDIA GeForce RTX 4090 (driver 32.0.16.1088), Windows SDK 10.0.26100. main at 78261e08, release build, native shaders only, debug layer off. Runs start from a saved scene with one input.

    1. The most-submitted refused direct draw is a depth-only fixed slot 57 pass.

    Route Key Refused calls Run
    native 586474590e81c52e 17,186 100 s
    published 8f7cfdb662063ba6 177,074 300 s

    The two requests have byte-identical programs and root. The vertex stage exports a position and one parameter. The pixel stage reads a packed pixel position, discards per pixel, and ends in a depth export with no colour export. Captured PSI1: SPI_PS_INPUT_ADDR = 0x8002, NUM_INTERP = 1. I have not read the depth target's format or size.

    2. Why each route refuses it.

    • Native: both stages match the interface library by embedded id but not byte-for-byte, so the pair goes to the raw front end, which refuses the depth export at +0x130: raw graphics varying or system export requires a stage interface.
    • Native, one step further: with that export admitted in a local probe (not a proposed change), the next refusal is graphics branch on a wave mask. The lanes are removed by a v_cmpx_ne_i32 that writes EXEC, followed by s_cbranch_execz to a null export. The surviving path has descriptor and buffer loads before the depth export. I did not look past this refusal.
    • Published: MRTZ requires one uncompressed depth export in a straight-line pixel shader with entry EXEC.

    3. A native-only run stops presenting unless a prepared compute pack is supplied.

    Without a pack, presenting stops about 30 s after the scene starts loading (seen in five runs), and the process later stops in the application's own code. Three thread samples taken during the stall agree: one thread holds the draw lock in record_translated_dispatch → translate_compute_natively, called from ExecuteIndirect, while callers of draw_translated, list_dispatch and list_reset wait. A warm bytecode cache does not change it.

    With a pack built by compile_dxil --prepare-compute-pack and X2W_NATIVE_COMPUTE_REQUEST_CACHE_MIB=256, one 100 s run kept presenting to its last heartbeat at 94 s (2,157 frames). The two settings were changed together, so I have not separated their effects, and the run ended on its timer. The offline pack build took 507 s for 2,805 requests on one thread, about 181 ms each; that the same cost per request applies inside a run is an inference from the matching rate, not a measurement.

    4. Setup note. The native graphics path looks stages up in an interface library in the shader cache (compile_dxil --index-graphics-interfaces). This host had none. Without it, 555 of 654 graphics requests were refused with raw graphics requires a verified stage interface or wave state; with it, that reason no longer appears.

    Not reproducible on a source-built input: the pipelines are the application's own, so the evidence is the keys, the captured register values, the refusal texts and the runs above.

  7. SimSalabimse commented on Nov 30, 2026

    @SimSalabimse
    Contributor

    Some findings on one slot 57 DispatchMesh pair that might save time on the trace. This is the heap-indexed MS+PS bucket (derived mesh guest root is heap indexed, root params t,t,t,srv,c1), from runs on my Windows test PC. I'm not claiming any part of this issue; I'm only sharing what I measured.

    The MS does not declare fixed output counts. The GS_ALLOC_REQ (s_sendmsg msg 9) builds m0 = (s21 << 12) | s18 from v_readfirstlane values, not from an immediate. So the tree's mesh57_read_layout, which expects s_mov m0, <imm>, refuses it by design.

    • The counts come from a per-meshlet record loaded with buffer_load_dwordx2: V = (w & 0x7f) + 1 and P = ((w >> 7) & 0x7f) + 1, each 1..128.
    • When k = rootconst >> 29 is non-zero, V and P are each multiplied by m = min((G << k) + (1 << k), L) - (G << k), where L comes from an s_buffer_load at descriptor +0xac0, shifted right by 15. With an entry log on, every call I saw had k = 1 and took this path, so m is 0, 1 or 2.
    • Thread id is (wave index from s3 bits 27:24) × 64 + lane, so the ISA doesn't fix the group size.

    The pipeline state words that look like NGG limits are a global budget. The words at state block offsets +0x070, +0x074 and +0x078 look like VGT_GS_ONCHIP_CNTL / GE_MAX_OUTPUT_PER_SUBGROUP (128/128/128), and +0x1a4 is 0x40. All of them are identical across all 267 mesh-layout pipelines I had, so they aren't per-shader maxV/maxP/threads.

    The create-time descriptor spans don't hold an MS container. I copied the measured ptr+length spans of the 0x300 description at creation time. None contains DXBC, XBCH or FSSM at any offset, and none has a zlib stream, so there's no declared MS I/O record to read for this pair.

    So for this kind of pair, I think the realistic route is sizing the desktop mesh shader from bounds derived from the code (per-record max times the multiply factor), with SetMeshOutputCounts using the runtime values, rather than looking for a declared profile. I'm trying that as an experiment on my fork and will report back here if it draws.

    AI-Assisted

  8. lukaslw-lab commented on Nov 30, 2026

    @lukaslw-lab
    Contributor

    @SimSalabimse, thanks. That fits what I see on the same root shape (t,t,t,srv,c1, flags 0xc00). The top two requests by refused calls stop earlier in the C++ frontend. The heap slot is a dword read from a root-table buffer and then shifted left by 5, which is the row I claimed in #2413. A local prototype gets both past that point. The next refusal is v_readfirstlane_b32 (+0x470 / +0x474). I'm coordinating the safe form of that read with the view-token guard on #3023.

    Your point about the counts settles the layout question. In my .mslayout the vertex and primitive limits of 128 were placeholders, so a real layout needs bounds derived from the code, as you describe. #3616 keeps native_direct_mesh pinned to the frontend's clamp to the declared limits (#3537), which is the guard if a runtime count exceeds them.

    So the two pieces don't overlap. I'm doing the heap slot, and your output sizing is separate. A draw of one of these pairs needs both.

  9. Not-Saii commented on Nov 30, 2026

    @Not-Saii
    Contributor

    Follow-up on the depth-only fixed slot 57 pass from my earlier comment (native key 586474590e81c52e). With #3612 and #3615 applied it is submitted, but it writes no depth. The cause is upstream of the draw: its vertex data buffer is never written on the native path.

    Environment: same host (Windows 11 build 26300, NVIDIA GeForce RTX 4090, driver 32.0.16.1088). main at 077bff3a with #3612 and #3615 cherry-picked, plus local diagnostics in the D3D12 shim that are not proposed here. Release build, native shaders only, prepared compute pack, X2W_DEPTH_STATE=1, debug layer on. Eight 300 s runs from a saved scene with one input.

    1. The draws are submitted, but no depth texel changes.

    A local readback copied the bound depth target before and after each draw of this key. In 24 draws, on two 512x384 D16 targets and later one 1536x1536 target, 0 texels changed; every plane stayed at the 1.0 clear. The pipeline's own state is LESS_EQUAL, depth write on, no culling, depth clip on, so the depth test does not explain it.

    2. The clipper rejects every primitive.

    Pipeline-statistics and occlusion queries around each draw, with the depth test forced to ALWAYS and culling off for this key:

    Draws Clipper in Clipper out PS invocations Samples passed
    24 708 to 27,380 per draw (= IA primitives) 0 0 0

    With depth clip also off the result is the same, so the rejection is not about z.

    3. The vertex program culls on purpose when a width reads zero.

    Before exp pos0, the vertex stage does v_cmp_lt_f32 vcc, 1e-4, v1 and writes the position (-4, -4, 0, 1) wherever v1 <= 1e-4, which is outside the clip volume. v1 is an f16 loaded from the last 16-byte record of the instance's run in the raw buffer described at user-data offset 0x720. The per-vertex positions come from the same buffer.

    4. That buffer is bound correctly but holds only zeros.

    • It is a 45 MiB placed buffer, bound as the table alias of the placed resource, which is an OpenExistingHeapFromAddress heap. The CPU view is therefore what the GPU reads.
    • The first 16 MiB, which covers every record offset the per-instance table points at, is all zero. It reads the same in draws across frames, so nothing filled it in an earlier frame either.

    5. No translated compute dispatch writes it.

    A local watch armed on the buffer's range decoded the buffer outputs (raw descriptor or view token, table or heap) of every translated compute dispatch, recorded or refused. It found 0 overlaps for the rest of the run. In the frame it armed, 200 distinct compute keys were dispatched with no translation (the logging cap). Run totals for compute dispatches: 107,532 translated, 8,165,025 refused, 14,398,329 with no translation.

    What this shows and what it does not:

    • This draw's first blocker is upstream compute coverage: the buffer it reads is not produced on the native path. Its depth state, the depth export (shader: admit a depth-only export in the raw graphics front end #3612) and the discard lowering (shader: lower a pixel discard written as a compare that writes EXEC #3615) are not what stops it. Because the pixel stage never runs, these runs neither confirm nor contradict those two PRs.
    • I have not identified the producer. It is most likely one of the untranslated compute programs. It could also be a copy, a graphics UAV, or a store form the watch does not decode (word-indexed or texture outputs).
    • A position capture through stream output gave no usable data (the counter read 0), so the vertex outputs were inferred from the program and the buffer contents, not read back.

    Not reproducible on a source-built input: the pipelines are the application's own, so the evidence is the key, the disassembled instructions, the query counters and the runs above.

  10. SimSalabimse commented on Nov 30, 2026

    @SimSalabimse
    Contributor

    Follow-up on the output sizing I posted earlier, plus a status so nobody duplicates the same experiment.

    On the SimSalabimse fork branch local/mesh57-bounds (experimental, not opened as a PR) I now have:

    • code-derived layout/record bounds of 256/256/256 for this pair
    • depth/stencil state support in derive_slot57_mesh
    • the reader handling v_bfe / v_mul_lo and buffer loads
    • an exchange diagnostic

    Two things still block a draw. One is the color-target check: a live run shows these draws bind 3 or 6 render targets (viewport, scissor, formats and single-sample all fine), and the derive path only accepts one, so multi-target support is my next step on the fork. The other is group_stride. The record path yields stride 0, so I can't feed the native exchange (the compute at +0x28 that does v_lshrrev v5, 7 then ds_write at 0x500) without guessing a stride, which I won't bind. Public Mesa, LLPC and RDNA 2 sources don't document that entry layout.

    Does anyone know where the group_stride values in the existing reviewed .mesh57-state / mesh1 profiles (for example 128) came from, and has anyone measured the entry v5 value that exchange broadcasts?

    This doesn't overlap lukaslw-lab's heap-slot / v_readfirstlane work and is still separate from the output sizing, as they already noted.

    AI-Assisted

  11. removed
    priority: P0
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions