perf(gpu): cut per-draw and title-memory sync CPU overhead #127
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Belobug/VIctory-Belobug-AMD. Originally posted by matheusfrta on 2026-11-25T15:02:33Z.
The 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.Imported from Belobug/VIctory-Belobug-AMD. Originally posted by KernelSmoker on 2026-11-25T18:44:53Z.
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.Imported from Belobug/VIctory-Belobug-AMD. Originally posted by MamaLeVrai on 2026-11-26T05:10:24Z.
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.
Imported from Belobug/VIctory-Belobug-AMD. Originally posted by gut0to on 2026-11-26T16:05:56Z.
Review: COMMENTED
AI-assisted review. I inspected the changed worker-pool initialization and accounting; I did not run tests or a game.
Imported from Belobug/VIctory-Belobug-AMD. Originally posted by gut0to on 2026-11-26T16:05:56Z.
Code review location:
crates/victory-gpu/src/host.rs; line 3085AI-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
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.