Repository navigation
perf(gpu): textures on time with less CPU: refresh filtering, zero-mip skip, slot checks, plus #697, #666, #661, #654, #684, #797, #614 - #814
Conversation
…ead staging refresh
…check Adapted from trustno1-coder#666 by @Capt-Speed.
…leased Adapted from trustno1-coder#661 by @0xkn0wh3r3.
…idency only Adapted from trustno1-coder#654 by @bakdakonusuruz.
…HADER_OPT=127 measured in the open world; about 13 fps is the 3070 Ti's spot today Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SGw6DM2fQu3WKmCUhFxrrM
…ro-work locks Adapted from trustno1-coder#797 by @Capt-Speed.
… and AVX2 copy diff Adapted from trustno1-coder#614 by @wike1701.
|
Tested in the game: RTX 3090 24 GB (driver 610.88), i9-14900K, Windows 11. Release builds, each of #797, #801, #814 and #816 merged on its own onto main at How: the same frozen save, outdoors on a balcony by the water, about 5,900-6,100 draws a frame (corrected: I first wrote "an interior"). Series S, DLSS Performance, frame generation off, standing still. Each build is started once first as a warm-up (a new build's first start is slow), then the five builds are run in turn, three rounds. Each run is 40 s to settle, then 60 s measured, and the figures are medians of the frame lines. An A/A run of main against itself the same way differed by 2-3%, so smaller differences are noise.
For this PR: no regression, and +2% fps here, which is within noise. Preparing is 0.5 ms lower, also within noise. The texture-refresh gains you measured are CPU-side, and this card-bound scene cannot show them. In this scene the card is about 95% busy, so the frame is the card's. Work saved on the CPU side would show in "preparing" more than in fps. No crashes, device losses or Tested with an AI assistant (Claude Code); results are from this PC. |
|
Ran the victory-gpu library suite at Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by All 470 tests pass with 37 ignored, matching the author's Not tested: an unattended title run, the open-world boat scene, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data. AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
Reuse upload scratch and filter unchanged graphics copies, reduce descriptor lock contention, and let safe constant-buffer transfers stay on the GPU. Keep the optional direct constant-buffer path behind F1. Stabilize static sampler order for reuse of the driver's shader pipelines. Expose DLSS Ultra Performance for Series X with the same ultrawide output and HUD. Ports selected changes from trustno1-coder#548, trustno1-coder#700, trustno1-coder#814, trustno1-coder#740, trustno1-coder#958 and fxceless/victory-fork@9e90746. The source bundle preserves the individual commits and credit.
Return the renderer to the proven ultrawide reflection tree before the submission optimization batch. Add render-only launch tests with the frame-generation proxy absent, and show the DLSS sizes in F3. Prioritize pending and new textures over rechecks, revalidate deferred uploads after GPU writes, and expose an optional larger indirect budget. Based on trustno1-coder#33, trustno1-coder#814, and trustno1-coder#72. The source bundle keeps the individual commits and credit.
|
Thanks @nick0451 for the careful five-way comparison (warm-up, three rounds, an A/A control), and @Aniseto for the test run on a 5070 Ti. nick0451's result matches what we saw in the cutscenes: with the card about 95 % busy, the frame belongs to the card, and the texture work saved on the CPU can't show up as fps. Where it should help is scenes bound by the submitting thread, like the open world on 6-8 core CPUs, and how soon textures arrive (served late and new-memory waits in the description), not the frame rate of a card-bound scene. I'll add a line to the description saying that fps is unchanged where the card is the limit. 🤖 Generated with Claude Code |
Carry the descriptor record used in staging through the list and upload-ahead completion paths. Ignore superseded queue work, alternate new writes with missing-mip retries, and keep complete-upload rechecks moving under the existing budgets. The record validation builds on the work in trustno1-coder#814.
|
Tested on an RTX 4090 24 GB (driver 621.40), i7-13700K, 32 GB RAM, Windows 11 26200. Release builds: main at The four new defaults reach
|
main 63b902f |
this PR, started by the script | |
|---|---|---|
| new-memory waits | 53,000, 17.3 s, longest 1,029 ms | 56,000, 16.5 s, longest 1,275 ms |
| mapping waits | 39,800, 4.1 s | 40,600, 4.1 s |
With VICTORY_WAIT_RESIDENT=textures set, the same route on this PC gives 1,000 to 1,999 waits and 0.7 s (the #654 A/B). Adding the four lines to play-foxhound.ps1 would close the gap.
What the run shows otherwise
Switches off, so this is the unconditional part of the PR only:
- Uploads ahead get through more often: 0.92 turned down per upload on main, 0.49 here. The longest asking-to-there goes from 46 ms to 14 ms, and about 13 % more textures are uploaded in the same 4 minutes.
- No errors and no device loss in either run. I saw no artifacts in the PR run; main had some wall textures missing.
- Frame time: no claim yet. Both builds had cold pipeline caches after a 1-minute warm-up, and both show 200 to 300 ms windows while pipelines were being made. The medians were 44 ms (main) and 39 ms (PR).
I will repeat with warm caches, once as the script starts it and once with the four switches set by hand, and post the numbers here.
VICTORY_WAIT_RESIDENT=textures, VICTORY_DUE_FRESH_FIRST=1, VICTORY_TEXTURE_HASH_EVERY=0 and VICTORY_TEXTURE_HOT_FRAMES=0 were added to SETTINGS in apps/victory/src/play.rs only; the script clears VICTORY_* and sets its own table, so a start through it ran with them off. Reported by @bakdakonusuruz. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @bakdakonusuruz, you're right, and the table makes it clear. Fixed in 1b1de3d: the script's table now has Your switches-off run is still useful: it isolates what the PR does unconditionally (0.92 to 0.49 turned down per upload, longest asking-to-there 46 to 14 ms, about 13 % more textures in the same 4 minutes). I'm looking forward to the warm-cache numbers with the script as it is now. 🤖 Generated with Claude Code |
An AtomicBool beside HostHeap::away, set and cleared under its lock, lets texture_slot_here return at once in the usual case of an empty map. Based on trustno1-coder#1242 by @qlfu (its other two parts, the dense texture queue and Tells batches of 64, are already in this branch through trustno1-coder#797). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request. |
|
Understood, thanks @trustno1-coder. With about 100 pull requests merged today a rebase here would be most of the work anyway. I'll rebase the texture changes onto the current main, run the checks again, and open a new pull request that links back to this one and keeps the credits. 🤖 Generated with Claude Code |
…VERY=0 / HOT_FRAMES=0) Under Proton, skin looked plastic with them off: textures the title rewrites without a guard noticing were never hashed again. No frame-rate difference was measured from them here. Back to the texture.rs defaults (8 and 64).
Conflicts: - watch.rs: trustno1-coder#933's protect_here/protect_run split kept, upstream's soft views parameter passed through both. - shadow.rs: upstream's has_pending and PageMerge landing loop taken (on trustno1-coder#1298's copied tuple); trustno1-coder#1184's lazy landing applied to upstream's outside_sorted_into parts. - pool.rs: trustno1-coder#814's take_from_with (one empty block made ahead) kept; its base is the same trustno1-coder#661 change upstream merged. - card_steps.rs: upstream's taken whole (VICTORY_PLACED_FILLS, trustno1-coder#740); trustno1-coder#1298's card_steps part dropped. - draw.rs: upstream's trustno1-coder#532 values; trustno1-coder#814's cached slot handle kept inside upstream's rest() timing. - descriptor/host.rs: upstream's TextureQueue ordering taken whole; trustno1-coder#814's VICTORY_DUE_FRESH_FIRST and its play.rs default dropped. A test module both sides added was kept once. - emit/mod.rs, send.rs: both sides kept.
perf(gpu): textures on time with less CPU, lock contention, and lock-free refresh filtering
Summary
This branch includes this fork's open #532 (first commit); if this PR is taken, #532 can be closed.
Rebased onto
origin/main(63b902f), this branch combines our texture-streaming and submitting-thread optimizations with community improvements (each credited below). Across warm-cache 130 s runs on an RTX 5080 (1440p, DLSS Quality) + AMD Ryzen 9 5950X, it cuts per-frametexture refreshesfrom 9.4–9.6 ms to 3.0–4.6 ms, cuts textureserved latefrom 2.1–3.0 avg / 58–77 max frames to 0.7–1.2 avg / 23–35 max frames, eliminatesNew memMakeResidentstalls (26–27 logged lines → 0), cutsTextureQueuelock wait by 66% (41 ms → 14 ms per 5 s) andTELLlock acquisitions by 95.6% (19,173 → 839 per 5 s), and lowers submitting-threadpreparingto 25.3–26.5 ms/frame (withrefreshesdown to 7.4–8.3 ms/frame):Frame rate in these cutscenes stays about the same as main (main 23.1–25.1 fps; this branch 21.8–26.1 fps over its runs, within this setup's ±3 fps noise): there the card and the rest of the frame set the pace. The gain is in how soon textures arrive and how little CPU they take; the open world, where textures weigh more, was not reachable unattended. @nick0451's warm three-round test on an RTX 3090 (balcony by the water, card ~95 % busy) agrees: 25.6 fps against main's 25.1, within noise. Where the card is the limit, this PR does not change fps.
59db7fa) —apps/victory/src/play.rs,crates/victory-gpu/src/draw.rs(fromtrustno1-coder/VIctory-NVIDIA#532).nothing_newrefreshes beforeask_aheadandwide_each(e8f7d02) —crates/victory-gpu/src/host.rs: filters out unchanged refreshes in parallel beforewatch::ask_aheadand worker dispatch.a6c9174) —crates/victory-gpu/src/texture.rs: fills linear staging with zero instead of detiling unmapped/zeroed mips, and addsVICTORY_TEXTURE_HASH_EVERYandVICTORY_TEXTURE_HOT_FRAMES.heap.handleper slot and addVICTORY_DUE_FRESH_FIRST(f642186) —crates/victory-gpu/src/draw.rs,crates/victory-gpu/src/descriptor/host.rs.Batch::copy_spansandBatch::refresh_frontstep walks (8653fc3) —crates/victory-gpu/src/host.rs.90f051d) —crates/victory-gpu/src/descriptor/host.rs,crates/victory-gpu/src/draw.rs.5b463d7) —crates/victory-gpu/src/descriptor/host.rs,crates/victory-gpu/src/draw.rs,crates/victory-gpu/src/texture/ahead.rs.bcb4e1f) —crates/victory-gpu/src/host.rs,crates/victory-gpu/src/watch.rs. Adapted fromtrustno1-coder/VIctory-NVIDIA#697by @0xkn0wh3r3.VIEW_SHAPESlock, O(1)FxHashMap, andforget()read-check (74223a5,f88e7d5) —crates/victory-gpu/src/descriptor.rs. Adapted fromtrustno1-coder/VIctory-NVIDIA#666by @Capt-Speed.9ace3a4) —crates/victory-gpu/src/pool.rs. Adapted fromtrustno1-coder/VIctory-NVIDIA#661by @0xkn0wh3r3 (already covers Texture blocks made with the pool's lock let go #683/Staging blocks made with the pool's lock let go #685/Texture and staging blocks made with the pool's lock let go #816).VICTORY_WAIT_RESIDENT=texturesto wait for texture residency only (9f3d869) —crates/victory-gpu/src/host.rs. Adapted fromtrustno1-coder/VIctory-NVIDIA#654by @bakdakonusuruz.AtomicU64bitmask and in-placeretaininfilter_nothing_new(87694c9) —crates/victory-gpu/src/host.rs: replaces per-elementAtomicBool+Arc<Vec<...>>allocation with anAtomicU64bitmask and in-placeretain.victory play(9af8068) —apps/victory/src/play.rs: setsVICTORY_WAIT_RESIDENT=textures,VICTORY_DUE_FRESH_FIRST=1,VICTORY_TEXTURE_HASH_EVERY=0,VICTORY_TEXTURE_HOT_FRAMES=0.2f1dc9c) —crates/victory-gpu/src/pool.rs: spawnsvictory-block-aheadwhenVICTORY_RIPE_BLOCKS=0and no empty texture block remains (VICTORY_BLOCK_AHEAD=0disables). Adapted fromtrustno1-coder/VIctory-NVIDIA#684by @0xkn0wh3r3.TextureQueuelock hold time,TELLfallbacks, and zero-work locks (d80e7c7) —crates/victory-gpu/src/descriptor.rs,crates/victory-gpu/src/descriptor/host.rs,crates/victory-gpu/src/draw.rs: dense 32-byteEntry+FastMap, O(N)select_nth_unstable_by_keyinDue::ordered_with,QueueMarksatomicwrites/has_held,QueueBatch/QueueFlusher,mirror_range, andTells::BATCH = 64. Adapted fromtrustno1-coder/VIctory-NVIDIA#797by @Capt-Speed.3f6ca47) —crates/victory-gpu/src/host.rs,crates/victory-gpu/src/shadow.rs,crates/victory-gpu/src/watch.rs:Shadow::copiedAtomicU64array +JournalRead::nothing_new_atomicinsidefilter_nothing_new,JOURNAL_KEPTatomic fast-path, andHostList::refreshspan coalescing. Adapted fromtrustno1-coder/VIctory-NVIDIA#614by @wike1701.Credits
trustno1-coder/VIctory-NVIDIA#532— texture pass time cap scalingtrustno1-coder/VIctory-NVIDIA#697(@0xkn0wh3r3) — page-scoped write-watch askingstrustno1-coder/VIctory-NVIDIA#666(@Capt-Speed) — splitVIEW_SHAPESlock,FxHashMap,forget()read-checktrustno1-coder/VIctory-NVIDIA#661(@0xkn0wh3r3) — unlocked texture/staging pool block allocation (also covers Texture blocks made with the pool's lock let go #683/Staging blocks made with the pool's lock let go #685/Texture and staging blocks made with the pool's lock let go #816)trustno1-coder/VIctory-NVIDIA#654(@bakdakonusuruz) —VICTORY_WAIT_RESIDENT=texturestrustno1-coder/VIctory-NVIDIA#684(@0xkn0wh3r3) — one empty texture block made ahead (VICTORY_BLOCK_AHEAD)trustno1-coder/VIctory-NVIDIA#797(@Capt-Speed) — denseTextureQueue,QueueMarksfast-paths,QueueFlusher,mirror_rangetrustno1-coder/VIctory-NVIDIA#614(@wike1701) — lock-freenothing_new,JOURNAL_KEPT, thin-worker refresh coalescing(Also re-tested in warm A/B and left out:
trustno1-coder/VIctory-NVIDIA#682by @0xkn0wh3r3 — alternatingVICTORY_AHEAD_BATCH=1vs=16gave 26.1 / 23.7 fps off vs 23.5 / 24.0 fps on,texrf3.0 / 3.4 ms vs 4.3 / 3.8 ms;trustno1-coder/VIctory-NVIDIA#674by @mint17 — 22.9 / 25.4 fps on vs 26.1 / 23.7 fps off,texrf3.7 / 3.8 ms vs 3.0 / 3.4 ms; andtrustno1-coder/VIctory-NVIDIA#801by @mint17 — 21.9 / 21.6 fps with vs 23.3 fps without in our opening-cutscene runs.)Measurements (130 s unattended,
--res 1440 --dlss quality,VICTORY_WARMUP_RESTART=0, Enter keys,0 being madeon all 3D ticks)Environment: Windows 11 (build 26300), RTX 5080, driver 616.92, AMD Ryzen 9 5950X (16 cores, 32 threads).
preparingmedtexrfmedNew memlinesf88e7d5(#682off,BATCH=1) Run 133.7, 31.7, 33.1)f88e7d5(#682off,BATCH=1) Run 334.6, 34.3, 31.5)f88e7d5+#682(BATCH=16) Run 232.8, 34.2, 32.8)f88e7d5+#682(BATCH=16) Run 432.8, 33.2, 29.5)f88e7d5+#674Run 532.8, 30.5, 34.3)f88e7d5+#674Run 631.4, 36.4, 26.8)3f6ca47(#684+#797+#614) Run 1031.1, 35.4, 25.8)3f6ca47(#684+#797+#614) Run 1133.7, 31.3, 32.4)Submitting-thread
preparing per framesteady-state: 28.2–33.0 ms (f88e7d5) → 25.3–26.5 ms (3f6ca47, withrefreshes8.4–10.7 ms → 7.4–8.3 ms).TextureQueuelock per 5 s: 64,302 takes (19,173TELL/ask, 41 ms waited) → 36,163 takes (839TELL/ask, 14 ms waited).Verification
cargo test --workspace --locked→ exit0(all workspace crates passed, includingvictory-gpu470 passed / 0 failed / 37 ignored,victory-shader293 passed / 0 failed,victory-formats49 passed / 0 failed / 2 ignored,victory26+2 passed,victory-core16 passed,xtask6 passed / 0 failed).cargo clippy -p victory-gpu --all-targets --locked -- -D warnings -A clippy::manual_is_multiple_of(and--all-features) → exit0(0 warnings). Workspace-wide clippy hits only the 2 pre-existingorigin/mainlints (crates/victory-gpu/src/shadow.rs:1718manual_is_multiple_ofandcrates/victory-shader/src/emit/mod.rs:2768let_and_return).cargo fmt --all -- --check→ exit1on pre-existing formatting differences.git diff --check→ exit0.What Was Not Tested
test/for-userbuild.Later additions
1b1de3d:scripts/play-foxhound.ps1now sets the four texture defaults thatplay.rshas (VICTORY_WAIT_RESIDENT=textures,VICTORY_DUE_FRESH_FIRST=1,VICTORY_TEXTURE_HASH_EVERY=0,VICTORY_TEXTURE_HOT_FRAMES=0). Reported by @bakdakonusuruz.c92ddc2:texture_slot_hereskips theawaylock when no slot is away. Based on perf(gpu): replace TextureQueue BTreeMap scan with dense vector, add away_nonempty fast-path, bump Tells::BATCH #1242 by @qlfu; its dense texture queue and batches of 64 were already here through perf(gpu): reduce TextureQueue lock hold time, TELL fallbacks, and zero-work locks #797.cargo test -p victory-gpu: 470 passed.AI-assisted. Gemini 4 Hydrogen (Antigravity CLI) wrote the change and ran the checks; Claude Code reviewed it.
🤖 Generated with Claude Code