GPU: pointer-deduplicate HostList::keep, retain capacity across resets, and speed up Host::execute and used_pipeline #2214
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2216"
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 Marvisak/VIctory. Originally posted by RVZO6 on 2026-11-25T08:06:00Z.
Command-list recording, reset, and submission paths in
victory-gpucurrently incur avoidable COM refcount traffic, per-reset heap churn, and lock/allocation overhead on every frame:HostList::keep()unconditionally casts toIUnknown(QueryInterface+AddRef) and pushes onto aVecon every draw/bind, even when the exact same PSO, root signature, or heap pointer is already retained on that command list.HostList::reset()replacesDeferredwithDeferred::default()andState::reset()replacesStatewithState::default(), freeing and reallocating everyVec/HashMap/HashSeton every command-list reset.Host::execute()allocates nested per-listVecs to collect unique heaps and unconditionally clonesrunseven whenuploads.is_none().HostPipeline::nameis cloned as aStringand inserted intoHostList::pipelinesunder a mutex on every pipeline switch, even when the same pipeline was already seen on the current command list.Claimed on #1633 (
https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7155911614).The change
crates/victory-gpu/src/host.rs:KeepSet<T>forHostList::keep()so repeated retains of the same COM interface pointer on an open list skipQueryInterface/AddRef(removing the pointer if a cast fails, and clearing once GPU execution finishes).*self.deferred() = Deferred::default()inHostList::reset()with in-placeDeferred::clear(), retaining steady-state capacities while capping runaway burst capacity atRETAINED_CAP(1024).Host::execute()via pointer-deduplicatedcollect_unique_heaps()and borrowrunsdirectly whenuploads.is_none().Arc<str>inHostList::pipelines(used_pipeline(&Arc<str>)).deferred_clear_retains_steady_state_capacity_and_shrinks_bursts,keep_set_deduplicates_by_pointer_and_re_retains_after_clear, andcollect_unique_heaps_deduplicates_by_pointer_in_order.crates/victory-gpu/src/pipeline/host.rs:HostPipeline::nameasArc<str>instead ofString.crates/victory-gpu/src/draw.rs:State::release_dynamic()(shared byDropandState::reset()) and exhaustively reset allStatefields in place to matchState::default()while retaining steady-state capacities capped atRETAINED_CAP.seen_pipelines: HashSet<usize>perStateso repeated binds of the same host PSO on the same command list skip lockingHostList::pipelines.state_reset_releases_dynamic_resets_all_fields_and_retains_capacityandseen_pipelines_skips_duplicates_and_resets.Not a duplicate of
No open PR or
CLAIMS.mdentry pointer-deduplicatesHostList::keep(), retains/caps capacities acrossHostList::reset()/State::reset(), deduplicatesHost::execute()heap collection, or avoids repeatedHostList::pipelineslocking withArc<str>names.Tested
windows-latestMSVC + Windows WARP SM 6.6 CI run45572159221(Clippyclean,Clippy, diagnostics buildclean,Tests:715 passed; 0 failed; 10 ignored,victory-gpu:157 passed; 0 failed; 2 ignored+1 passed,xtask:6 passed; 0 failed):draw::tests::state_reset_releases_dynamic_resets_all_fields_and_retains_capacity ... okdraw::tests::seen_pipelines_skips_duplicates_and_resets ... okhost::tests::deferred_clear_retains_steady_state_capacity_and_shrinks_bursts ... okhost::tests::keep_set_deduplicates_by_pointer_and_re_retains_after_clear ... okhost::tests::collect_unique_heaps_deduplicates_by_pointer_in_order ... okNot run: the title; any hardware GPU. The title was not used in these tests.
AI-assisted: T3 Code (Antigravity, gemini-4-neon)
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T08:22:56Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):cargo test -p victory-gpu --lib draw::tests::— 7 passed, 0 failed on RTX 5090cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean pointer deduplication in
HostList::keep, capacity retention across resets, and fasterHost::execute/used_pipeline. Looks great.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:48:21Z.
Review: COMMENTED
Pointer-deduplicates HostList::keep and retains pipeline capacity (+684 in draw.rs). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Perf-motivated; the seen_pipelines HashSet soundness argument (keep() keeps pipelines alive until list+State reset together) reads correctly.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:30:42Z.
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-gpu/src/draw.rs,crates/victory-gpu/src/host.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (needs-work) was for an older state ofmain.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by RVZO6 on 2026-11-25T17:13:59Z.
Closing to keep the queue clean:
draw.rs/host.rsmoved significantly on13f91caand I do not have a title run to profile the frame-time impact.Pull request closed