Skip to content

GPU diagnostics: measure pipeline worker backlog during shared shader waits - #1604

Closed
ToxicmaggotRP wants to merge 8 commits into
Marvisak:mainfrom
ToxicmaggotRP:diagnostics/pipeline-runnable-backlog
Closed

ToxicmaggotRP wants to merge 8 commits into
Marvisak:mainfrom
ToxicmaggotRP:diagnostics/pipeline-runnable-backlog

Conversation

@ToxicmaggotRP

@ToxicmaggotRP ToxicmaggotRP commented Nov 24, 2026 •

Copy link
Copy Markdown

[## Summary

Adds diagnostics-only measurements for pipeline worker occupancy while shader translations are shared through OnceLock.

This is a measurement step related to #1509. Existing translation-wait timings show that workers can block on another worker's shader initialization, but they do not show whether more pipeline jobs remain queued during those waits.

This patch measures that overlap before proposing any scheduling change.

Changes

  • Track the number of pipeline worker threads, active jobs and queued jobs.
  • Count workers currently waiting on another pipeline worker's shader translation.
  • Accumulate the time during which queued jobs coexist with one or more translation waiters.
  • Separately accumulate the time during which every pipeline worker is waiting on a shared translation while jobs remain queued.
  • Record peak active jobs, queued jobs and dependency waiters.
  • Report the measurements when the queue drains and when the final dependency waiter leaves while work is still queued.
  • Keep the instrumentation behind the Windows diagnostics feature; normal builds and scheduling behaviour are unchanged.
  • Add deterministic unit tests for overlapping intervals and separate backlog periods.

Scope and limitations

This PR does not introduce a dependency-aware scheduler or claim a frame-time improvement.

A non-empty queue does not by itself prove that every queued pipeline is independently runnable. These measurements are intended to establish whether the suspected worker starvation is occurring in real workloads.

Verification

  • Based directly on upstream main at ffe310e.
  • Two deterministic unit tests are included in scheduler_metrics.rs.
  • Not yet run: Windows compilation, the Rust test suite, Clippy and an in-game diagnostics run.
  • No GitHub Actions checks are currently reported for this branch's head commit.

Please treat this as a draft for review of the instrumentation and its measurement semantics.](#1604)

@BaggyALPHA BaggyALPHA 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.

Independent in-game Windows measurement for #1509 on an RTX 3080 12 GiB, driver 621.24. The diagnostics build passed all four scheduler-metrics unit tests. For the title run I used a cold VIctory cache, the Series S profile, and a local stack of this PR with #211 for Series S UI presentation and #1702 for isolated scripted controller input.

The busy rendering phase began around 69 seconds, reached 4,106 draws per frame, and the run ended in device removal about 171 seconds after launch. The last scheduler snapshot showed:

  • Peak queued jobs: 1,216.
  • Peak active workers: 8 of 8.
  • Peak shared-translation waiters: 1.
  • Cumulative time with both queued jobs and a shared-translation waiter: 13.491 ms.
  • Time with all eight workers waiting while jobs were queued: 0 ms.

This is one cold run, with its endpoint set by device removal. The large backlog coincided with very little measured shared-translation waiting. On this trace, timing native pipeline creation and pipeline-library lock contention separately looks more informative than changing scheduling based on queue depth alone.

AI-assisted (Codex). Aggregate results only.

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