GPU: batch resource barriers, reuse draw scratch buffers, range-lock copy_simple, and pool list uploads #1382
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!1382
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1382"
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?
@wbkepler on GitHub · 2026-11-24 17:40 UTC · original
wbkepler:gpu/cpu-record-batching-and-pool→main· +469 −56 · 9 files · 1 commits · openSummary
Rebased cleanly onto
upstream/main(ffe310e):HostListResourceBarriercalls (coalescing same-resource transitionsA->B->CintoA->C, cancellingA->B->Around-trips, and deduplicating consecutive global UAV barriers) and flushes once beforeDraw/Dispatch/Copy/Resolve/Clear/ExecuteIndirect/Close.Vecs across draws and resets indraw::State::bindandState::tables, and replaces small heapVecs inset_targets/SetDescriptorHeapswith fixed stack arrays.descriptor::copy_simpleviamirror_rangeandviews_at_batchsoSHADER_HEAPS,pending,VIEWS,made, andkeptare acquired once per copy range instead of per slot.HostList::uploadallocations onto 512-byte-alignedScratchupload chunks (plus a small capped pool for oversized>4 MiBuploads) reused acrossHostList::reset().copy_simpleparity, and pooled upload reuse across resets.Verification
cargo clippy -p victory-gpu --all-targets&-p victory --features diagnostics --all-targets— passedcargo test -p victory-gpu— passedcargo xtask policy— passed@wbkepler on GitHub · 2026-11-24 22:02 UTC · original
Rebased onto
70564aeasbf8a9b2(squashed to one commit; conflicts resolved by re-applying each part on top of upstream's new code).Kept, adapted to upstream
ensure_state, title barriers and barrier groups queue per host list and go out in oneResourceBarrierbefore the next command. Every path that records a command or its own barrier flushes first. That covers draws, dispatches, mesh and indirect work (before the clamp and beforedone), copies, resolves, RTV/DSV/UAV clears, texture uploads and alias copies,twin::route(so queued transitions land before the depth/twin copy),external::host_texture/record, and the diagnostics read-backs.close()flushes as well. Folding no longer touches split barriers. A cancelledUAV -> X -> UAVnow becomes a UAV barrier instead of disappearing, so back-to-back shader writes stay ordered.HostList::upload: unchanged in intent. It hands out 512-byte aligned scratch slices and keeps up to 2 big buffers across resets.bind_heaps(memory heap first, as upstream orders it).Dropped as superseded
tables()scratch rewrite. Upstream no longer makes every constant-buffer table fresh, sofresh/madestay emptyVec::new()(no allocation) on the common path.HostHeap::mirror_range. Upstream'sHostHeap::mirrorchanged a lot (stride table,viewed, placed textures, buffer views made on write), so a copy of it would drift.copy_simplenow looks the heap up and takespendingonce per range, then calls upstream'smirrorper slot. Slots past the heap still go one by one..rev()inshader_slot(not needed).Verification: clippy
-D warnings(victory-gpu, and victory with diagnostics),cargo test -p victory-gpuandcargo xtask policyall pass. New tests: barrier folding/flush on the device, upload pooling across resets, and per-slot mirroring bycopy_simple. Two tests fail identically on plainupstream/mainon this host:dynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views.Interaction with #1331: #1331 already conflicts with
upstream/mainitself, in the same 2 places, and this PR adds no new conflict region. The resolution:State::bind, keep upstream'stake_rebind+memory_heap+self.bind_heaps(list, memory_heap).bind_heaps: build the host heap array first, then compare and store the host heaps'as_raw()identities inhost_heapsinstead of the title addresses inwant. This needs room for the memory heap's identity too.#[cfg(test)] mod testsat the end ofdraw.rs.AI-assisted (Claude Code); checked on Windows 11 / RTX 5090.
@Marvisak on GitHub · 2026-11-25 01:24 UTC · original
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-gpu/src/host.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
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.