darner-gpu: free-block dynamic_texture_cap admission, inline compute/graphics RootArgs, IndexedSweep, and AES-NI texture digest #545
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!545
Loading…
Reference in a new issue
No description provided.
Delete branch "darner_lover/Darner:upstream-pr-clean"
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?
Summary
On 8 GB GDDR6 GPUs and 6-core/12-thread CPUs, profiling showed three independent bottlenecks:
FirstUpload::ExplicitBudgetrefusals (807,465in a ~31-minute session) and prematureSOFT_SWEEPSwhile free texture-heap holes existed, leaving character/world texture slots black.10.90%root-view skip and17.05%index-buffer skip) caused by resetting allRootArgsstate twice aroundexecute_indirectand allocating/clearing root-arg state outside graphics/compute sides.O(N)ByCopyHashMapreconstruction across ~72k–80k descriptor slots inheap_buffer_pass(4.90 msavg perheap bufferspass) plus scalar texture hashing on unchanging guarded textures.The three attached patches address each bottleneck cleanly and independently against
f3840d7(main).Test Environment
Patches
0001-resource-dynamic-texture-cap-free-blocks.patchFiles:
crates/darner-gpu/src/resource.rsHostTexture.vram_bytes(0for parked L0, aliased, and tiled allocations) inHOST_TEXTURES[1]andKINDS[1]so L0-parked copies never inflate VRAM pressure metrics or trigger falseSOFT_SWEEPS.soft_sweep_target()soDARNER_TEXTURE_SOFT_MBchecksKINDS[1] + tiles::given_total()rather than including render targets held insideHOST_TEXTURES[1].dynamic_texture_cap: Refactordynamic_cap_for()anddynamic_cap_allows_first_upload()soroom_for_first_upload()subtractsfree_blocks(reserve.saturating_sub(free_blocks))—matchingfirst_upload_decision()—and admits first-upload textures that fit inside an existing contiguous free heap range (new_card_bytes == 0 && reserve <= widest_free) even when process VRAM usage is inside the keep-free zone.soft_sweep_target_uses_filled_vram_for_soft_budget,dynamic_cap_admits_first_upload_fitting_in_free_blocks.0002-root-args-compute-side-invalidation.patchFiles:
crates/darner-gpu/src/root_args.rs,crates/darner-gpu/src/draw.rsRootArgs+ independent graphics/computeSides: Store root constants (INLINE_CONSTS) and root views/tables (INLINE_VIEWS) in fixed inline arrays per side (graphics/compute), cache vertex/index buffers (MAX_VB_SLOTS) across root-signature changes (clear_side(compute)vsclear_vb()/clear_all()), and buffer per-list counters locally before flushing on clear/drop.execute_indirect: Because indirect clamping dispatches run only compute root signatures (clear_side(true)insidebatched,bound,bound_ahead,ambient, andUSER_DISPATCH_THREADS_X), removing the blanket doubleclear_all()aroundexecute_indirectpreserves graphics root arguments and VB/IB bindings across indirect draws without risking stale compute state.graphics_and_compute_sides_are_independent,index_buffer_deduplicates_and_survives_clear_roots,vertex_buffers_deduplicates_exact_and_prefix_slots,overflow_params_and_large_constants_work_identically.0003-heap-sweep-indexed-and-aes-texture-digest.patchFiles:
crates/darner-gpu/src/draw/heap_sweep.rs,crates/darner-gpu/src/draw.rs,crates/darner-gpu/src/texture.rsIndexedSweep<T>forheap_buffer_pass: Replace per-passByCopyHashMapaggregation across active heap slots withIndexedSweep<T>, linking each active slot into intrusive doubly-linkedpart_heads(PARTS = 16) andCopySpanlists.finish()recomputes[from, to]bounds only for copy spans whose extrema changed, andvalues()iterates active copies directly (slots_whereandfor_each_memberhandle taken-over windows and conditional read diagnostics).digest_aes()(withdigest_folded()fallback) intexture.rs, make the blind-hit hot window configurable viaDARNER_VIDEO_HOT_FRAMES(default1024), and back off unchanged blind-turn hashes viahash_backoff()/turn_skipped()(DARNER_TEXTURE_HASH_BACKOFF,BACKOFF_AFTER = 4,BACKOFF_EVERY = 16, resettingLast.quieton writes or detected changes).matches_reference_oracle_across_updates_and_forget_parts,digest_detects_single_byte_and_length_changes,turn_skipped_backs_off_after_quiet_threshold.Measured Telemetry Results (RTX 3060 Ti 8 GB / Ryzen 5 5600XT, Series S 1080p DLSS Quality)
Comparing baseline gameplay (
3,453in-game intervals,1,868 s, avg4,024draws/frame) against a patched run (1,892in-game intervals,1,031 s, avg4,308draws/frame):FirstUpload::ExplicitBudgetrefusals807,4650-100%)p50 / avg)7.055 / 6.252 GB4.465 / 4.451 GB-36.7% p50(-2.59 GB)p50 / avg)6.114 / 6.060 GB5.720 / 5.692 GB-0.394 GB p50p50 / avg / p95)28.91 / 30.88 / 47.36 ms24.50 / 25.47 / 36.36 ms-17.5% avg(-23.2% p95)cpy_msp50 / avg)8.04 / 8.36 ms4.63 / 4.76 ms-43.1% avghep_msp50 / avg)1.24 / 1.50 ms0.93 / 0.94 ms-37.6% avgheap bufferslog pass time (avg / p50)4.90 / 3.80 ms2.86 / 2.20 ms-41.6% avg(-42.1% p50)DARNER_ROOT_ARG_SKIPviews skipped10.90%(1,140.5 / 10,460.6)63.24%(7,625.6 / 12,059.0)+52.3 ppDARNER_ROOT_ARG_SKIPIBs skipped17.05%(42.3 / 247.9)73.72%(198.5 / 269.3)+56.7 ppDARNER_ROOT_ARG_SKIPconstants skipped0.17%(11.4 / 6,575.9)2.83%(223.6 / 7,913.4)+2.66 ppavg / p50 / max)2.44 / 2.10 / 13.90 ms2.15 / 1.70 / 8.50 ms-38.8% max spikep50 / avg / p95)85.0% / 83.5% / 99.3%76.1% / 75.4% / 92.8%-8.9 pp p50max frame_ms)737.83 ms97.71 ms-86.8%I tried my best to optimize darner, i will continue to do so. My next steps are to check what other ports do better or have that darner doesnt .
Test needed — commit
d6d56a1b; what to check: the change described aboveEvidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.
Reply
testingto take this run; it's free again after 24 h with no results.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.