Snapshot of a private CPU mirror: in pool-sized pieces before the run ends #4580
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4580
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4579"
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?
@mcozcan on GitHub · 2026-11-30 23:12 UTC · original
mcozcan:pr/snapshot-pieces→main· +115 −15 · 2 files · 2 commits · closed without mergingWhat it changes
When the packed upload of a submission cannot be allocated,
snapshot_private_rangessnapshots only the dirty bytes, in one upload buffer of their whole sum. On a PC at its commit limit that buffer is refused too and the run ends:Now, when the whole buffer is refused, the snapshot goes in pieces of at most 4 MiB (
SNAPSHOT_PIECE,pool::BUFFER_MOST): pieces that size are cut from the pool's upload blocks, memory already committed, where one has room (and each piece is asked again once the spares are freed, as every upload buffer is). Only a piece still refused ends the run, as before. All the pieces go into the plan'sfallback_uploads, kept until retirement as the single buffer was. Nothing waits for memory here: the caller holds the submission lock (and with the relayQUEUE_ORDER, which the landing thread needs), so a wait would stall every submission and free nothing.How it was tested
cargo test -p victory-gpu --libpassed for this branch;host::upcheck::tests::private_upload_fallback_snapshots_only_dirty_bytesfollows the new signature and still checks that only the dirty bytes are copied. The two failureslist::thin::tests::bindings_record_no_workandshader_cache::tests::every_switch_of_the_translator_is_in_the_keyfail onmaintoo (#4297).Checked for overlap
27065c382dto0fc96f45ec@andrewpozdnakov7-jpg on GitHub · 2026-12-01 16:35 UTC · original
#4986 has another report of the exact failure this PR handles. The 21,766,144-byte upload returned
0x8007000Eimmediately before the snapshot failed with that same byte count. Log breakdownI checked the test on
0fc96f45. It snapshots seven dirty bytes and only changes which variable owns the upload. It doesn't force the first allocation to fail, so in a healthy test run it still exercises the single-buffer path. Could the test reject only that first allocation and use a dirty range crossing the 4 MiB boundary? Then the existing readback assertions can check the piecewise path, including that bytes outside the dirty ranges stay untouched.@mcozcan on GitHub · 2026-12-01 17:03 UTC · original
@andrewpozdnakov7-jpg thanks for the #4986 report, and you're right about the test. On
0fc96f45it only moved the upload into aVec. The first allocation never fails there, so it checks the single-buffer path and nothing else.I've prepared the test you describe. It will go on this branch once it's built and run here, which can't happen for the next few hours:
snapshot_private_rangesnow hands its allocations tosnapshot_private_ranges_with, which takes the buffer maker as a parameter. The run path calls it withupload_buffer, so the code it runs is the same.a_snapshot_refused_whole_goes_in_pieces(host/upcheck.rs): the destination is 8 MiB + 64 bytes, and the dirty ranges are(2, 5)and(4 MiB - 7, 8 MiB + 9), so one range is longer than a piece and crosses the 4 MiB mark. Its maker refuses only the first request (the whole sum) and makes the rest withupload_buffer.[4 MiB + 19, 3, 4 MiB, 16]: the small range alone because the next piece doesn't fit beside it, then a full piece, then the tail. It checks that three uploads are kept, and then reads back every byte of the destination. Bytes in the dirty ranges must match the source, which is overwritten with0xffafter recording. Every other byte must still be the0xccfill. The source pattern never contains0xccor0xff, so a byte that was skipped or copied late shows up.The existing seven-byte test stays as the single-buffer case.
@andrewpozdnakov7-jpg on GitHub · 2026-12-01 17:45 UTC · original
I ran the exact snapshot helper and both test bodies from
319b7019on Windows with Rust 1.98.1 and the D3D12 WARP adapter. Both passed in a standalone harness with committed D3D12 buffers.The new test refused the 4,194,323-byte request, then recorded three uploads of 3, 4,194,304 and 16 bytes. After the GPU fence completed, every dirty byte matched the original source despite the source being overwritten after recording, and every byte outside the dirty ranges retained the sentinel. The seven-byte test also passed on the single-buffer path. This covers the copied bytes and the allocation split in isolation. The outstanding field check is recovery on the original machine under sustained memory pressure.
@trustno1-coder on GitHub · 2026-12-01 18:37 UTC · original
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed