Skip to content

Shaders: record and prewarm chain-ABI whole PSOs demanded before world entry #2741

Backlog

Description

@KOLESNiii

Part of #2088 and #2508. Related to the world-load roadmap #1833.

Problem

On main at b49be18, split compute normally uses its pieces, but compute ExecuteIndirect and direct dispatch without usable scratch can call Chain::whole. The whole program then uses the dispatch-chain root signature and .chain.pso namespace. Ordinary whole PSOs use a different ABI. Used-pipeline history identifies the shader set and cannot tell the precompiler which call needed this fallback. Indirect demand · Direct fallback · Cache names

A reported RTX 5090 relaunch on nvidia-dev spent 468.5 of 491 seconds of awaited cold compute on 20 whole forms, even though their shaders were in the used history. On an RX 9070 XT, warming six extra whole forms in a 26-program #2551 sample raised offline driver time from about 110 to 230–247 seconds. These are separate observations. They motivate testing selective warming on the same runtime and adapter. Relaunch trace · Offline cost

#2551 adds whole-form creation for every selected split shader. #2096, #2104 and #2409 cover startup ordering and compute replay by first-use shader key. #2404 and #2519 remove demand for the whole form on some paths. This issue is for recording and replaying the specific fallback requests that still occur. Prior discussion

Implementation plan

Use small PRs against main. Start with opt-in capture, then targeted replay, then fresh-process and retail validation. Coordinate with #2551 for whole-form creation and #2737/#2739 for persistence reporting.

  1. Capture first demand. Pass a reason from the indirect caller and direct scratch fallback to a common capture point before Chain::whole can wait or create a PSO. Distinguish indirect, bundle, missing recording allocator, and scratch unavailable where the caller can establish the reason. Record even when the whole PSO is already ready. Include a sequence, timestamp and present count, source record hash, final whole-DXIL digest and byte length, effective flags and node mask, and a stable chain root-signature identity derived from its ordered static samplers and ABI version. Record effective translation options and adapter, driver/runtime and build identities in the capture metadata where available. Use D3D12.X: XCL_PSO_MANIFEST=1 writes the order a run asks for its pipelines (#2088) #2096's ordering if available, or an opt-in versioned local sidecar with a user-selected sequence cutoff. Deduplicate the first demand by final identity. Keep file I/O outside the whole-build lock and store only replay metadata.
  2. Validate and plan replay. Extend the offline shaders command with an explicit capture path and sequence cutoff. Resolve selected record hashes against the existing shader input in one pass, including supported compute containers. Reuse the runtime translation path and compare the rebuilt whole DXIL, effective flags, node mask, and chain root identity before native creation. Keep distinct requests separate even when they share the source hash. Reuse the runtime cache key builder and report missing records, changed forms, configuration mismatches, and ambiguous disk keys per item. On current main the disk name omits node mask and sampler identity. Start with zero node mask and an isolated cache for the experiment, reject collisions and other unsupported descriptors, and expand coverage only with matching runtime/offline key support such as Shaders: --pipelines blobs are made as a title's run asks for them #2515/D3D12.X: share dispatch-chain root signatures per device and key compute blobs on NodeMask #2723. A missing or mismatched row should leave the replay incomplete.
  3. Create only selected native whole PSOs. Share the chain-root descriptor construction with Shaders: --precompile --pipelines also builds a split program's whole form #2551 where practical. Pass the recorded effective flags rather than the current offline zero defaults. Submit the selected whole DXIL with the chain root signature to the same adapter and compatible device setup, writing through the existing driver cache. Start in first-demand order under the existing size and concurrency limits. Separate successful native creation, successful create with a supplied blob, explicit rejection and cold retry, newly persisted blob, and unavailable or failed blob writes. Treat capped, mismatched, or unpersisted entries as incomplete. Preserve the regular shader precompile path, chain pieces, and runtime fallback behavior.
  4. Prove identity and reuse. Add a synthetic fixture where ordinary whole, chain whole, and chain pieces have distinguishable identities. Test exact cutoff, deduplication, missing inputs, multiple final identities for one record, and mismatches in ABI, effective flags, node/samplers or final DXIL. Test that an unsuccessful replay cannot be reported as complete. In a fresh Windows process using the real runtime fallback path, show that the selected blob is supplied to a successful native create without an explicit cold retry and that the dispatch output matches. Exercise an unselected sibling and both an indirect call and a direct fallback where the fixture permits.
  5. Measure world entry. Capture the load corridor once and hold the runtime build, adapter/driver, title profile, save, graphics cache, chain-piece cache and implicit driver-cache policy fixed. Compare the usual prewarm, demand-only whole warming, and Shaders: --precompile --pipelines also builds a split program's whole form #2551's all-selected-whole warming on copies of the same initial cache. Report offline time and peak commit, exact demand coverage on relaunch, awaited cold whole-build time, remaining graphics/queue stalls, time to the first textured world frame and input response, skipped dispatches, and device removals. If demand changes across launches, publish the uncovered keys and measure coverage before automating another replay. Repeat on NVIDIA and AMD as hardware becomes available.

The first success criterion is exact blob reuse with matching dispatch output. The retail result should show whether selective replay reduces world-entry time or moves the critical wait elsewhere.

AI use was OpenAI Codex (GPT-6, exact serving variant unavailable) for static analysis, evidence review, and drafting.

Activity

  1. afpruivo commented on Nov 26, 2026

    @afpruivo

    RTX 3090 24 GB, nvidia-dev af2cecc4: the stop at the world start is the cold whole-form builds this issue describes. #2551 merged on top lets the title submit work to 316 s instead of 108 s, but 30 whole forms are still built cold, and the device is removed at 341 s. One run per row, so read it as a direction, not a rate.

    Setup

    • RTX 3090 24 GB, driver 621.40, Windows 11 26300, release build. Retail 1.0.2.1 (smoke title: 3c290c16), 480 s, XCL_DIRECT_DXIL=1 XCL_DRED=1, scripted A presses.
    • xcl.exe in the 1 GiB shader-heap profile from xcl run: xcl nvprofile puts xcl.exe in an NVIDIA profile with a bigger shader heap (#2403) #2590.
    • Shaders precompiled first (--precompile, then --precompile --only cs --pipelines --used-only from the same build).
    • Every run starts from the same warm XCL cache: the files each run adds are moved aside afterwards.

    Where the title stops on af2cecc4

    • Thread dumps (XCL_THREAD_DUMP_AT=110,150), symbolized with the build's PDB. At both dumps a title thread is in bind.rs:1414 (execute_indirect) → dispatch_chain.rs:128 → :82 (Chain::whole, waiting on build_whole). This is the same stack as in RTX 3070: no crash, black window, 80k graphics pipelines queued, long driver PSO waits (nvidia-dev) #2595 (comment).
    • Another title thread builds whole forms of split compute programs in the driver for the rest of the run:
      • 113 builds after 100 s, 390 s in all, 22 of them over 5 s;
      • 1.0–1.35 MB of DXIL each, up to 28 s per build;
      • none of them had a driver blob.
    • No device removal: the title just stops presenting about 1 s after the world start.

    Ruled out

    • The two-pass ExecuteIndirect cap. At the stop the default 1024 MiB cap is reached and draws are skipped. With XCL_TWO_PASS_MB=4096 nothing is refused, and the title stops at the same point.
    • The shader heap. The no-profile (512 MB) and 1 GiB runs stop in the same way, before the heap limit matters.

    With #2551 (3567b2ef) merged onto af2cecc4 (merges cleanly; local commit, not pushed). The precompile made 3,875 pipelines, 0 refused.

    warm, 1 GiB profile af2cecc4 af2cecc4 + #2551
    world start (first #101) 95.9 s 104.2 s
    last GPU submission 98.8 s 316.6 s
    dispatches after the world start ~11,000 ~113,000
    frames after the world start 28 ~260, sporadic
    large compute builds after 90 s with a driver blob almost none 201 of 231
    title threads in Chain::whole at the dumps at both 0 at 158 s, 2 at 228 s, 0 at 341 s
    end no removal, idle to 480 s 0x887a0005 at 341 s, no DRED breadcrumbs
    peak commit 37.6 GB 41.3 GB
    • Edit: the frame counts in the table were wrong (counted only from 120 s on); corrected.
    • At the removal: 17.9 GB local video memory against a 22.7 GB budget. I can't tell the cause of that removal from this log.
    • The 30 whole forms still built cold fit the point above: --used-only history can't tell the precompiler which programs Chain::whole will need.

    Also seen: gpu_compute_e2e::async_compute_pso_registers_real_pso_and_not_standin fails on plain af2cecc4 as well, so not because of #2551. It was already reported for nvidia-dev in #42 (comment).

    Not tested: more than one run per row; the 30 cold programs one by one; what removed the device at 341 s; AMD.

    AI use: Claude Code (Claude Opus 5.5) ran the builds and runs on my machine, symbolized the dumps, read the logs and drafted this. I checked it before posting.

  2. Decodere commented on Nov 26, 2026

    @Decodere
    Contributor

    I'm claiming Step 1 (capture first demand) of #2741 on main (b49be183).

    Plan as separate small PRs against main:

    1. Part 1 — Opt-in first-demand capture sidecar (zero behavior/I/O change when unset): pass explicit ChainWholeReason (Indirect, Bundle, MissingRecordingAllocator, ScratchUnavailable) to a common capture point before Chain::whole waits or builds, deduplicating by final identity (source record hash, final whole-DXIL digest + byte length, effective flags, node mask, chain root-signature identity from ordered static samplers + ABI version) and writing the versioned local sidecar outside the whole-build lock (recording even when already ready, with optional sequence cutoff and metadata header).
    2. Part 2 — Validation & selective offline replay: extend the offline shaders command with the capture sidecar path/cutoff to prewarm only demanded .chain.pso blobs and prove fresh-process blob reuse + matching dispatch output (Steps 2–4).

    Machine: NVIDIA GeForce RTX 4060 (8 GB, driver 621.14), Intel Core i5-11400F, 32 GB RAM, Windows 11 26200.

    AI use: Google Antigravity assists with planning, code changes, tests, and verification on the owner's machine.

  3. Decodere commented on Nov 26, 2026

    @Decodere
    Contributor

    Opened Part 1 PR: #2786 (7587c013, base: main, Part of #2741).

    Implements the opt-in first-demand Chain::whole capture sidecar (XCL_CAPTURE_CHAIN_WHOLE, schema_version: 1 UTF-8 JSONL header + deduplicated demand records, zero overhead when unset) so world-entry fallbacks can be reproduced and prewarmed cleanly in Part 2 (next).

  4. Decodere commented on Nov 26, 2026

    @Decodere
    Contributor

    Opened Part 2 PR (Steps 2–4): #2819 (fd317b9c, base: main, Part of #2741).

    • Implements selective xcl shaders --replay-chain-whole <sidecar.jsonl> (--replay-cutoff) with strict schema_version: 1 validation matching #2786 (3b6609fb), single-pass console shader matching, collision/identity guards, and native whole-form .chain.pso prewarming under the live pipeline cap.
    • Verified independently of #2786 (merges cleanly in either order) plus a fresh-process GPU E2E test proving ExecuteIndirect and direct fallback Dispatch (allocator == 0) both hit the warmed whole-form .chain.pso with hits == 1, stale == 0 while an unselected split-eligible program has hits == 0.
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions