Skip to content

startup-d3d12: run compute pipelines that are already desktop DXIL - #3768

Draft
Leyukaka wants to merge 5 commits into
R0Y00:mainfrom
Leyukaka:takeover-1441
Draft

Leyukaka wants to merge 5 commits into
R0Y00:mainfrom
Leyukaka:takeover-1441

Conversation

@Leyukaka

@Leyukaka Leyukaka commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Refs #1412

Takes over #1441 by @triggered02, which had no activity for 48 h. Their commits are kept unchanged; I will hand back if they resume. Supersedes #1441.

Changes

Rebased the slot 62 cache-loading changes onto main 959306d4; everything stays behind X2W_COMPUTE_DISPATCH=1, off by default. The loader now uses the existing desktop compute container checks before creating a PSO. The fixture checks that a malformed cache entry records zero compute invocations. The positive case then uses a PSO from a valid entry to write a UAV and reads it after a fence; it calls Dispatch on the desktop list directly rather than through slot 14, because slot 14 still refuses a root that carries a UAV. So it shows that the cached PSO is valid, not that slot 14 forwards it.

Verification

Commit a0fd8d2e7, dev preset, targets startup_list_dispatch_native startup_compute_binding_trace startup_compute_builder_gate_runtime startup_builder_module startup_stream_consumer:

ctest --preset dev --no-tests=error -R '^(startup_slot62_cache_(warp|hardware)|startup_compute_(cache|binding_trace_warp|builder_gate_runtime|builder_gate_request_warp)|startup_list_dispatch_native_((warp|hardware)|skip_srv_warp_control))$' -V

9/9 passed.

triggered02 and others added 5 commits December 1, 2026 17:28
… cache

Step (b) of the R0Y00#1412 rework. Device slot 62 no longer inspects bytes: it hashes the container the same
way the graphics path does (fnv_bytes over the CS bytecode) and looks for `<key>.cs.cso` in
X2W_SHADER_CACHE, which is where the offline retarget/sign/gate step publishes validated desktop
modules. A hit builds a real CreateComputePipelineState from those bytes with the unwrapped root
signature; a miss keeps the placeholder and logs "no validated module".

Nothing else changes: the dispatch path is still inert (slot 14 not installed), so no behaviour moves
until the two-arm readback proves it. Offline publication of `<key>.cs.cso`, the compute root bindings
and the readback fixture are the remaining steps.

Builds clean; startup_stubs passes.
…ks them up by

Step (a) of the R0Y00#1412 rework: tools/startup/compute_cache.py turns the containers the stand-in dumps
into the `<key>.cs.cso` files that device slot 62 loads, and records `<key>.fail` with the reason when
the existing validated path refuses a module. The retarget/gate/validate/sign decision stays in
tools/dxil_retarget.py - this tool only supplies the naming and the refusal record, so validation does
not get re-implemented at the runtime.

The key is FNV-1a 64 over the shader bytes rendered as 16 hex digits, matching the stand-in's
fnv_bytes/cache_path (d3d12_draw.inl), and tests/startup_compute_cache_check.py (ctest
startup_compute_cache) pins it in both directions plus the refusal behaviour.

Note recorded in the test and worth a maintainer's look: the seed in fnv_bytes is 1469598103934665603,
which is a digit short of the canonical FNV-1a 64 offset basis (14695981039346656037). The cache is
keyed by whatever the runtime computes, so the publisher matches the runtime rather than the spec; if
that constant was a typo it should be corrected deliberately, not as a side effect of this work.
…op runtime

tedin7's review finding 3 on R0Y00#1441: the compute pipeline description copied desc->CachedPSO straight
through, which hands a console cached blob to desktop CreateComputePipelineState. Zero it instead; a
cached PSO is an optimisation the desktop must not be asked to interpret.

Findings 1 and 2 were about the byte-scan classifier, which is withdrawn; finding 4 (no end-to-end
coverage of the CreateComputePipelineState path) is still true and is the next step.

Builds clean; startup_compute_cache and startup_stubs pass.
Step (d), first half: gate the compute-dispatch experiment behind X2W_COMPUTE_DISPATCH=1.

Rebased onto a main whose command-list slot 14 Dispatch already exists (R0Y00#1974): main installs slot 14
unconditionally and forwards only when a desktop compute pipeline and root signature are bound and the
root arguments are forwarded (`decide_dispatch` in `src/startup_stubs/list_dispatch.h`, covered by
startup_list_dispatch and startup_list_dispatch_native). That newer code fully supersedes this PR's own
slot 14 handler, so the handler and its gated `list_typed[14]` registration are dropped rather than
duplicated. The gate covers the slot 62 side instead, which is what this PR adds: with
X2W_COMPUTE_DISPATCH=1 a validated `<key>.cs.cso` is loaded and the desktop pipeline records
`own().pipeline_root`, so main's existing gate can match it against the bound compute root signature.
Without the variable nothing is loaded, so production behaviour is unchanged and nothing can dispatch
on the placeholder path.

Still outstanding, and why this is not marked ready: the source-built two-arm readback (invalid
artifact -> zero recorded dispatches, accepted artifact -> nonzero UAV readback). The gate exists so
that fixture can turn the path on explicitly; until it passes, the default is inert.
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