GPU: small first scratch chunk per list; log host memory against budget #1665
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1666"
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 Marvisak/VIctory. Originally posted by cyudev on 2026-11-24T20:35:26Z.
GPU: small first scratch chunk per list; log host memory against budget
HostList::scratchhands out upload memory in 4 MiB chunks, and a list keeps every chunk across resets. In the world the title records with hundreds of host lists, most of which need a few KiB per recording. So each list that ever touched scratch pinned a full 4 MiB upload buffer.On an RTX 3060 Ti (8 GB) with 16 GB RAM, running r4tedx's
integration/testersupdate 10, this went as follows:E_OUTOFMEMORY(no upload buffer … size=4194304, confirmed with the debug layer).DXGI_ERROR_DEVICE_REMOVED), or the title's own crash handler fired withmemory.load_percent: 97.This happened a few minutes into the world. Report on #71: https://github.com/Marvisak/VIctory/issues/71#issuecomment-7142982328
Change
A list's first chunk is now 256 KiB. A request that does not fit gets 4 MiB chunks after it, as before. Requests over 4 MiB still get their own buffer, freed at reset.
On reset, a list keeps only its first chunk.
Every 5 s, next to the frame-rate line:
The figures come from
IDXGIAdapter3::QueryVideoMemoryInfo, so testers can see memory pressure without the debug layer.Measured
Same machine and tree,
VICTORY_SHADER_LOOP_LIMIT=32, one run each:A first attempt that only trimmed chunks past the first on reset changed nothing. No list ever held more than one chunk; the cost was the size of that one chunk.
Not fixed here
The run after the change still ended with a device removal. System memory the GPU uses kept climbing to ~5.6 GB of a 7.4 GB budget from other sources. Video memory sat above budget (~9.2 GB of 7.2 GB) from world entry on. Those are separate problems.
Testing
cargo clippy -p victory-gpu --all-targets --all-features -- -D warnings: clean.cargo test -p victory-gpu: 52 passed on the RTX 3060 Ti, 55 with--features diagnosticson WARP. Two new tests cover the scratch scheme: a small first chunk; requests packed and 256-byte aligned; growth by 4 MiB chunks without overlap; a request over the small chunk taking a big first chunk; a request over 4 MiB getting its own buffer; a reset keeping and reusing only the first chunk.integration/testerswith this change applied; this PR is the same change onmain.🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T22:19:49Z.
Review: COMMENTED
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Small first scratch chunk per list with big-chunk growth and first-chunk retention: chunk_sizes() exposes the layout, scratch_starts_small_grows_by_big_chunks_and_keeps_its_first + a_first_request_bigger_than_the_small_chunk_takes_a_big_one cover both paths. 2 tests.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:34:02Z.
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
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.