[pr-performance][pr-fix][textures] Prioritize missing/fresh textures over speculative rechecks (7:1 newest bias), lift park VRAM target under live FrameGen, and fix park_report argument order #528
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!528
Loading…
Reference in a new issue
No description provided.
Delete branch "(deleted):pr/texture-streaming-priority-and-park-vram"
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?
Contributor role (optional)
What it changes
The problem on main:
crates/darner-gpu/src/descriptor/host.rs(Due::ordered_with): WithDARNER_SAMPLED_MARKS=0(on by default),hot_slot()always returnsfalse, sohotis empty. All remainingagainentries — including 3,966–7,278 already-uploaded textures queued only for speculativeFLAG_CHECKEDfingerprint rechecks (checked_pos != NO_CHECKED) — were served before brand-new un-uploadedfreshtextures. Furthermore,freshinterleaved 1:1 newest-to-oldest (top_n = need.div_ceil(2),bot_n = need / 2), spending half of every frame's upload budget on stale entries (observed up to13,902 frames agoin a 6-minute run) instead of recently written near-player textures.crates/darner-gpu/src/pool.rs(park_card_target_with_buffers):resource::room_line_forstops double-countingDARNER_FRAMEGEN_ROOM_RESERVEon>= 13 GiBGPUs onceframegen_live()is true (since FrameGen's ~1.5–2 GiB allocation is already included in DXGIused), butpool::park_card_target_with_bufferslacked that adjustment. On an RTX 5070 Ti (14,056 MBDXGI budget),park_card_target()stayed stuck at11,245 MB(80%) with >2.1 GiB of GDDR7 unused, forcing 3,391–4,077 newly streamed textures (1,408 MB) into PC shared RAM over PCIe and spiking GPU frame time to23.8 ms.crates/darner-gpu/src/pool.rs(park_report): The format argumentscard_refused, held, out_n, mb(out_bytes), back_n, mb(back_bytes)were shifted relative to the format string placeholders (moves (DARNER_TEX_PARK=2): card copies parked {} ({} MB), parked copies brought back to the card {} ({} MB); slot makes refused for card room {} (the aim: 0), slots held {} (the aim: 0)), printingDARNER_TEX_PARK=2counters in the wrong fields.What this does:
againinDue::ordered_withintomissing_again(checked_pos == NO_CHECKED) andchecked_rechecks(checked_pos != NO_CHECKED), serving: (1)texres=2recheck share &hotmissing/fresh (unchanged) -> (2)missing_again(newest write first) -> (3)freshat a 7:1 newest-to-oldest ratio (FRESH_OLD_DIVISOR = 8,emit_fresh_interleaved, keeping a 12.5% anti-starvation tail) -> (4)checked_recheckslast (newest write first).park_target_with_framegen_live, mirroringresource::room_line_for(normal.saturating_sub(512 << 20)onbudget >= PARK_LESS_BIGonceframegen_live()is true, respectingDARNER_FRAMEGEN_LIVE_ROOMand explicitDARNER_TEX_PARK_CARD_MB). On an RTX 5070 Ti (14,138 MBbudget), this liftspark_card_targetfrom11,245 MBto12,858 MB.park_reportarguments toout_n, mb(out_bytes), back_n, mb(back_bytes), card_refused, held.How it was tested
Tested revision:
c8258f9+ this PR (2a58622locally /253e220on fork)Commands and results:
cargo xtask policy:576 files okcargo clippy --locked -p darner-gpu --all-targets -- -D warnings: 0 warningscargo clippy --locked -p darner-gpu --all-features --all-targets -- -D warnings: 0 warningscargo test --locked -p darner-gpu -- --skip oracle64:1,807 passed; 0 failed; 81 ignored(including newmissing_fresh_textures_precede_checked_rechecks_and_bias_newest&park_target_lifts_once_framegen_is_live_on_big_cards, plus updateddue_ordered_truncation_matches_full_sort,hot_missing_textures_precede_checked_rechecks, andthe_texture_queue_serves_the_newest_writes_first).Changes a default: yes —
Due::ordered_withordering affects all runs;park_target_with_framegen_liveaffects>= 13 GiBGPUs withDARNER_TEX_PARKand live FrameGen;park_reportchanges diagnostic log formatting only.A/B telemetry note: Full gameplay runs (
darner-play-20261205-063041-36996.log->darner-play-20261205-071246-19076.log, ~30k frames each) also changed runtime switches (DARNER_TEX_PARK=2,DARNER_POOL_TRIM=1,DARNER_PAGE_DEAD_S=15,DARNER_DUE_INDEX=1,DARNER_TEXSPK_PASS_MS=16, removedDARNER_PRESENT_SENT=1) and included PR #332 drain tuning, so whole-run FPS (23.1 -> 26.8median FPS,5.7 -> 20.5min FPS) reflects the combined setup; isolated per-subsystem counters directly attributable to this PR:1080to1440, DLSS Quality + MFG 3x, High textures)063041)071246)park_card_targetunder live MFG11,245 MB(14,056 MBbudget)12,858 MB(14,138 MBbudget)3,391–4,077(1,408 MB)176(80 MB)335due (oldest13,902 frames)0due (oldest0 frames)Gates run on that revision: all three gates above passed on
pr/texture-streaming-priority-and-park-vram.Gameplay: NVIDIA GeForce RTX 5070 Ti 16 GB, Intel Core Ultra 7 265KF, 64 GB DDR5-6400, Series X profile,
1080to1440, DLSS Quality, DLSS MFG 3x, RT off.Shader wave sizes tested: 32 and 64 lanes (
DARNER_EXACT64=71883e40620a567a+7168dd781ca7efb9,DARNER_SAMPLED_MARKS=0).Hardware dependence:
Due::ordered_withis general;park_target_with_framegen_livetargets>= 13 GiBVRAM cards (< PARK_LESS_BIGunchanged, unit-tested).Coverage gaps: In-game gameplay verified on RTX 5070 Ti 16 GB with Series X + MFG 3x; 12 GB NVIDIA and AMD GPUs were not runtime-tested (unit tests cover
< PARK_LESS_BIG).Checklist
main.docs/asset-policy.md.Checked for overlap
MasterWolf referenced this pull request2026-12-05 07:35:01 +00:00
I tested
Due::ordered_withfrom253e220againstc8258f9on Windows. With 4,096 checked rechecks and 3,083 fresh slots, marks off and no reserved recheck share, the first 64 slots changed from 64 rechecks on main to 64 fresh slots here. That reproduces the intended priority improvement.I also found a starvation case when a pass exhausts its time or byte budget early. Start with 128 fresh slots in write order, call
ordered_with(4096, 0, |_| false), remove only the first four returned slots and append four newer writes. Repeat for 240 passes. Main served the oldest slot on pass 1. This head left it pending after pass 240. The same happened with two or seven serviced per pass. With eight, this head served the oldest on pass 1. I saw the same outcome with a selection limit of 64, which exercises the partial-selection path.A local variation kept the 7:1 allocation and ordered each complete group as one newest, one oldest, then six newest. It kept all 64 fresh selections in the mixed test and served the oldest on pass 1 at two, four and seven. A budget of one still needs rotation across passes to guarantee progress. Could you add the short-pass case to the ordering test? These results cover CPU queue selection with synthetic slots. In-game texture visibility, FrameGen and parking were outside this check.
I tested the one-upload case on
253e220. With 128 fresh slots, one new write for each upload, selection limit 1, and 240 passes, the oldest slot was never served. The same happened with a limit of 64 and a repeating actual budget of 1, 0, 4, 2, 0, 7. That second case serviced 560 slots without picking the oldest once.I tried carrying the 7:1 phase across passes. Start at zero, select oldest when
(phase + position) % 8 == 7, and advance the phase only by the number of fresh entries actually serviced. For a selection oftakeentries, reserve(phase + take) / 8from the oldest end. This matters when fewer than eight entries are requested, as well as when a longer selection is cut short.Across selection limits 1, 2, 4, 7, 8, 64 and 4096 and five actual-service patterns, the first oldest pick landed on the eighth serviced slot in all 35 cases, with no duplicate slot/version selections. With a budget of one it made 30 oldest picks in 240 uploads. With the mixed budget and limit 64 it made 70 in 560. Empty passes consumed no phase. These tests used the PR's Rust ordering function and a synthetic service loop. A production implementation would need the service count from the fresh part of the upload pass.
Thanks
@holoslicer— great catch and super helpful reproduction of the< 8/ mixed-budget starvation edge case!Updated
pr/texture-streaming-priority-and-park-vramto carry the 7:1freshinterleaverphaseacross passes (rather than resettingphase = 0per pass):Due::ordered_with_phase/emit_fresh_interleaved(crates/darner-gpu/src/descriptor/host.rs): computesbot_n = (phase + take) / 8, picks from the oldest end at(phase + pos) % 8 == 7, and returnsfresh_range(the coldfreshsub-range oforder).HostHeap::fresh_phase(AtomicUsize): loaded when collecting due slots and advanced viaHostHeap::advance_fresh_phase(serviced)aftertells.flush()usingtells.fresh_serviced(crates/darner-gpu/src/draw.rs), so only coldfreshslots actually processed (accounting for urgent reordering, earlybreaks, and claim skips; 0 on empty/aborted slots) advance the phase.fresh_phase_rotation_prevents_starvation_on_short_passescovering all 7 selection limits[1, 2, 4, 7, 8, 64, 4096]x 5 fixed budgets[1, 2, 4, 7, 8]+ repeating mixed budgets[1, 0, 4, 2, 0, 7].Verification on updated head:
cargo xtask policy(576 files ok)cargo clippy --locked --all-targets -- -D warningsand--all-features(0 warnings)cargo test --locked -p darner-gpu -- --skip oracle64:1,808 passed, 0 failed(including all 95 tests indescriptor::host::tests).Two follow-ups on
326b1799after the phase fix. Both are from source review and CPU models.texture/claim.rsdocuments that two passes can read the same queue head before either flushes, with claims off by default.Tells::tellincrementsfresh_servicedbefore the queue applies the(slot, write)result. Two phase-zero passes that both take the same four fresh slots can therefore advance the phase by eight even though only fourDone(None)removals match. In a model with 128 fresh writes, four new arrivals per pair, and 240 pairs, the oldest was still pending after 960 unique removals. A test with two overlapping snapshots would cover the gap in the sequential test. The phase should account for accepted service of a cold entry, including whether the old turn was actually consumed.pool.rs:1069–1094applies the lift whenDARNER_TEX_PARK_CARD_MBis absent, even ifDARNER_TEX_PARK_PERCENTwas supplied. With a 14 GiB DXGI budget,DARNER_TEX_PARK_PERCENT=60, the FrameGen reserve marker, live FrameGen, and no other reserves, the model takes the target from 8601.6 to 13056 MiB. I would preserve the explicit park percentage as well as the explicit MB cap, while keeping the lift for the automatic target.Reviewed with Codex and Claude Code. No gameplay or GPU measurement for these cases.
Thanks
@tyr0nsur— both points are spot on. Implemented and verified locally onpr/texture-streaming-priority-and-park-vram(aa41582; will push when back at the keyboard for push/upload confirmation):Overlapping passes /
fresh_phaseaccounting (crates/darner-gpu/src/descriptor/host.rs,crates/darner-gpu/src/draw.rs):Tells::tellnow carriesis_fresh: bool(fresh_range.contains(&pos)) intoTextureQueue::apply_told(called by bothHostHeap::texture_slots_toldandHostHeap::texture_slot_tell_one), which checksis_unserviced_fresh(index, write)(looks == 0, noFLAG_MAPPED | FLAG_SOON | FLAG_CHECKED, and not inself.held) before applying the transition.HostHeap::advance_fresh_phasenow receives only accepted unique cold-freshtransitions underTextureQueue's lock, so overlapping snapshots on the same(slot, write)never double-advancefresh_phase.overlapping_passes_do_not_double_advance_fresh_phasereproducing the 128-slot / 4-per-pair / 240-pair (960 unique removals) schedule: confirms slot 0 is served on the 8th unique removal andfresh_phase == 960.Preserve explicit
DARNER_TEX_PARK_PERCENT(crates/darner-gpu/src/pool.rs):park_target_resolvedand gatedpark_target_with_framegen_liveongiven.is_none() && !explicit_percentso explicitDARNER_TEX_PARK_PERCENT(like explicitDARNER_TEX_PARK_CARD_MB) is never overridden by the FrameGen live lift.DARNER_TEX_PARK_PERCENT=60assertion topark_target_lifts_once_framegen_is_live_on_big_cards(stays60%, whereas automatic80%lifts to13,056 MiB).Local checks on
aa41582:cargo xtask policy(576 files ok),clippy --all-targets -- -D warnings(default &--all-features, 0 warnings),cargo test --locked -p darner-gpu -- --skip oracle64(1,809 passed, 0 failed).I retested the updated selector at
326b1799againstc8258f95on Windows using the production ordering function and generated queue entries. Each pass could select 4,096 entries and service two. With a continuing supply of speculative fingerprint rechecks and 16 ordinary new writes, main serviced 0 of the 16 in 120 passes. This revision serviced all 16 and picked the oldest by pass five.A separate control used unchecked retries for previously absent backing memory. With that traffic, a returned, previously streamed-out slot and all 16 ordinary writes still waited through 120 passes on both revisions. With the retry traffic removed, the returned slot was selected on the first pass on both. I am testing the returned-slot case independently using the queue lifecycle. This result covers offline selection and gives no gameplay FPS measurement.
Closing as obsolete: this PR targeted the old pre-merge renderer and is no longer needed on post-merge.
Pull request closed