Skip to content

Reduce CPU work preparing GPU submissions - #1800

Open
t90 wants to merge 4 commits into
trustno1-coder:mainfrom
t90:contribute/stutter-fixes-main
Open

t90 wants to merge 4 commits into
trustno1-coder:mainfrom
t90:contribute/stutter-fixes-main

Conversation

@t90

@t90 t90 commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Supersedes #850, which was closed with a request to rebase on current main and open a replacement. Based on d4b5d51702db615bd0aec74a35b042f60ba4cf62.

What it changes

Draw submission allocates a descriptor-heap vector, fill planning repeats work and target lookups, small refresh jobs contend on shared accounting, and independent title-buffer backing allocations serialize unrelated lookups under the registration lock.

Four separate commits:

  • Bind descriptor heaps from stack storage, preserving view/sampler order and resource ownership.
  • Reduce fill-only planning allocations, index writer candidates, capture fill targets during recording, and partition descriptor updates. Preserve current main's placed-fill serving, including its ordering guards; bypass the fill-only fast path when serving can change the selected fills.
  • Claim small refresh work in groups and aggregate its accounting. Preserve upstream's explicit wide-chunk controls.
  • Allocate independent backing outside the global title-buffer registration lock. Revalidate registration identity before publishing, retain retry behavior, and preserve upstream's Card::before OnceLock. Imported/placed-memory paths keep their existing transaction.

This excludes launcher/configuration changes, lighting, facial-data changes, early command-list recycling, and unrelated texture experiments.

How it was tested

  • GPU/profile: RTX 5070, Series S, saved 720p Series S picture mode, DLSS Quality, 4x DLSS frame generation. No new ray-tracing configuration was introduced.
  • Before: Reduce CPU frame-preparation allocations and shadow lock contention #850's earlier combined build had a user-reported reduction in stutter; that was not an isolated or controlled measurement.
  • After: @t90 reports that this rebased combined RC looks good on startup. This is initial gameplay feedback, not full-mission stability validation or a measured FPS gain. No individual commit's performance benefit is claimed.
  • The contribution's five source/test files are byte-identical to the locally built and tested RC files.
  • Optimized diagnostics build passed; CLI help passed.
  • Focused cargo test -p victory-gpu --profile rc --features diagnostics --locked --offline runs: 16 passed, 0 failed, 1 existing test ignored. Filters: host::card_steps::tests, shadow::wide_range_tests, shadow::title_allocation_tests, descriptor_bindings_omit_empty_slots (one test thread).
  • Coverage includes placed-fill serving, copy/fill dependency ordering, actual GPU copies, nested writer ranges, grouped-work exactly-once coverage, unrelated concurrent lookup, replacement of a pending registration, allocation failure/retry, and descriptor ordering.
  • The ignored copy-behind-flight test requires an isolated process and specific relay/card-step settings. The full crate/workspace suites were not run.
  • Shader changes/wave sizes: not applicable; no shader translator changes.

Known baseline checks: unchanged upstream emits five compiler warnings; the asset-policy command fails because unchanged crates/victory-shader/src/emit/lower.rs exceeds its 655360-byte source-file limit. Strict CI is not claimed green. No source/CI lint allowances or policy exemptions were added.

Checked for overlap

AI-assisted implementation and validation; gameplay feedback from @t90.

@github-actions github-actions Bot added pr-performance Pull request: makes it faster or use less memory rendering Missing, black, flickering or corrupted graphics labels Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-performance][rendering] Reduce CPU work preparing GPU submissions Reduce CPU work preparing GPU submissions Nov 29, 2026
@POMXARK

POMXARK commented Nov 29, 2026

Copy link
Copy Markdown

@t90 — ran a full 20-minute gameplay A/B on Windows 11 (RTX 5080 16 GB, Ryzen 7 5700X 8C/16T, 32 GB RAM, Series X 1440p, DLSS Quality + MFG 4x, release build, matched save & switches with VICTORY_FILL_TITLE=1, VICTORY_PLACED_READS=1, VICTORY_CARD_STEPS=2):

Verification

  • Unit tests: title_allocation_tests 3/3 PASS (0.35s), card_steps 10/10 PASS (0.22s).
  • Stability & Visuals: 0 errors over 20 minutes, refused=2, clean visuals across all 16 captured screenshots.

20-minute A/B (matched draw buckets)

Metric Baseline (#1637 + #1633) + PR #1800 Delta
1k–4k draws p50 17.10 FPS (58.5 ms) 17.30 FPS (57.7 ms) +1.2% (-0.8 ms)
4k–7k draws p50 13.60 FPS (73.6 ms) 13.70 FPS (73.1 ms) +0.7% (-0.5 ms)
7k–10k draws p50 10.45 FPS (95.6 ms, 85.8 MB) 9.75 FPS (102.3 ms, 86.7 MB) -6.7% (+6.7 ms)
ALL 3D p50 14.20 FPS (70.3 ms) 14.10 FPS (71.0 ms) -0.7%
Submitting thread med 63.6 ms (plan 1.5, steps 35.6) 67.0 ms (plan 1.8, steps 37.5) +3.4 ms
Frame p95 / >100ms (5s bins) 135.4 ms / 36 135.8 ms / 53 +17 >100ms bins
Peak Shared / WS / Commit 9,723 / 22,518 / 30,886 MB 9,531 / 22,240 / 30,642 MB -244 MB commit

Takeaway

  • In light/mid scenes (1k–4k, 4k–7k), PR Reduce CPU work preparing GPU submissions #1800 was slightly ahead (+0.7% to +1.2%) and trimmed peak Commit by -244 MB with 0 errors.
  • In heavier 7k–10k scenes (at identical ~86 MB/f copy volume), plan (1.5 -> 1.8 ms) and steps (35.6 -> 37.5 ms) were slightly slower (-6.7% FPS, +420 total CPU-seconds) — likely from the per-submission WriterIndex build and 8-way Vec<&Op> bucket allocations in card_steps::take_steps when plan is already fast (~1.5 ms). Reusing scratch buffers for WriterIndex / parts (or gating WriterIndex to higher writer counts) may keep the draw.rs + shadow.rs wins without the heavy-scene regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-performance Pull request: makes it faster or use less memory rendering Missing, black, flickering or corrupted graphics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants