Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/814"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by henriazz10 on 2026-11-28T06:47:44Z.
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 #683/#685/#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 #683/#685/#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 #1242 by @qlfu; its dense texture queue and batches of 64 were already here through #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
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nick0451 on 2026-11-28T09:21:39Z.
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
63b902f.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.
63b902fFor 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
ERRORlines in any build: about 7 minutes in the world each, warm-up included.Tested with an AI assistant (Claude Code); results are from this PC.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Aniseto on 2026-11-28T09:38:52Z.
Ran the victory-gpu library suite at
3f6ca47on an NVIDIA Blackwell desktop part: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
rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build.All 470 tests pass with 37 ignored, matching the author's
victory-gpucount. These are CPU-side tests; the frame-time and texture-latency numbers from the description need a title run and were not reproduced. The thread has runs on RTX 5080 and RTX 3090, but no 5070 Ti.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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by henriazz10 on 2026-11-28T12:51:52Z.
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
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by bakdakonusuruz on 2026-11-28T14:29:08Z.
Tested on an RTX 4090 24 GB (driver 621.40), i7-13700K, 32 GB RAM, Windows 11 26200. Release builds: main at
63b902fand this PR at3f6ca47, each in its own worktree with its own cache folder. Series X at 2560x1440, DLSS balanced, frame generation on. Route: a new game, the first 4 minutes of gameplay, stopped by a script.The four new defaults reach
victory playonly, not the script launcher9af8068addsVICTORY_WAIT_RESIDENT=textures,VICTORY_DUE_FRESH_FIRST=1,VICTORY_TEXTURE_HASH_EVERY=0andVICTORY_TEXTURE_HOT_FRAMES=0toSETTINGSinapps/victory/src/play.rs.scripts\play-foxhound.ps1clears theVICTORY_*switches left in the window and sets its own table, and that table does not get the four (no hit for any of them inscripts\or the.cmdfiles). So a start through the script runs this PR's code with its new switches off. The comment overSETTINGSsays the script "has the same"; after this PR it does not.I start through
play-foxhound.ps1, and the run shows it. The launcher's log lists 63 switches and none of the four, and the new-memory waits stay where main has them:63b902fWith
VICTORY_WAIT_RESIDENT=texturesset, 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 toplay-foxhound.ps1would close the gap.What the run shows otherwise
Switches off, so this is the unconditional part of the PR only:
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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by henriazz10 on 2026-11-28T16:22:49Z.
Thanks @bakdakonusuruz, you're right, and the table makes it clear.
play-foxhound.ps1clears theVICTORY_*switches and sets its own table, so a start through the script ran this PR with the four new defaults off.Fixed in
1b1de3d: the script's table now hasVICTORY_WAIT_RESIDENT=textures,VICTORY_DUE_FRESH_FIRST=1,VICTORY_TEXTURE_HASH_EVERY=0andVICTORY_TEXTURE_HOT_FRAMES=0, the same values asSETTINGSinplay.rs. The script still parses, and nothing else in it changed.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
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-28T19:23:18Z.
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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by henriazz10 on 2026-11-28T19:41:37Z.
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
Pull request closed