GPU: pool HostList device-local UAV buffers and wire ahead::card_if_ready #884
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/884"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by Starchaser1024 on 2026-11-28T08:33:30Z.
Summary
Pools
COMMON-state device-local scratch UAV buffers used byHostList(card_budget,indirect_scratch,batch_place, andplace::between) across list resets and drops, and wiresahead::card_if_ready()intoHost::uav_buffer— addressing the remaining per-list device-buffer churn noted in #57 (~13,500buffers /7.5 sof synchronousCreateCommittedResource+MakeResident+mapped()fence waits per 5 minutes, amplified now thatVICTORY_ALLOCATOR_TRIMis on by default).Design & Safety Invariants
Shadowzero-initialization vs transientHostListscratch (crates/victory-gpu/src/host/uav_pool.rs,host.rs,ahead.rs):Shadow(take,dword_runs,by_address) andambientrely onHost::uav_bufferreturning a freshly zero-initialized buffer.Host::uav_buffertherefore strictly preserves zero-initialized semantics (consultingahead::card_if_ready()for64 KiBpre-made zeroed buffers onceCARD_WANTEDis active, without spawningvictory-aheadduringvictory warm).uav_pool::take_uav(host, size)serves the four transientHostListscratch consumers (make_card_budget,indirect_scratch,batch_place, andplace::between), each of which overwrites its region before reading.Widthpower-of-two bucketing:UAV_SPAREkeys by exactGetDesc().Widthin power-of-two multiples of64 KiB(64 KiBminimum up to16 MiBper item), socard_budget(64 KiB),batch_args(64 KiB),indirect_scratch, andplace::betweenshare unified buckets without alteringGetDesc().Widthexpectations.HostList::betweentracks buffers inDeferred::between_uavsand batch-transitions them back toD3D12_RESOURCE_STATE_COMMONinHostList::close()(between_common), matchingcard_budget_out,indirect_common, andbatches_common.reset()orDrop for HostList(IDLE_MOSToverflow andVICTORY_ALLOCATOR_TRIM), buffers pass throughretire_uavs: enteringUAV_SPAREimmediately when no submissions are in flight, or waiting inRETIRED_UAVSuntilbury(finished)observes their fence completion.256 MiB(128 MiBon<= 32 GiBhosts), gated byVICTORY_UAV_POOL(default1,=0disables pooling), and hooked intoHost::sweep()andtrim_spare_chunks()(16 MiBwarm floor under mild pressure /allocator_trim,0under critical commit or>= 95%VRAM).Benchmark & Verification (RTX 5060 Ti 16 GB, Windows 11,
--release)host::uav_pool::tests::bench_host_list_uav_pool_ab(7 rounds each):VICTORY_UAV_POOL=0VICTORY_UAV_POOL=1reset()+4x betweencopies across 64HostLists (256betweenbuffers/round)-124.54 ms)HostListcreate + record (card_budget+batch_place+2x between) + reset + drop churn1,792D3D12 UAVs made)0D3D12 UAVs made,1,792pool hits)-126.82 ms)host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue: verified underVICTORY_D3D12_DEBUG=1(0ID3D12InfoQueueerrors acrosscard_budget, mid-listindirect_scratchgrowth,batch_place,betweencopy,reset(), in-flight retirement, and trim).cargo test -p victory-gpu --locked: 457 passed, 0 failed.cargo clippy --workspace --all-targets --all-features --locked: 0 warnings in changed files.cargo xtask policy: 295 files ok.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Alxspb on 2026-11-28T14:17:39Z.
Build break when this is merged on top of #1012 (found while building a play-test stack; both PRs are currently
MERGEABLEagainstmain, but not with each other).#1012 gave
Spare::takea predicate (host.rs:fn take(&mut self, size: u64, matches: impl Fn(&T) -> bool)) becauseSPAREholds two classes of chunk — upload (card_writable = false) and card-writable — and mixing them would push a GPU-writable buffer into the CPU-only path.uav_pool.rsstill callstake(size).For
UAV_SPAREthe predicate is genuinely a no-op, so the call site can adapt without changing what this pool does: every supplier puts in the same class of buffer (DEFAULT heap +ALLOW_UNORDERED_ACCESS, retired only after the recordings that wrote them have run, so they come back in COMMON state) —between/place_copyviaahead::card,indirect_scratch,batch_args,card_budget,drain_retired_uavs; the upload and shared chunks live inhost.rs's ownSPAREand never enter this one. So:I run exactly that in a 12-PR stack (#1002 #989 #1005 #65 #1014 #884 #941 #816 #797 #933 #934 #614 #1012) — green build here: https://github.com/Alxspb/VIctory-NVIDIA/actions/runs/46145821590 (the failing run before the fix: https://github.com/Alxspb/VIctory-NVIDIA/actions/runs/46145596521). Verified on an RTX 5060 Ti 16 GB / i5-13600KF, Series S job + DLSS Quality + 2x frame generation; the pool's own debug-layer reuse test is part of that stack, and
VICTORY_UAV_POOL=0is kept as the A/B switch.If you would rather take the other direction (a
take_where(size, pred)inhost.rsso the old one-argumenttakestays), say so and I'll send the two-line change against your branch.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Starchaser1024 on 2026-11-28T15:12:24Z.
Thanks @Alxspb for testing
#884in your RTX 5060 Ti play-test stack and flagging the interaction with#1012!Agreed — keeping 1-arg
Spare::take(size)(delegating totake_where(size, pred)on#1012's side) is the cleanest path so both#884and#1012compile standalone against currentmainand merge cleanly in either order. And if#1012lands onmainfirst with the 2-arg signature, I'll rebaseuav_pool.rsto.take(size, |_| true)right away.Pull request closed