GPU: pointer-deduplicate HostList::keep, retain capacity across resets, and speed up Host::execute and used_pipeline #2216
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2216
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2216/head"
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?
@RVZO6 on GitHub · 2026-11-25 08:06 UTC · original
RVZO6:rvzo/list-reset-keep-dedup→main· +684 −53 · 3 files · 1 commits · closed without mergingCommand-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)
@Marvisak on GitHub · 2026-11-25 13:30 UTC · original · edited 2026-11-25 16:04 UTC
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
@RVZO6 on GitHub · 2026-11-25 17:13 UTC · original
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