GPU: add diagnostics for shader dependency wait times #1570

Open
srijann07 wants to merge 7 commits from upstream-pr/1571 into main
srijann07 commented 2026-11-24 19:16:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by srijann07 on 2026-11-24T19:16:52Z.


Motivation

Related to #1509. Measure shader dependency waits before changing pipeline scheduling.

Changes

  • Cumulative shader initialization and dependency lookup timing.
  • Host pipeline creation and worker job timing.
  • Diagnostics-only instrumentation.
  • Four regression tests and Windows CI coverage.

Verification

Limitations

Approximate elapsed timings, not exact CPU utilization. Reporting occurs when the queue drains. Separate idle-worker and library-lock metrics are not included. No game assets used or in-game performance improvements claimed.

AI-assisted development.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6589504381 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1571). Originally posted by [srijann07](https://github.com/srijann07) on 2026-11-24T19:16:52Z. --- ## Motivation Related to #1509. Measure shader dependency waits before changing pipeline scheduling. ## Changes - Cumulative shader initialization and dependency lookup timing. - Host pipeline creation and worker job timing. - Diagnostics-only instrumentation. - Four regression tests and Windows CI coverage. ## Verification - Standard and diagnostics Clippy: passed. - Workspace: 342 passed, 0 failed, 6 ignored. - New regression tests: 4 passed, 0 failed. - CI: https://github.com/srijann07/VIctory/actions/runs/45466635156 ## Limitations Approximate elapsed timings, not exact CPU utilization. Reporting occurs when the queue drains. Separate idle-worker and library-lock metrics are not included. No game assets used or in-game performance improvements claimed. AI-assisted development.
DenRakEiw commented 2026-11-24 20:02:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T19:30:34Z.

Review: APPROVED


Verified locally merged onto origin/main (Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):

  • cargo test -p victory-gpu — 50 passed, 0 failed (1 ignored) on both RTX 5090 hardware and VICTORY_D3D12_WARP=1
  • cargo test -p victory-gpu --features diagnostics pipeline::timing::tests — 4 passed, 0 failed
  • cargo clippy -p victory-gpu --all-targets and cargo clippy -p victory-gpu --features diagnostics --all-targets — 0 warnings
  • cargo xtask policy — ok

Clean feature-gated diagnostics for shader dependency wait times with solid unit tests and CI coverage. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6045957953 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1571#pullrequestreview-6045957953). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-24T19:30:34Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC): - `cargo test -p victory-gpu` — 50 passed, 0 failed (1 ignored) on both RTX 5090 hardware and `VICTORY_D3D12_WARP=1` - `cargo test -p victory-gpu --features diagnostics pipeline::timing::tests` — 4 passed, 0 failed - `cargo clippy -p victory-gpu --all-targets` and `cargo clippy -p victory-gpu --features diagnostics --all-targets` — 0 warnings - `cargo xtask policy` — ok Clean feature-gated diagnostics for shader dependency wait times with solid unit tests and CI coverage. Looks good. AI-assisted (Gemini 4 Neon).
Marvisak commented 2026-11-25 02:06:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:31:08Z.


Automated triage for the maintainers.

Merge candidate (update after your reply). For #1509 this adds diagnostics-only timing. It splits shader translation time from time spent waiting on another worker's translation (timing::lookup around the OnceLock in Shader::translated, crates/victory-gpu/src/pipeline.rs). It also times host PSO creation (HostCreationTimer in HostPipeline::new) and worker jobs (work in make.rs). All three points from the last review are addressed. The CI workflow change is gone, and the timing tests now build under cfg(test), so the existing test step runs them. timing::report() now runs only inside the PEAK >= 10 branch of drained(). The weak tests have been replaced with ones that check how init and wait time are attributed. Builds without diagnostics behave as before.

One small nit: the body of the initialize closure in Shader::translated keeps its old indentation, so a cargo fmt pass would tidy it.

CI: passing (check).


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149637120 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1571#issuecomment-7149637120). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:31:08Z. --- <!-- victory-triage v1 head=45c29d95ef1b852e31a5e8924f70315d97f71f40 verdict=merge-candidate at=2026-11-25T07:20:23Z --> Automated triage for the maintainers. **Merge candidate (update after your reply).** For #1509 this adds diagnostics-only timing. It splits shader translation time from time spent waiting on another worker's translation (`timing::lookup` around the `OnceLock` in `Shader::translated`, `crates/victory-gpu/src/pipeline.rs`). It also times host PSO creation (`HostCreationTimer` in `HostPipeline::new`) and worker jobs (`work` in `make.rs`). All three points from the last review are addressed. The CI workflow change is gone, and the `timing` tests now build under `cfg(test)`, so the existing test step runs them. `timing::report()` now runs only inside the `PEAK >= 10` branch of `drained()`. The weak tests have been replaced with ones that check how init and wait time are attributed. Builds without `diagnostics` behave as before. One small nit: the body of the `initialize` closure in `Shader::translated` keeps its old indentation, so a `cargo fmt` pass would tidy it. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
srijann07 commented 2026-11-25 07:03:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by srijann07 on 2026-11-25T06:05:35Z.


Thanks for the previous approval! Rebased onto upstream main (940d32f) and resolved all conflicts. Fresh Windows CI, both Clippy configurations and tests passed.

CI: https://github.com/srijann07/VIctory/actions/runs/45557320404

I'd appreciate a re-review when convenient. Thanks!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154433072 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1571#issuecomment-7154433072). Originally posted by [srijann07](https://github.com/srijann07) on 2026-11-25T06:05:35Z. --- Thanks for the previous approval! Rebased onto upstream main (940d32f) and resolved all conflicts. Fresh Windows CI, both Clippy configurations and tests passed. CI: https://github.com/srijann07/VIctory/actions/runs/45557320404 I'd appreciate a re-review when convenient. Thanks!
srijann07 commented 2026-11-25 08:06:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by srijann07 on 2026-11-25T07:11:59Z.


Thanks for the feedback!

All review points have been addressed:

  • Timing reports now follow the existing batch threshold of 10.
  • CI workflow changes have been removed.
  • Timing attribution tests now run in the standard Windows test suite.
  • Replaced weaker tests with targeted initialization and dependency lookup attribution tests.

Fresh Windows CI and both Clippy configurations passed.

https://github.com/srijann07/VIctory/actions/runs/45565487083

Ready for re-review. Thanks!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7155596528 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1571#issuecomment-7155596528). Originally posted by [srijann07](https://github.com/srijann07) on 2026-11-25T07:11:59Z. --- Thanks for the feedback! All review points have been addressed: - Timing reports now follow the existing batch threshold of 10. - CI workflow changes have been removed. - Timing attribution tests now run in the standard Windows test suite. - Replaced weaker tests with targeted initialization and dependency lookup attribution tests. Fresh Windows CI and both Clippy configurations passed. https://github.com/srijann07/VIctory/actions/runs/45565487083 Ready for re-review. Thanks!
fuzeofficlal commented 2026-11-26 02:07:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T01:37:12Z.


Code review and RTX 5090 + WARP verification at head 45c29d95ef1b merged cleanly onto main (63bcca43c6a0):

  • Feature-gating & concurrency audit (pipeline.rs:140-221, 317-320, pipeline/host.rs:216-244, pipeline/make.rs:324-346):
    • Global counters (INITIALIZE/WAIT/HOST/WORK), report(), HostCreationTimer, and make.rs hooks stay strictly under #[cfg(feature = "diagnostics")] (zero default-build overhead).
    • Entirely lock-free (AtomicU64 + OnceLock), keeps cached cell.get() lookups off the timing path, distinguishes INITIALIZE vs WAIT around get_or_init, and times host PSO creation via RAII Drop after s.translated()?.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy --locked -p victory-gpu --tests -- -D warnings (default + --features diagnostics): 0 warnings
    • victory-gpu -- pipeline::: 27/27 passed default on RTX 5090; 30/30 passed (--features diagnostics) on both RTX 5090 and WARP.

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179955128 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1571#issuecomment-7179955128). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T01:37:12Z. --- Code review and RTX 5090 + WARP verification at head `45c29d95ef1b` merged cleanly onto `main` (`63bcca43c6a0`): - **Feature-gating & concurrency audit (`pipeline.rs:140-221, 317-320`, `pipeline/host.rs:216-244`, `pipeline/make.rs:324-346`)**: - Global counters (`INITIALIZE`/`WAIT`/`HOST`/`WORK`), `report()`, `HostCreationTimer`, and `make.rs` hooks stay strictly under `#[cfg(feature = "diagnostics")]` (zero default-build overhead). - Entirely lock-free (`AtomicU64` + `OnceLock`), keeps cached `cell.get()` lookups off the timing path, distinguishes `INITIALIZE` vs `WAIT` around `get_or_init`, and times host PSO creation via RAII `Drop` after `s.translated()?`. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy --locked -p victory-gpu --tests -- -D warnings` (default + `--features diagnostics`): 0 warnings - `victory-gpu -- pipeline::`: **27/27 passed** default on RTX 5090; **30/30 passed** (`--features diagnostics`) on both RTX 5090 and WARP. LGTM.
fuzeofficlal commented 2026-11-26 14:00:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T13:32:24Z.

Review: APPROVED


Reviewed and verified 45c29d95 merged locally onto origin/main (63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust 1.98.1 MSVC, Windows SDK 10.0.26100.0 dxil.dll; synthetic tests only, no game files).

Verification

  • git merge-tree against origin/main (63bcca43) and combined with #1993: clean.
  • cargo xtask policy (PR head): 182 files ok.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features, PR head, merged, and combined #1993 + #1571): 0 warnings.
  • cargo check --locked --release -p victory (merged): passes cleanly.
  • RTX 5090 (merged, default dev & --release): pipeline:: — 27 passed, 0 failed in both dev and --release (including all 4 pipeline::timing::tests).
  • RTX 5090 & WARP (VICTORY_D3D12_DEBUG=1, --features diagnostics, merged): pipeline:: — 30 passed, 0 failed on both adapters.
  • Combined #1993 + #1571 on 63bcca43 (RTX 5090, VICTORY_D3D12_DEBUG=1, --features diagnostics): 31 passed, 0 failed.

Review Notes

  • Feature and platform gating are clean: mod timing (crates/victory-gpu/src/pipeline.rs:107-272) is under #[cfg(all(windows, any(feature = "diagnostics", test)))] (keeping non-Windows builds of pipeline.rs clean while running the 4 unit tests in default test builds), and all global counters, shader_lookup (:309-313), HostCreationTimer (crates/victory-gpu/src/pipeline/host.rs:312-320, 360-361), and worker hooks (crates/victory-gpu/src/pipeline/make.rs:308-313, 329-330) stay strictly under #[cfg(feature = "diagnostics")] for zero default/release overhead.
  • Lock-free AtomicU64 counters avoid contention, lookup() skips Instant::now() on cached OnceLock::get() hits, HostCreationTimer sits after s.translated()? so host PSO creation time is cleanly separated from shader init/wait time, and timing::report() respects the existing PEAK >= 10 threshold in drained().

Looks good to merge.

<!-- greyfinch-sync:Marvisak/VIctory:review:6075006140 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1571#pullrequestreview-6075006140). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T13:32:24Z. **Review:** APPROVED --- Reviewed and verified `45c29d95` merged locally onto `origin/main` (`63bcca43`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust `1.98.1` MSVC, Windows SDK `10.0.26100.0` `dxil.dll`; synthetic tests only, no game files). ### Verification - `git merge-tree` against `origin/main` (`63bcca43`) and combined with `#1993`: clean. - `cargo xtask policy` (PR head): `182 files ok`. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`, PR head, merged, and combined `#1993 + #1571`): 0 warnings. - `cargo check --locked --release -p victory` (merged): passes cleanly. - **RTX 5090 (merged, default dev & `--release`):** `pipeline::` — **27 passed, 0 failed** in both dev and `--release` (including all 4 `pipeline::timing::tests`). - **RTX 5090 & WARP (`VICTORY_D3D12_DEBUG=1`, `--features diagnostics`, merged):** `pipeline::` — **30 passed, 0 failed** on both adapters. - **Combined `#1993 + #1571` on `63bcca43` (RTX 5090, `VICTORY_D3D12_DEBUG=1`, `--features diagnostics`):** **31 passed, 0 failed**. ### Review Notes - Feature and platform gating are clean: `mod timing` (`crates/victory-gpu/src/pipeline.rs:107-272`) is under `#[cfg(all(windows, any(feature = "diagnostics", test)))]` (keeping non-Windows builds of `pipeline.rs` clean while running the 4 unit tests in default test builds), and all global counters, `shader_lookup` (`:309-313`), `HostCreationTimer` (`crates/victory-gpu/src/pipeline/host.rs:312-320, 360-361`), and worker hooks (`crates/victory-gpu/src/pipeline/make.rs:308-313, 329-330`) stay strictly under `#[cfg(feature = "diagnostics")]` for zero default/release overhead. - Lock-free `AtomicU64` counters avoid contention, `lookup()` skips `Instant::now()` on cached `OnceLock::get()` hits, `HostCreationTimer` sits after `s.translated()?` so host PSO creation time is cleanly separated from shader init/wait time, and `timing::report()` respects the existing `PEAK >= 10` threshold in `drained()`. Looks good to merge.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1571:upstream-pr/1571'
git switch 'upstream-pr/1571'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1571'
git switch 'upstream-pr/1571'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1571'
git switch 'upstream-pr/1571'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1571'
git switch 'main'
git merge --squash 'upstream-pr/1571'
git switch 'main'
git merge --ff-only 'upstream-pr/1571'
git switch 'main'
git merge 'upstream-pr/1571'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!1570
No description provided.