Repository navigation
GPU: a title copy makes due again only the copies it writes - #12
Merged
Merged
Conversation
A title memory copy (Step::Copy) or memory-to-memory copy (Step::Run) at submission cleared every copy's current ranges, so each list after it checked every copy again: ~30 tiny copies a frame, most of the ~90,000 watch checks a frame, nearly all finding nothing changed. Both steps know the range they write: the batch now cuts only that range (whole pages, plus the pages showing it at other mappings) out of the current ranges; copies not tracked are due again whole as before. An earlier attempt at this crashed the title after ~160 s: marked pages the title's threads wrote after a list took them, but before a later list armed them, were no longer taken again in the submission, so their copy-back kept the title's bytes and dropped the shaders' (~20 such pages a frame instead of ~1). The batch now remembers the ranges shaders write through marks and, before the lists run, takes what changed in them once more (`Batch::finish`): armed and taken, a title write there saves the page's bytes as intended. World (RTX 5090, upload heaps, lazy copy-back): preparing ~190-217 -> ~166-196 ms/frame, watch checks ~92,900 -> ~69,500, refresh batches ~57-71 -> ~49 ms; marked pages keeping the title's bytes stay ~1 a frame; stable for 300 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A title memory copy at submission (
Step::Copy, orStep::Runfor memory-to-memory copies) used to clear thecurrentranges of every host copy in the batch. After each of the world's ~30 tiny title copies per frame, every later list checked every copy again (most of the ~90k watch checks per frame, almost all finding nothing).Batch::title_wrote(at, len)flushes the pending refreshes as before, but takes only the written range out ofcurrent, rounded out to whole 64 KiB pages and including pages that show it at other mappings (watch::aliased_pages). Copies that aren't tracked are still due again in full.Step::Run/HostList::defernow carry the range they write.b3864d6, about 160 s into the world): marked pages that title threads wrote after an earlier list in the submission took them, but before a later list armed them, were no longer taken again inside the submission. Their copy-back kept the title's bytes and dropped the shaders' bytes: "kept the title's" went from about 1 to 14–26 per frame in that run, and then the title crashed reading -1.Batch::finish(which replaces the final flush) takes what changed in those ranges once more, just before the lists run, so the pages are taken and armed together.Measured (one 300 s world run; RTX 5090,
VICTORY_GPU_UPLOAD=1 VICTORY_GPU_UPLOAD_WRITES=1 VICTORY_LAZY_COPY_BACK=1)The run stayed stable for the full 300 s: no device removal, no access violation, and the world scenes render.
Tests
a_title_write_refreshes_only_the_copies_it_reaches: covers the written copy, an alias of it, an untouched copy that stays current, and thefinishretake of an armed range.title_wrote.🤖 Generated with Claude Code