Repository navigation
perf(gpu): coalesce cross-queue and bottom-of-pipe dependent held pieces - #419
pragyaangaur merged 4 commits into
Conversation
Coalesce ready command-list segments across queues inside Held::pump when a producer segment's deferred bottom-of-pipe write or deferred fence signal satisfies a waiting segment's dependency, inserting a reusable global UAV barrier command list at each joined synchronization boundary. Guard coalescing against submission-phase ordering hazards (title memory copies or post-execution callbacks before explicit texture uploads; GPU writes or post-execution callbacks before deferred CPU reads) and cap joined submissions via VICTORY_JOIN_LISTS (default 64). Toggle with VICTORY_COALESCE_PIECES (default on unless "0").
… join boundaries Do not run can_join_batch between consecutive ready segments on the same queue that already ran together in a single host submission in legacy mode. Checking can_join on every intra-queue segment shredded multi-list graphics submissions whenever an earlier list had a GPU write or title copy and a later list in the same submission had a CPU copy/fill or texture upload. Restrict can_join checks to actual join boundaries (switching queues, crossing a BoP-satisfied wait, or crossing a deferred-signal fence wait), preserving full cross-queue BoP coalescing without spurious intra-queue splits.
|
Two new scheduler checks find an ordering problem at gdemontalivet’s exact #419 head. With a consumer waiting for A local change that checks the newest overlapping pending write before looking at CPU memory passes 19/19 scheduler tests, including both new cases. On M4 Pro / D3DMetal 4.0 beta 3, a separate generated guest list with two dependent buffer copies and an actual bottom-of-pipe cut reduced 2 fenced native submissions to 1, with both exact output words. That positive result held with the ordering change too. The overwrite checks ran in the CPU scheduler model. Prepared and tested with Codex. |
|
In-game check on an M5 Pro (macOS 27.0.1, CrossOver 26.3 Wine with the repo's current patches, D3DMetal 4.0 beta 3, Series X), with #439 and #419 together on
I didn't test them separately, so I can't say how the gain splits between them. Prepared with Claude Code. |
|
Thanks for this. Many pull requests landed today, and this one now conflicts with main. Could you merge or rebase main into it, rerun the checks and ping here? I will review and merge it as soon as CI is green. |
…ync submit worker (VICTORY_ASYNC_SUBMIT=1) Implement Wait-Before-Prep Flight-1 overlap (VICTORY_FLIGHT1=1) and a dedicated victory-submit worker thread (VICTORY_ASYNC_SUBMIT=1) behind opt-in environment switches (default off), rebased cleanly onto main: - Split Host::execute_with_barriers into prepare_submission, execute_sync, and finish_post_gpu, preserving all main submission behavior across both sync and Flight-1 paths (pragyaangaur#403 SUBMISSIONS_DONE/retire_any/advance_retired, pragyaangaur#417 ReadyDrain/release_worker, pragyaangaur#419 coalesced UAV barriers, pragyaangaur#453 hoisted indirect clamps in prelude, pragyaangaur#457 texback::land, pragyaangaur#474 trim_idle, and unconditional bindless::uploads). - Keep pragyaangaur#417's bindless::Uploads semantics (Holder dirty tracking + ReadyDrain + release_worker) while checking out the upload HostList from LIST so Uploads is genuinely Send across the flight lifecycle without holding a MutexGuard across threads or GPU waits; call release_worker() immediately after the flight's GPU fence completes and return the upload list to LIST on drop. - Enforce Wait-Before-Prep in host/flight.rs: finish_flight_locked drains Flight N-1 completely before Flight N touches any shared Shadow, descriptor heap, upload staging pool, or Mark buffer, and Host::quiet() drains any active flight under Host::submitted before heap creation/null-fill. - Add coalescing Held::take_ready_with / finish_running so victory-submit and Flight-1 never hold HELD across GPU submission, preserving the lock DAG (SUBMIT_DRAIN -> HELD -> Host::submitted -> Host::flight -> Fence::waiters) and draining cleanly at PresentX, CopyPageMappingsBatchX, and synchronous Host::execute calls.
Summary
Item::Signaldelivery across queues insideHeld::pump_coalesced()(VICTORY_COALESCE_PIECES, default ON,0restores legacy per-queue pump;VICTORY_JOIN_LISTSdefault64).HostList::will_write(&ValueWait)andHostList::batch_flags()so held segments waiting on a bottom-of-pipe write or fence signal already queued in the current piece coalesce into the sameHost::executeinstead of triggering a separate submission, inserting a reusable globaluav_barrier()command list at each crossed synchronization boundary.Measured M5 Max (CrossOver / D3DMetal) Impact
17.5–18.0 → 11.0–12.0(-35% to -39%), coalescing 6–8 BoP waits per frame, and median GPU time dropped from107.5 ms → 89.2–90.8 ms(-17.0%).Verification
cargo xtask policy: passcargo test -p victory-gpu --lib hold::tests: 17/17 passed (including cross-queue BoP chain, hazard split, deferred signal/fence-wait, and same-queue non-split tests)cargo clippy --target x86_64-pc-windows-gnullvm --workspace --all-targets -- -D warnings(default &--features diagnostics): 0 warnings