WIP: Opt-in GPU-upload constants, GPU-local view metadata and window-cache trim; table-copy snapshot fixes #597

Draft
deama wants to merge 20 commits from deama/Darner:pr/4-table-snapshots-constants 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: read from the code, and from the VIctory branch's profiling of PCIe demand reads for small constant and metadata buffers.

Five commits, all behind switches that are off by default:

  • Restore mutable sources of cached GPU table snapshots before submission

  • Grow table snapshot buffers with actual recording use

  • Add bounded GPU-upload storage for ordered constant snapshots

  • Retire unreferenced read-only window caches under local memory pressure

  • Add bounded opt-in GPU-local view metadata with upload fallback

  • DARNER_TABLE_COPY=2 (off by default): a card-written window that a later-recorded but earlier-sent list declared written is restored to its source before submission. Snapshot buffers grow with what a recording actually uses instead of reserving the full ring.

  • DARNER_GPU_CONSTANTS=1: table constant snapshots go to GPU-upload heap pages (64 MiB process limit, 64 KiB pages, a local-budget margin), with the existing scratch path as the fallback.

  • DARNER_WINDOW_CACHE_TRIM=1: unreferenced read-only window caches are retired when local memory is short.

  • DARNER_GPU_VIEW_METADATA=1: the stride and view-address table lives in GPU-local memory, with the upload buffer as the fallback.

How it was tested

  • Tested revision: 64bdec5b15
  • Commands and results: on 64bdec5b15 (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): 67 failed: the same 66 as on unmodified main (c8258f9556), which need Shader Model 6.6, plus console_insn::tests::clzero_on_a_guarded_line_goes_through_the_guard in darner-loader. This branch does not touch the loader, the test passed on the next branch (which contains this one), and the darner-loader suite failed 1 run in 6 on unmodified main here, so it looks flaky.
    • 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; 22 new tests: 7 ignored, 15 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: no.
  • A/B result: not applicable. The switches are off by default; they were checked by the unit tests above only.
  • Gates run on that revision: see above.
  • Gameplay: not run on Darner.
  • Hardware dependence: GPU-upload heaps need a card and driver that report GPUUploadHeapSupported (an RTX 4080 did on the VIctory branch). Others fall back.
  • Coverage gaps: no in-game run, and no frame-time measurement on Darner.

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: four related opt-in memory placements, stacked on the PRs below.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on #594 (needs its validation and test wiring)
    • Depends on #596 (stacked branch)

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #512 (builder view pages and read-only arena eviction; different memory), #219 (view guards and overflow aliases).
  • 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: read from the code, and from the VIctory branch's profiling of PCIe demand reads for small constant and metadata buffers. Five commits, all behind switches that are off by default: - Restore mutable sources of cached GPU table snapshots before submission - Grow table snapshot buffers with actual recording use - Add bounded GPU-upload storage for ordered constant snapshots - Retire unreferenced read-only window caches under local memory pressure - Add bounded opt-in GPU-local view metadata with upload fallback - `DARNER_TABLE_COPY=2` (off by default): a card-written window that a later-recorded but earlier-sent list declared written is restored to its source before submission. Snapshot buffers grow with what a recording actually uses instead of reserving the full ring. - `DARNER_GPU_CONSTANTS=1`: table constant snapshots go to GPU-upload heap pages (64 MiB process limit, 64 KiB pages, a local-budget margin), with the existing scratch path as the fallback. - `DARNER_WINDOW_CACHE_TRIM=1`: unreferenced read-only window caches are retired when local memory is short. - `DARNER_GPU_VIEW_METADATA=1`: the stride and view-address table lives in GPU-local memory, with the upload buffer as the fallback. ## How it was tested - Tested revision: `64bdec5b15` - Commands and results: on `64bdec5b15` (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): 67 failed: the same 66 as on unmodified `main` (c8258f9556), which need Shader Model 6.6, plus `console_insn::tests::clzero_on_a_guarded_line_goes_through_the_guard` in darner-loader. This branch does not touch the loader, the test passed on the next branch (which contains this one), and the darner-loader suite failed 1 run in 6 on unmodified `main` here, so it looks flaky. - 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; 22 new tests: 7 ignored, 15 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: no. - A/B result: not applicable. The switches are off by default; they were checked by the unit tests above only. - Gates run on that revision: see above. - Gameplay: not run on Darner. - Hardware dependence: GPU-upload heaps need a card and driver that report `GPUUploadHeapSupported` (an RTX 4080 did on the VIctory branch). Others fall back. - Coverage gaps: no in-game run, and no frame-time measurement on Darner. ## 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:** four related opt-in memory placements, stacked on the PRs below. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on #594 (needs its validation and test wiring) - Depends on #596 (stacked branch) ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #512 (builder view pages and read-only arena eviction; different memory), #219 (view guards and overflow aliases). - 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]>
TrustNo1 changed title from WIP: [pr-performance][memory] Opt-in GPU-upload constants, GPU-local view metadata and window-cache trim; table-copy snapshot fixes to WIP: Opt-in GPU-upload constants, GPU-local view metadata and window-cache trim; table-copy snapshot fixes 2026-12-06 03:26:40 +00:00
This pull request has changes conflicting with the target branch.
  • crates/darner-game/src/lib.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
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/4-table-snapshots-constants:deama-pr/4-table-snapshots-constants'
git switch 'deama-pr/4-table-snapshots-constants'

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/4-table-snapshots-constants'
git switch 'deama-pr/4-table-snapshots-constants'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'deama-pr/4-table-snapshots-constants'
git switch 'deama-pr/4-table-snapshots-constants'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'deama-pr/4-table-snapshots-constants'
git switch 'Main'
git merge --squash 'deama-pr/4-table-snapshots-constants'
git switch 'Main'
git merge --ff-only 'deama-pr/4-table-snapshots-constants'
git switch 'Main'
git merge 'deama-pr/4-table-snapshots-constants'
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!597
No description provided.