perf(gpu): cut per-draw and title-memory sync CPU overhead #127
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!127
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-127"
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?
@matheusfrta on GitHub · 2026-11-25 15:02 UTC · original
matheusfrta:patch-1795618938→main· +842 −372 · 10 files · 1 commits · openThe world frame rate is mostly CPU-bound across title recording and submission prep, so this targets the biggest hotspots there. Fixed sparse 2 GiB shadows losing write-watching after touching a mapped view, stopped synchronous copy-backs from pinning guarded blocks for two seconds, replaced per-batch thread spawning in
in_parallelwith a worker pool to avoid firing title TLS callbacks every submission, and trimmed per-draw locks and heap allocations.@KernelSmoker on GitHub · 2026-11-25 18:44 UTC · original
Compile check on PR head
c9e45b4(cargo check --workspace --all-targets --locked --offline --target x86_64-pc-windows-gnu, Rust 1.98.1) fails incrates/victory-gpu/src/host.rs:in_paralleltakesf: impl Fn(&[T]) + Sync(line 3017) rather than a named genericF: Fn(&[T]) + Sync, sorun_job::<T, F>cannot nameF.@MamaLeVrai on GitHub · 2026-11-26 05:10 UTC · original
One deadlock to look at when this is rebased. It comes from reading the code; I have not seen it happen.
readable_atrunsreadable(list, u, view)insidecrate::descriptor::with_view, so theVIEWSread lock is held for the whole ofreadable. Before this PR,view()cloned the view and dropped the lock first. Insidereadablethere is a path toVIEWS.write()on the same thread:readable→crate::descriptor::host::placed_texture(view)→crate::resource::texture_at(...).texture_atreleases the resource it has just made in two cases: when the host copy could not be made (resource(out).host.is_none()), and when another thread put the same(address, desc)inPLACED_TEXTURESfirst. In both it callsresource_release(out).Resource'sDropruns and callscrate::descriptor::forget(...), which takesVIEWS.write().Taking the write lock while this thread holds the read lock never returns:
std::sync::RwLockis not re-entrant. The second case needs two recording threads to meet the same placed texture for the first time, which titles that record on several threads can do. Cloning the view beforereadable, asmaindoes, or releasing those resources after the lock is gone, would avoid it.Separately, the PR currently conflicts with
main(descriptor.rs,draw.rs,indirect.rs).mainalready madeVIEWSanRwLock.AI-assisted (Claude Code); no game data.
@gut0to on GitHub · 2026-11-26 16:05 UTC · original · reviewed
AI-assisted review. I inspected the changed worker-pool initialization and accounting; I did not run tests or a game.
@ -2983,0 +3082,4 @@}// Only expose workers that actually spawned; if fewer spawned, threads < THREADS// still leaves them idle only when id >= s.threads - 1, which is true for spawned.let _ = spawned;@gut0to on GitHub · 2026-11-26 16:05 UTC · original
AI-assisted static review: I traced pool initialization and active-worker accounting; I did not run tests or a game.
spawnedis counted but discarded, whilePool.workersstays atTHREADS - 1and each run setsactivefrom that fixed count. If even one thread creation fails, fewer workers can decrementactivethanWaitPoolawaits, soin_parallelcan hang. Could the pool use the actual spawned count (or fail initialization and fall back before publishing the pool)?View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.