Skip to content

Shader watcher: a request written during a pass waits for the whole backlog #3392

Backlog

Description

@Leyukaka

Question

When tools/startup/gfx2hlsl.py --watch (or compile_dxil --watch) has a backlog, how long does a request the application has just written wait for its manifest, and does processing newer requests first shorten that wait without changing any output?

Evidence so far

  • pending_keys sorts pending requests by file name, i.e. by key (tools/startup/gfx2hlsl.py:13848), and watch_pass translates the whole list before it scans again (:13738, :13746). A request written during a pass waits for the end of that pass.
  • compile_dxil --watch does the same: collect_watch_requests sorts by marker path (tools/startup/compile_dxil.cpp:809, :828), and run_watch processes the whole pending vector before the next scan (:944-1003).
  • Sources of a large backlog: the watcher's first pass retries every earlier failure once (docs/startup-runtime.md:968, gfx2hlsl.py:13726), and a revision change followed by a re-key (docs/startup-runtime.md:1368-1373). The only timing on record: 3,513 requests took 56.9 s with one process and 7.8 s in parallel on 16 threads (docs/startup-runtime.md:985-986).
  • The runtime looks for an absent manifest again after 1 s, doubling up to 32 s (docs/startup-runtime.md:963-964).
  • Inference, not measured: a pipeline the application has just requested waits behind every older request, and its draws stay "not drawn" meanwhile.

Completion condition

  1. Measure, from file times only: for each key, the time from its ready marker to its manifest (<key>.txt, or <key>.ms57.txt for mesh), on a synthetic cache with an old backlog and a few new requests, under the current order.
  2. Repeat with an order that takes requests written since the watcher started first and rescans between batches.
  3. The set of files produced under both orders is byte-identical.

A follow-up tooling: PR would change the order only, with a test where the new request is published before the backlog ends and a negative control with the current order. Not in scope: how anything is translated.

Required environment

None for the gfx2hlsl.py half (pure-Python synthetic cache). Windows x64 and the Windows SDK for the compile_dxil half. A local cache is optional; only counts and durations from it would be posted.

Part of #870. Refs #2120, #2925, #2899, #2992.

Activity

  1. Leyukaka commented on Nov 28, 2026

    @Leyukaka
    CollaboratorAuthor

    Working on this: an order-only change to gfx2hlsl.py --watch (newest requests first, rescan between batches) with a pure-Python test and a negative control, plus the measurement from the completion condition. compile_dxil --watch after that.

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