gpu(host): step down fetch buffer allocations and retry readback creation #159
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
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
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
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/Androtim--MiniVI!159
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/159/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?
@Androtim on GitHub · 2026-11-29 19:57 UTC · original
Androtim:feat/iter157-gpu-fetch-buffer-stepdown→main· +236 −16 · 3 files · 1 commits · merged 2026-11-29 21:27 UTC## Summary
crates/victory-gpu/src/fetchmem.rsto step down relay and card-back fetch buffer allocations (16 MiBrounded unless under host memory pressure ->1 MiBrounded -> minimum page-aligned byte count, plus one retry of the minimum after 5 ms) instead of aborting the title with a fatal error on allocation failure.shared_buffer_stagingresidency fast-path insideHost::fetch_buffer.VICTORY_FETCH_STEPDOWN=0is not set), logNO MEMORY TO FETCHloudly, count skipped fetches/stale bytes, advance relay watermark or return non-fatally so later fetches recover those ranges.CreateCommittedResourceonce after 5 ms inHost::read_back_bufferwhenVICTORY_FETCH_STEPDOWNis active.Test plan
cargo run -p xtask -- policy: passedcargo test -p victory-gpu fetchmem::: 5/5 passedcargo test -p victory-gpu host::: passedcargo clippy --workspace --all-targets(default and--features diagnostics) with-D warnings: passed@Androtim on GitHub · 2026-11-29 20:04 UTC · original
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
Logic and safety look solid, CI is passing, and the change is cleanly scoped to
crates/victory-gpu/src/fetchmem.rs,crates/victory-gpu/src/host.rs, andcrates/victory-gpu/src/lib.rs.Host::fetch_buffer,fetchmem::buffer,fetchmem::sizes): Droppingf.buffer/work.fetchedbefore reallocating is safe because both paths synchronize on the prior fetch fence before reusing the buffer. Preservingshared_buffer_stagingkeeps the existing residency fast path intact. When allocation still fails after stepping down (16 MiB->1 MiB->64 KiB-aligned minimum + one 5 ms retry), logging viafetchmem::skippedand advancingcrate::shadow::relay_fetched(after)on the relay path matches the existingpieces.is_empty()path.Host::read_back_buffer): RetryingCreateCommittedResourceonce after 5 ms (resettingbuffer = None) only runs on the error path and is gated byfetchmem::on().VICTORY_FETCH_STEPDOWN=0cleanly restores the previous single 16 MiB attempt and fatal error behavior.Minor Non-Blocking Notes
fetchmem::sizes(total, tight): If ever called withtotal == 0,0u64.next_multiple_of(...)produces0before.max(1 << 16)produces65536(ascending instead of descending). Current callers guard!pieces.is_empty()withhi > lo, sototal > 0in practice, but clampingtotal.max(1)would makesizestotal-safe.Host::card_back: Returning early whenwork.fetchedisNoneleaves the pieces from thatCardPlaninserted inseen, so if a laterCardPlanin the same settled batch references the same(shadow, lo, hi)with a smallertotalthat would fit,seen.insert(...)would skip it for that batch.fetchmem::buffer: On a successful retry ofleastwhenleast == usual(e.g.,total == 1 << 20,tight == true),COUNTS[2]is incremented even though the buffer was not smaller thanusual(currently test-only).Next Step
Because this touches D3D12 host fetch/readback buffer lifecycle and
residency::pressured()sizing incrates/victory-gpu/src/host.rs, a local real-GPU smoke test is recommended before merging.Generated with Antigravity CLI (
agy).@Androtim on GitHub · 2026-11-29 21:27 UTC · original
Automated RTX 4060 Ti 8 GB Open-World A/B hardware verification PASSED (
playtest/wave5vsorigin/mainb1b6dc1,VICTORY_LEVELS_ON_DEMAND=0play-parity):cargo test(RTX 4060 Ti): 645 passed, 0 failed (victory39/39,victory-shaderemit::wave64_tests19/19 &lower19/19,victory-gpu568/568).scripts/verify-world.ps1, DLSS Quality + open-world save):9.4 fpsvs7.5 fps(+1.90 fps / +25%), min8.3 fpsvs0.8 fps, preparing53.6 msvs60.0 ms5760 MBvs6005 MB(-245 MB,0 MBover budget);no room for new oneshalved (9,000vs18,000);max_waitingdropped (36,432vs41,431)0mismatches (other_bytes=0, showed_another_view=0, failed=0vs5and2on baseline)mapped_rate1.63 ms/svs6.9 ms/s(-76%, max12.9vs51.9 ms)frame-5975.png,frame-5983.png),edge_energy=4.69vs3.88,near_black=0.02%,magenta=0.0%(and#1412bf6800showed zero visual artifacts).