[pr-performance][rendering] gpu: speed up copy_runs, pieces::take, write-watch journal, and preparing hot paths #712
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!712
Loading…
Reference in a new issue
No description provided.
Delete branch "ggwp/Darner:perf/gpu-hot-paths"
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
Port of
gamingwithhomie/larpcommit7d96eac3(originally bytalfour, adapted cleanly to Darnerpost-merge):The problem on
post-merge: Per-submission CPU overhead incopy_runs,pieces::take,watch::JOURNAL, andhost::preparing:copy_runsallocated aplacesvector andHashMap<usize, Spans>twice per batch and allocatedVec<u64>on everySpans::add(~3.0–4.1 ms/frame ingamingwithhomie/larpprofiles).pieces::takeacquiredSTATEunconditionally even when no copies/rests were pending and dropped settled D3D12 buffers while holdingSTATE.watch::JOURNALserialized parallel submission refresh readers behind aMutexand ran redundantask_ahead/ask_ahead_donework whileask_oncewas active, inserting every 4 KiB page into the 64 KiBBTreeMapwithout deduplicating consecutive 4 KiB addresses in the same 64 KiB page.host::preparing,pieces,shadow, andtexeventsused SipHashHashMap/HashSetinstead ofFastMap/FastSet.Fix:
copy_runswith a sort-and-cluster fast path, thread-local scratch reuse, generation-tagged run map, zero-allocSpans::add, and a 2,000-case fuzz test (copy_runs_matches_reference_fuzz) against the reference implementation.HAS_COPIES/NEXT_RESTfast path inpieces::takeand drops settled objects outsideSTATEviahost::reap_now.watch::JOURNALtoRwLockwith an atomicKEPTshort-circuit and 4 KiB -> 64 KiB page deduplication.FastMap/FastSetand thread-local scratch reuse acrosshost::preparing,pieces,shadow, andtexevents.How it was tested
ea01533(based onpost-merge28a9b42; also run in-game in a combined build with #676, #684, and the loop-reg / audio ports)cargo test --offline -p darner-gpu copy_runs_tests— 1 passed (copy_runs_matches_reference_fuzz, 2,000 randomized + fixed cases), 0 failedcargo clippy --offline -p darner-gpu --tests— passedcargo build --offline --release -p darner— succeededgamingwithhomie/larp(7d96eac3) measuredcopy_runsdropping from ~3.0–4.1 ms/frame to ~0.05–0.50 ms/frame. No isolated standalone A/B FPS table recorded onpost-mergealone.ea01533:cargo test,cargo clippy(passed).post-mergenot separately measured outside the combined AMD build.Checklist
post-merge.Checked for overlap
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.