perf(gpu): cap backlog staging bursts and pace mip-upgrade replacements #626

Open
github-bot wants to merge 1 commit from github-bot/gh-626 into main AGit
Owner

@⁠chefulano on GitHub · 2026-12-05 20:27 UTC · original
chefulano:perf/storm-upload-and-mip-pacing → main · +184 −25 · 3 files · 1 commits · open

During heavy streaming transitions (on_time >= 1024), draw.rs previously unlocked a 3× upload burst (576 MiB / 750 ms per frame on 8 GiB cards) while descriptor/host.rs unconditionally triggered resource::want_level() full-mip replacements on every bound placed texture. In 8 GiB outdoor streaming bursts, that combination produced single-frame texture upload spikes up to 254 MB, pushed staging heaps to 352–592 MB, and caused multi-hundred-millisecond CPU-bound stalls (gpu_wait_ms = 0.0).

This change bounds backlog upload passes and paces mip-upgrade replacements:

  • crates/victory-gpu/src/draw.rs: backlog_upload_budget() keeps on_time >= 1024 capped at 1× (192 MiB / 250 ms on 8 GiB) instead of unlocking 3×, and tightens to 128 MiB / 150 ms whenever live_staging_bytes() >= 128 MiB. Enters MipUpgradeBacklogGuard during non-baking backlog passes and retries deferred mip upgrades via host.texture_slot_later(..., 16) while keeping the existing smaller-mip host copy visible.
  • crates/victory-gpu/src/descriptor/host.rs & crates/victory-gpu/src/resource.rs: placed_texture_paced() + want_level_paced() pace full-mip replacements (<= 16/frame during backlog, paused while live_staging_bytes() >= 128 MiB), never deferring first-time allocations (made.is_none()) or copy-origin textures.

Live measurements (8 GiB RX 7600 XT, Linux RADV + vkd3d-proton, 4-minute outdoor streaming route)

  • Eliminated 254 MB single-frame upload spikes during the 115–130 s outdoor streaming burst.
  • Reduced staging peak/held footprint by -96 to -112 MB (352–400 / 266–319 MB -> 256–288 / 163–232 MB).
  • Raised worst-arm MemAvailable headroom by +162 MiB (753.8 -> 915.9 MiB).
  • Improved unaliased streaming trough (120–125 s) by +0.80 FPS (8.50 -> 9.30 FPS) and late-world (150–240 s) by +0.56 FPS (24.81 -> 25.36 FPS).
    (Measured on an integrated test build; unit tests below directly cover the standalone budget and mip-pacing rules on main.)

Queue check

  • Independent of #543 (VICTORY_SMALL_BACKLOG, which makes first-time copies small-first rather than bounding backlog upload bursts and full-mip upgrade replacements).

Checks

  • cargo xtask policy — pass (368 files ok)
  • cargo check --locked --release --target x86_64-pc-windows-msvc -p victory-gpu -p victory --tests (default and --features diagnostics) — pass
  • cargo clippy --no-deps --locked --release --target x86_64-pc-windows-msvc -p victory-gpu --all-targets — 0 new warnings
  • PKG=victory-gpu ./build.sh test --lib -- backlog_upload_budget_caps_storm_burst_and_high_staging — 1/1 passed
  • PKG=victory-gpu ./build.sh test --lib -- mip_upgrade_pacing_caps_backlog_and_high_staging — 1/1 passed
  • Cost: full-mip upgrades during active backlogs or >= 128 MiB live staging take a few extra frames to step up while keeping the lower-mip copy shown.

Created with Gemini 4 Neon in T3 Code.

**@⁠chefulano** on GitHub · 2026-12-05 20:27 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/626) `chefulano:perf/storm-upload-and-mip-pacing` → `main` · +184 −25 · 3 files · 1 commits · open During heavy streaming transitions (`on_time >= 1024`), `draw.rs` previously unlocked a 3× upload burst (`576 MiB / 750 ms` per frame on 8 GiB cards) while `descriptor/host.rs` unconditionally triggered `resource::want_level()` full-mip replacements on every bound placed texture. In 8 GiB outdoor streaming bursts, that combination produced single-frame texture upload spikes up to 254 MB, pushed staging heaps to 352–592 MB, and caused multi-hundred-millisecond CPU-bound stalls (`gpu_wait_ms = 0.0`). This change bounds backlog upload passes and paces mip-upgrade replacements: - `crates/victory-gpu/src/draw.rs`: `backlog_upload_budget()` keeps `on_time >= 1024` capped at 1× (`192 MiB / 250 ms` on 8 GiB) instead of unlocking 3×, and tightens to `128 MiB / 150 ms` whenever `live_staging_bytes() >= 128 MiB`. Enters `MipUpgradeBacklogGuard` during non-baking backlog passes and retries deferred mip upgrades via `host.texture_slot_later(..., 16)` while keeping the existing smaller-mip host copy visible. - `crates/victory-gpu/src/descriptor/host.rs` & `crates/victory-gpu/src/resource.rs`: `placed_texture_paced()` + `want_level_paced()` pace full-mip replacements (`<= 16/frame` during backlog, paused while `live_staging_bytes() >= 128 MiB`), never deferring first-time allocations (`made.is_none()`) or copy-origin textures. ### Live measurements (8 GiB RX 7600 XT, Linux RADV + vkd3d-proton, 4-minute outdoor streaming route) - Eliminated `254 MB` single-frame upload spikes during the `115–130 s` outdoor streaming burst. - Reduced staging peak/held footprint by `-96 to -112 MB` (`352–400 / 266–319 MB` -> `256–288 / 163–232 MB`). - Raised worst-arm `MemAvailable` headroom by `+162 MiB` (`753.8` -> `915.9 MiB`). - Improved unaliased streaming trough (`120–125 s`) by `+0.80 FPS` (`8.50` -> `9.30 FPS`) and late-world (`150–240 s`) by `+0.56 FPS` (`24.81` -> `25.36 FPS`). *(Measured on an integrated test build; unit tests below directly cover the standalone budget and mip-pacing rules on `main`.)* ### Queue check - Independent of #543 (`VICTORY_SMALL_BACKLOG`, which makes first-time copies small-first rather than bounding backlog upload bursts and full-mip upgrade replacements). ### Checks - `cargo xtask policy` — pass (`368 files ok`) - `cargo check --locked --release --target x86_64-pc-windows-msvc -p victory-gpu -p victory --tests` (default and `--features diagnostics`) — pass - `cargo clippy --no-deps --locked --release --target x86_64-pc-windows-msvc -p victory-gpu --all-targets` — 0 new warnings - `PKG=victory-gpu ./build.sh test --lib -- backlog_upload_budget_caps_storm_burst_and_high_staging` — 1/1 passed - `PKG=victory-gpu ./build.sh test --lib -- mip_upgrade_pacing_caps_backlog_and_high_staging` — 1/1 passed - Cost: full-mip upgrades during active backlogs or `>= 128 MiB` live staging take a few extra frames to step up while keeping the lower-mip copy shown. Created with Gemini 4 Neon in T3 Code.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 20:30:35 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/626/head:github-bot/gh-626'
git switch 'github-bot/gh-626'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-626'
git switch 'github-bot/gh-626'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-626'
git switch 'github-bot/gh-626'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-626'
git switch 'main'
git merge --squash 'github-bot/gh-626'
git switch 'main'
git merge --ff-only 'github-bot/gh-626'
git switch 'main'
git merge 'github-bot/gh-626'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.