Skip to content

shader: admit PS-less slot 57 mesh pipelines with a reviewed profile - #3493

Merged
R0Y00 merged 3 commits into
R0Y00:mainfrom
Leyukaka:shader-mesh57-depth-only-profile
Dec 2, 2026
Merged

R0Y00 merged 3 commits into
R0Y00:mainfrom
Leyukaka:shader-mesh57-depth-only-profile

Conversation

@Leyukaka

Copy link
Copy Markdown
Collaborator

Refs #3416

Stacked on #3483 (outcome counters): this branch contains its commit 78693088, the depth-only commit 4ac538ea and the merge 4d3f086c. Merge it after #3483, or together with it.

Why

In a long local run of the application, all 12 slot-57 mesh requests the log recorded had no pixel stage (the log is rate-limited, so this is a sample). Native preparation returns on a PS-less creation before looking up a profile.

What changes

src/startup_stubs/native_mesh57.inl

  • A creation with PS pointer and PS length both zero is treated as depth-only. It is admitted only when all of these hold:
    • exact match with a reviewed profile (normalized descriptor, both fixed states, root blob, MS) and an empty PS span in that profile;
    • no pixel entry metadata in the profile;
    • 0 render targets;
    • depth enabled with depth writes on;
    • a typed DSV format (D16, D32, D24S8 or D32S8X24);
    • all the existing checks (sample state, wave size, root mapping, bindings, MS heap), unchanged;
    • a physical adapter.
  • The PS is not compiled. The stream keeps PS bytecode {nullptr, 0}, which build_stream_pipeline skips, so the pipeline has no pixel stage.
  • Depth state and DSV format come from the reviewed profile, not from defaults.
  • Every PS-less refusal path logs a named reason (the ones before the profile is read are capped: 12 lines per process, shared, plus 12 for an absent profile).
  • PS-present path: control flow and checks unchanged. The only difference is two refusal log lines that were silent before ("unsupported fixed descriptor", "unsupported or uncaptured shader stages"), capped at 12 lines per process.

src/startup_stubs/mesh86_cache.inl: mesh86_hardware_depth is renamed to mesh_hardware_depth so slot 57 reuses the WARP guard. The slot-86 call site is otherwise unchanged.

docs/experiments/native-fixed-mesh57.md: new "Mesh-only depth" section.

Interaction with #3483

  • ps_absent now counts only PS-less creations that are not admitted: a nonzero PS pointer with zero length. In startup: count native slot 57 preparation outcomes #3483 it counted every creation without a captured PS.
  • An admitted PS-less creation follows the same accounting as a PS-present one (lookup, open, profile, lowering, pipeline). Depth-only refusals map to existing outcomes: pixel entry metadata to profile_pixel_entry; color targets, depth writes and DSV format to profile_attachment_state; non-physical adapter to pipeline_refused.
  • Assertions of the startup: count native slot 57 preparation outcomes #3483 outcomes test that changed: ps_absent 1 -> 0, profile_absent 64 -> 65, profile lookups +1 (opens stay 2). The zero-PS probe of that test is now admitted, reaches the lookup and finds no profile.
  • The inline log scan of startup: count native slot 57 preparation outcomes #3483 is replaced by the logged_refusal helper (same line, same search from the file start).

Tests

New native_fixed_mesh57_depth_only_{warp,hardware}:

  • Hardware: a native PSO is created; D32 readback is 0.50 at (2,0) and 0.25 on the other seven texels. With a changed state the PSO is refused and all eight texels stay 0.25.
  • WARP: the physical-adapter refusal.
  • Both: profile absent for an extra state; refusals by reason for a color target, a zero depth-write mask and a typeless DSV, each with no native PSO; a nonzero PS pointer with zero length gives no native PSO.

ctest -j 1 -R '^native_(mesh57_(outcomes|depth_only)|fixed_mesh57_)' on 4d3f086c, preset dev: 23/24. This includes native_mesh57_outcomes_{warp,hardware} and the two depth-only tests. The only failure is native_fixed_mesh57_waterfall_fine_hardware, the known #3489.

Mutations, one at a time, each followed by a rebuild. The two outcomes-test rows ran on 4d3f086c, the others on 4ac538ea before the merge:

Mutation Result
skip the color-target check caught, WARP and hardware
skip the depth-write check caught, WARP and hardware
skip the typed-DSV check caught, WARP and hardware
default depth state instead of the profile's caught on hardware: depth at (2,0) reads 0.25
compile the PS in depth-only mode caught on hardware
suppress the "depth-only profile absent" log caught, WARP and hardware
count the absent depth-only lookup as ps_absent caught by the outcomes test, WARP and hardware
return before recording the absent depth-only lookup caught by the outcomes test, WARP and hardware
depth_only ignores the PS pointer (length only) survives

The surviving mutation changes no behaviour: the capture layer already refuses a nonzero PS pointer with zero length, so that control exercises the capture guard and not the new predicate.

Not covered

  • Two outcome paths have no test: PS pointer 0 with a nonzero length, and a PS capture failure. Both count as unsupported_stage_or_descriptor.
  • The depth-only tests do not read the outcome counters, so the accounting of the depth-only refusals is checked by reading only.
  • No profile exists yet for real pipelines. Profiles must still be reviewed; a tool to build them from runtime captures is in progress.

@lukaslw-lab lukaslw-lab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed draft head 196adf8c (own commits 4ac538ea, bd48290a on top of #3483) by reading the diff; not built or run.

Verdict: approve. The depth-only path is admitted only by an exact reviewed profile, and the PS-present path keeps its checks. No MUST.

  • SHOULD ps_absent changes meaning here (native_mesh57.inl, the fields[5] && !fields[6] branch). It now counts only "PS pointer without PS bytes", while an absent PS is the admitted depth-only case. Since #3483 and this branch land together, renaming it now (e.g. ps_uncaptured) avoids a counter name that reads the opposite way in run logs.
  • NIT The shared refuse cap (12 lines per process across all reasons) lets the first noisy reason hide the others in a long run. Per-reason counts are already in #3483's line, so this is only about the prose.
  • Checked, no finding:
    • depth_only needs both PS pointer and length to be zero. The empty PS span is hashed into key, so a profile captured with a PS cannot match a PS-less creation, or the reverse.
    • On the PS-present path, every PS step (pixel translation, constant pixel, PS compile, stream.ps) is behind !depth_only, and the NumRenderTargets check is unchanged for it.
    • The depth-only gates (no pixel-entry metadata, 0 RTs, depth writes on, typed DSV, physical adapter) all throw inside the try with a matching outcome. mesh_hardware_depth builds a DXGI factory per call, but only after a profile matched.
    • In our local cache from this title, all 996 slot 57 mesh requests have a .ps57. None of them is PS-less, so real profiles for this path will depend on #3505's capture tool.

Tests: native_fixed_mesh57_depth_only_hardware proves the profile's depth state is used (D32 readback 0.50 vs 0.25) and that a changed state is refused. _warp pins only the adapter refusal and the per-reason refusals. CI did not run either: they are not in the pr preset filter.

@Leyukaka
Leyukaka force-pushed the shader-mesh57-depth-only-profile branch from 196adf8 to 99defe7 Compare December 1, 2026 18:12
@Leyukaka

Leyukaka commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased the two original commits onto main, which already includes #3483, and added one commit for the review point on the counter name. The rebase preserves the current slot 57 profile handling and published shader-pair fallback.

Renamed the preparation counter from ps_absent to ps_uncaptured to identify descriptors with a nonzero pixel shader pointer and zero byte length. The outcome fixture now checks that case explicitly. Descriptors with both fields zero proceed to reviewed-profile lookup.

On commit 99defe7ad, dev preset, targets compile_dxil d3d12_xs_shim xmem_shim startup_indirect_draw_indexed:

ctest --preset dev --no-tests=error -R '^(native_fixed_mesh57_(depth_only|compare_vcc|mrt|published_pair(_refusal)?)|native_mesh57_outcomes|startup_indirect_mesh_cache)_(warp|hardware)$' -V

14/14 passed.

@Leyukaka
Leyukaka marked this pull request as ready for review December 1, 2026 18:13

@lukaslw-lab lukaslw-lab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 99defe7a (rebased onto 158ef794, which includes #3483) by reading the diff; not built or run.

Verdict: approve. The rename (ps_uncaptured) resolves our earlier SHOULD, and the fixture now pins that case: count 1 next to 2 unsupported. The rebased depth-only path keeps the same exact-profile gate. No MUST.

  • NIT native_mesh57.inl:424-428: when the MS capture is missing and the descriptor has a PS pointer without bytes, the request counts as ps_uncaptured, not unsupported_stage_or_descriptor. Checking !info->fixed_ms first would keep the counter to what its name says.
  • Checked, no finding:
    • The depth-only gate (:423). Both PS fields must be zero. The key hashes the empty PS, so a profile matches only with an empty PS span (match(5, ...)). Pixel-entry metadata or a pixel heap is refused (:496). Zero color targets, depth writes and a typed DSV are required, and the physical-adapter guard runs before translation (:554).
    • Published pair. Depth-only refusals do not fall back to the published MS57 pair (:678), so a PS-less creation cannot pick up a pair built with a pixel stage.
    • Stream and compile. Without a PS, stream.ps stays {nullptr, 0} (:713), and neither the PS translation, validate_raster_link nor the ps_6_6 compile runs.
    • PS-present path. Its checks and order are unchanged apart from the two new capped refusal log lines.
    • mesh86_hardware_depth → mesh_hardware_depth. A rename only; the slot 86 call site is otherwise unchanged.
    • New test registration. tests/cmake/native_mesh57_depth_only.cmake is picked up by the existing fragment glob and runs only the local startup_indirect_draw_indexed binary.

Tests: native_fixed_mesh57_depth_only_hardware proves the profile's depth state is used (D32 0.50 vs 0.25) and that changed states are refused. _warp pins the adapter refusal and the per-reason refusals. native_mesh57_outcomes_* now checks ps_uncaptured 1. None of these is in the Windows pr preset filter, so CI did not run them. The author's 14/14 run is at this head (99defe7a).

@R0Y00
R0Y00 merged commit 7a064ff into R0Y00:main Dec 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: P0 Highest project priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants