WIP: Sampled GPU timing, refresh profiling, native draw markers and binding/root/shader-source observation; per-list timing opt-in #599

Draft
deama wants to merge 40 commits from deama/Darner:pr/6-gpu-diagnostics into Main
First-time contributor

Not run in the game on Darner. Ported from a local VIctory-NVIDIA branch (before the rename). The notes below describe that branch.

Contributor role (optional)

  • Fluxer ID:

What it changes

  • The problem on main: per-binding timestamps changed the measured frame noticeably on the VIctory branch, and several costs (refresh flushes, argument clamps, title barriers, root-layout changes) had no measurement.

Thirteen commits, mostly opt-in diagnostics:

  • Restore sampled GPU timing with weighted current-renderer reports

  • Make detailed GPU timing opt-in for ordinary builds

  • Profile every refresh flush and report PC-backed windows separately

  • Include submission-front work in refresh profiling

  • Measure argument clamp GPU cost with optional weighted sampling

  • Measure title barrier submissions with optional weighted GPU samples

  • Clarify timestamp limits and time the barrier-group fallback

  • Identify slow buffer and texture refresh updates with bounded diagnostics

  • Label native draw and dispatch ranges for external GPU profiling

  • Observe bounded prepared shader bindings and allocation properties

  • Avoid republishing unchanged descriptor metadata without skipping record validation

  • diagnostics: capture selected shader sources before pipeline exclusions

  • diagnostics: measure root layout changes before user-data transport changes

  • DARNER_CARD_METER_SAMPLE=N: per-pipeline timings sample one binding in N, chosen by hash, with inverse-probability weights and sub-microsecond time kept. Whole-list timings stay unsampled.

  • Per-list detailed GPU timing becomes opt-in in ordinary builds (no per-list timestamp and resolve commands unless asked for). Diagnostics builds keep it on, and an explicit 0 wins.

  • DARNER_REFRESH_PROFILE: every refresh flush profiled, PC-backed windows reported separately, submission-front work included, and the eight slowest buffer and texture updates per path kept.

  • DARNER_CLAMP_SAMPLE / _TIMES and DARNER_TITLE_BARRIER_SAMPLE / _TIMES: weighted GPU cost of argument clamps and title barriers, plus the barrier-group fallback.

  • DARNER_GPU_MARKERS=1: native draw and dispatch ranges labelled ("Darner / dispatch / ...") for external GPU profilers (docs/gpu-markers.md).

  • DARNER_BIND_PROFILE, DARNER_ROOT_PROFILE and DARNER_SHADER_CAPTURE: bounded observation of prepared bindings and allocation properties, root-layout changes, and the sources of selected shaders before pipeline exclusions.

  • DARNER_METADATA_WRITE_CACHE (on by default): an unchanged stride or view-address word is not written to the metadata buffer again. Record validation still runs every time, and GPU_UPLOAD mappings are never read. Main's view-start rewrite count is kept.

How it was tested

  • Tested revision: 6ec982b160
  • Commands and results: on 6ec982b160 (this branch's head), Windows 10 22H2 with its built-in Direct3D 12 (no Shader Model 6.6), Rust 1.98.1:
    • cargo clippy --workspace --all-targets --locked -- -D warnings: passed
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed
    • cargo --config 'profile.test.package.darner-shader.opt-level=3' test --workspace --locked --no-fail-fast (the opt-level only speeds up darner-shader's exhaustive float tests): 66 failed, all of which fail on unmodified main (c8258f9556) on this PC too (darner-shader tests that need Shader Model 6.6).
    • darner-gpu's test process aborts at the first test that needs Shader Model 6.6, on main too, so its tests were run in batches that survive the abort and compared one by one with main (main: 1658 pass, 8 fail, 139 need Shader Model 6.6, 81 ignored): no test that passes on main fails here, none removed; 54 new tests: 19 ignored, 35 pass.
    • cargo xtask policy: ok on the PR 8 head, which contains this branch.
    • Not run: tests that need Shader Model 6.6 or a GPU, and the strict-WARP tests behind the diagnostics/gpu-validation features.
  • Changes a default: yes, two: per-list GPU timing off in ordinary builds, and the metadata write cache on, for everyone.
  • A/B result: none on Darner. The original timing commit calls its one 20.6 fps trial preliminary. The original write-cache commit has no measurement.
  • Gates run on that revision: see above.
  • Gameplay: not run on Darner.
  • Hardware dependence: likely general.
  • Coverage gaps: no in-game run. The two default changes need an A/B before merging, per CONTRIBUTING.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only). Not run in the game on Darner.
  • This PR contains one change based on main. No: a set of diagnostics plus two default changes, stacked on the PRs below.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on #598 (stacked branch; the clamp and root profiling measure code from #598 and #597; contains #594 and #596 too)

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #555 (profile a single shader hash without timing every pipeline: a different way to cut timing overhead), #164 (NVIDIA shader heap profile).
  • Replaces or overlaps: none found
**Not run in the game on Darner.** Ported from a local VIctory-NVIDIA branch (before the rename). The notes below describe that branch. ## Contributor role (optional) - Fluxer ID: ## What it changes - The problem on main: per-binding timestamps changed the measured frame noticeably on the VIctory branch, and several costs (refresh flushes, argument clamps, title barriers, root-layout changes) had no measurement. Thirteen commits, mostly opt-in diagnostics: - Restore sampled GPU timing with weighted current-renderer reports - Make detailed GPU timing opt-in for ordinary builds - Profile every refresh flush and report PC-backed windows separately - Include submission-front work in refresh profiling - Measure argument clamp GPU cost with optional weighted sampling - Measure title barrier submissions with optional weighted GPU samples - Clarify timestamp limits and time the barrier-group fallback - Identify slow buffer and texture refresh updates with bounded diagnostics - Label native draw and dispatch ranges for external GPU profiling - Observe bounded prepared shader bindings and allocation properties - Avoid republishing unchanged descriptor metadata without skipping record validation - diagnostics: capture selected shader sources before pipeline exclusions - diagnostics: measure root layout changes before user-data transport changes - `DARNER_CARD_METER_SAMPLE=N`: per-pipeline timings sample one binding in N, chosen by hash, with inverse-probability weights and sub-microsecond time kept. Whole-list timings stay unsampled. - **Per-list detailed GPU timing becomes opt-in in ordinary builds** (no per-list timestamp and resolve commands unless asked for). Diagnostics builds keep it on, and an explicit `0` wins. - `DARNER_REFRESH_PROFILE`: every refresh flush profiled, PC-backed windows reported separately, submission-front work included, and the eight slowest buffer and texture updates per path kept. - `DARNER_CLAMP_SAMPLE` / `_TIMES` and `DARNER_TITLE_BARRIER_SAMPLE` / `_TIMES`: weighted GPU cost of argument clamps and title barriers, plus the barrier-group fallback. - `DARNER_GPU_MARKERS=1`: native draw and dispatch ranges labelled ("Darner / dispatch / ...") for external GPU profilers (`docs/gpu-markers.md`). - `DARNER_BIND_PROFILE`, `DARNER_ROOT_PROFILE` and `DARNER_SHADER_CAPTURE`: bounded observation of prepared bindings and allocation properties, root-layout changes, and the sources of selected shaders before pipeline exclusions. - **`DARNER_METADATA_WRITE_CACHE` (on by default):** an unchanged stride or view-address word is not written to the metadata buffer again. Record validation still runs every time, and GPU_UPLOAD mappings are never read. Main's view-start rewrite count is kept. ## How it was tested - Tested revision: `6ec982b160` - Commands and results: on `6ec982b160` (this branch's head), Windows 10 22H2 with its built-in Direct3D 12 (no Shader Model 6.6), Rust 1.98.1: - `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passed - `cargo --config 'profile.test.package.darner-shader.opt-level=3' test --workspace --locked --no-fail-fast` (the opt-level only speeds up darner-shader's exhaustive float tests): 66 failed, all of which fail on unmodified `main` (c8258f9556) on this PC too (darner-shader tests that need Shader Model 6.6). - darner-gpu's test process aborts at the first test that needs Shader Model 6.6, on `main` too, so its tests were run in batches that survive the abort and compared one by one with `main` (`main`: 1658 pass, 8 fail, 139 need Shader Model 6.6, 81 ignored): no test that passes on `main` fails here, none removed; 54 new tests: 19 ignored, 35 pass. - `cargo xtask policy`: ok on the PR 8 head, which contains this branch. - Not run: tests that need Shader Model 6.6 or a GPU, and the strict-WARP tests behind the diagnostics/gpu-validation features. - Changes a default: yes, two: per-list GPU timing off in ordinary builds, and the metadata write cache on, for everyone. - A/B result: **none on Darner.** The original timing commit calls its one 20.6 fps trial preliminary. The original write-cache commit has no measurement. - Gates run on that revision: see above. - Gameplay: not run on Darner. - Hardware dependence: likely general. - Coverage gaps: no in-game run. The two default changes need an A/B before merging, per CONTRIBUTING. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). **Not run in the game on Darner.** - [ ] This PR contains one change based on `main`. **No:** a set of diagnostics plus two default changes, stacked on the PRs below. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on #598 (stacked branch; the clamp and root profiling measure code from #598 and #597; contains #594 and #596 too) ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #555 (profile a single shader hash without timing every pipeline: a different way to cut timing overhead), #164 (NVIDIA shader heap profile). - Replaces or overlaps: none found
Ported to Darner from VIctory-NVIDIA b1443849.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Refuse unsupported strict/software requests, retain bounded validation history, and guard host queue submissions. Preserve removal reports in a dedicated module. Add software-only regressions and optional link-time Agility declarations for tests.

Ported to Darner from VIctory-NVIDIA 3f156266.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rebuild per-recording caches at both cut sites while retaining descriptor ownership. The current-renderer WARP regression read recycled 0xdeadbeef data before the fix and the expected constants after it; same-part and internal-pass reuse remain intact.

Ported to Darner from VIctory-NVIDIA 615e070f.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep current size classes and retention accounting while checking rounding and CPU-visible limits. Cap mapped-VRAM staging and avoid oversized spare reuse. Optional one-pass predictions outside the limit fall back to ordinary staging; six focused CPU checks pass.

Ported to Darner from VIctory-NVIDIA f7f0f1ec.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reconcile the legacy transition repair with the current memory wrappers and enhanced barriers. Strict WARP catches the previous invalid COPY_DEST-to-CBV use before submission. Constant, texture-source, cross-buffer and overlapping-copy regressions pass with legacy and enhanced barriers.

Ported to Darner from VIctory-NVIDIA 0e7a5c71.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Route relay fetches, card fetches and settling through the existing checked host wait. CPU regressions reject failed waits, incomplete fences and device-removal sentinels; a strict WARP copy/readback check still passes.

Ported to Darner from VIctory-NVIDIA bb4da85e.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The current compiled root signature omitted DATA_VOLATILE. A software regression checks that contract and reads both successive synthetic depth values through the same bound descriptor.

Ported to Darner from VIctory-NVIDIA 838504a0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep readonly depth plus shader-read states legal across views and avoid narrowing an already-compatible state. Preserve alias/read-watch observers and exact transitions for writes and COMMON. The WARP fixture goes from two tracked transitions to none; it and the CPU state checks pass. No game FPS result asserted.

Ported to Darner from VIctory-NVIDIA a04c61e1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first guarded rework run stopped on 1024 stored cache-miss warnings rather than a GPU error. Filter only nonfatal severities in strict storage while retaining bounded, persistent errors and corruption. Software tests cover 6144 nonfatal messages followed by both fatal severities, real overflow, repeated refusal and concurrent reporting.

Ported to Darner from VIctory-NVIDIA 651f2399.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 3c6511be.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA fae572a0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA eaee9c79.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA af64880d.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reuse the previously verified pose implementation and background desktop/audio setup. Restore optional frame captures and their output policy, guarded process supervision, and benchmark analysis. Keep normal play opt-in and all artifacts outside source. Pose, capture, desktop-refusal, analyzer and CPU-only watchdog checks pass.

Ported to Darner from VIctory-NVIDIA 90df996f.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 0493d6cb.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA e744607a.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 49ce022d.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 42aa3f0f.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 4dee6a3b.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 6edfc508.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA fc34fb12.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 32f7ae60.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA e7d26434.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adapted from lobomfz/VIctory-xmem fd19a20614b5e080b4bf6211ac5b7ebda682afc9 by lucalocastro. Preserve the existing alias-aware passes and default 447; add bit 512 with CPU graph and strict software DXIL execution coverage.

Ported to Darner from VIctory-NVIDIA fb5a0c84.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep guarded reads and zero-trip paths unchanged, reject every loop write, barrier, unknown effect and volatile read, and preserve the existing 447 defaults. Cover control-flow placement and exact software-rendered output; no frame-rate gain claimed.

Ported to Darner from VIctory-NVIDIA c56196e2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA b194f581.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA f1d91c6e.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Per-binding timestamps substantially disturbed the measured frame. Restore hashed optional sampling, retain fractional time in nanoseconds and preserve sample weights through query resolution. Whole-list and class timings remain unsampled. CPU selection/accounting and actual WARP query resolution pass. Escape existing synthetic fixture control bytes without changing their values.

Ported to Darner from VIctory-NVIDIA 2b101942.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Avoid per-list timestamp and resolve commands unless requested. Diagnostic builds retain timing by default; explicit zero overrides profiling requests. Software checks cover ordinary rendering without timing and requested sampled query resolution. Unavailable benchmark timing columns remain empty; the measured 20.6 FPS trial is preliminary, not the performance target.

Ported to Darner from VIctory-NVIDIA 221418ef.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 36a0340c.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 9bf82ffe.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA a7c1b507.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 18d50d22.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 631af449.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep profiling opt-in and read-only. Retain eight slow updates per path with cached copy metadata, separate elapsed sums by update type, and test bounded concurrent collection plus the disabled metadata contract. No allocation, copy, ordering or graphics-policy change.

Ported to Darner from VIctory-NVIDIA 3e34f76e.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA b195d4d6.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 43586387.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 37b1ea40.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 88f4b130.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 2995305f.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
TrustNo1 changed title from WIP: [pr-diagnostics] Sampled GPU timing, refresh profiling, native draw markers and binding/root/shader-source observation; per-list timing opt-in to WIP: Sampled GPU timing, refresh profiling, native draw markers and binding/root/shader-source observation; per-list timing opt-in 2026-12-06 03:26:35 +00:00
This pull request has changes conflicting with the target branch.
  • crates/darner-game/src/lib.rs
  • crates/darner-gpu/src/cardmeter.rs
  • crates/darner-gpu/src/draw.rs
  • crates/darner-gpu/src/gpu_owned.rs
  • crates/darner-gpu/src/host.rs
  • crates/darner-gpu/src/host/bus.rs
  • crates/darner-gpu/src/host/upq.rs
  • crates/darner-shader/src/emit/mod.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'pr/6-gpu-diagnostics:deama-pr/6-gpu-diagnostics'
git switch 'deama-pr/6-gpu-diagnostics'

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 'deama-pr/6-gpu-diagnostics'
git switch 'deama-pr/6-gpu-diagnostics'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'deama-pr/6-gpu-diagnostics'
git switch 'deama-pr/6-gpu-diagnostics'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'deama-pr/6-gpu-diagnostics'
git switch 'Main'
git merge --squash 'deama-pr/6-gpu-diagnostics'
git switch 'Main'
git merge --ff-only 'deama-pr/6-gpu-diagnostics'
git switch 'Main'
git merge 'deama-pr/6-gpu-diagnostics'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
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.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!599
No description provided.