GPU: deduplicate identical per-list defer_gpu_write declarations #3114
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!3114
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3114"
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?
@fuzeofficlal on GitHub · 2026-11-26 08:29 UTC · original
fuzeofficlal:perf/gpu-dedup-per-list-gpu-writes→main· +265 −8 · 1 files · 1 commits · openSummary
HostList::defer_gpu_writepreviously pushed a newStep::GpuWriteintoDeferred::copieson every draw or dispatch, even when the same command list repeatedly declared the exact same(shadow, address, len, marked, memory)tuple with no intervening step that writes title memory. In world command lists this appends thousands of redundantStep::GpuWriteentries per frame, repeatingArc::clone,batch.flush()/shadow.writing(...)lock acquisitions inrun_deferred, andHashMapdeduplication work inHost::execute.This change mirrors the existing per-list
Deferred::refresheddeduplication:Deferred::gpu_writes: HashSet<(usize, usize, usize, bool, bool)>keyed by(Arc::as_ptr(shadow) as usize, address, len, marked, memory).markedandmemoryin the key ensures that an earliermarked == truedeclaration never suppresses a subsequentmarked == falsedeclaration (which must flush and take a pre-submit snapshot), and an earliermemory == falsedeclaration never suppresses a subsequentmemory == truedeclaration (which governswithholding()on title-memory misses).Step::GpuWrite(shadow.clone(), ...)intoDeferred::copies, theArc<Shadow>stays alive untilHostList::reset()replacesDeferred, soArc::as_ptr(shadow)cannot alias another copy while ingpu_writes.Deferred::title_written(&mut self)to clear bothrefreshedandgpu_writes, called byHostList::defer_copyandHostList::defer(mergingdefer's twoself.deferred()lock acquisitions into one).HostList::resetcontinues to reset the entireDeferredstruct.Verification
crates/victory-gpu/src/host.rs(host::gpu_write_dedup::*):identical_gpu_writes_deduplicate_until_title_written_or_resetdistinct_marked_and_memory_flags_are_never_collapseddeduped_marked_then_unmarked_and_post_copy_writes_copy_backdeduped_ordinary_then_memory_write_still_withholds_on_misscargo test -p victory-gpu --lib --locked -- host::gpu_write_dedup:: host::batch:: host::withholding::— 6 passed, 0 failed.VICTORY_D3D12_WARP=1):cargo test -p victory-gpu --locked --features diagnostics— 250 passed, 0 failed (1 existing benchmark ignored), verified across 4 consecutive parallel runs.cargo clippy --workspace --all-targets --locked -- -D warningsand--all-features: 0 warnings.cargo test -p xtask --locked policy::tests::repository_passes_policy: passed.@Dukestar69 on GitHub · 2026-11-26 08:53 UTC · original · approved these changes
Verified on RTX 5090 & WARP against
origin/main(63bcca4):cargo test -p victory-gpu --lib host::gpu_write_dedup:: -- --test-threads=1: 4/4 passed on RTX 5090 and WARP.cargo test -p victory-gpu --lib shadow:: -- --test-threads=1: 10/10 passed on RTX 5090 and WARP.cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20/20 passed on RTX 5090.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly deduplicates identical per-list
defer_gpu_writedeclarations without collapsing distinct marked/memory flags or breaking post-copy/withholding semantics.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.