Repository navigation
Conversation
… views from the journal A submission's refreshes of one host copy were merged into the single range covering them all. Two small ranges at the low and high ends of a big shared buffer then had the whole untouched middle asked for written pages (and its stale pages copied). The batch now keeps each copy's ranges and merges only those whose 64 KiB pages overlap or touch, at the flush. `watch::writes` for guarded memory asks the kernel first, which fails for views, and then `guard` queries the view. When every block of the range is already guarded and clean, nothing was written there: the journal answers without either system call. `JOURNAL` is still taken before `GUARDS`; nothing takes them the other way round. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ean guarded views from the journal Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @kxiserino for this journal-backed range handling. I tested head Result: 4 passed, 0 failed. The watch tests cover clean guarded reads answered from the journal, partially clean ranges falling back to the kernel, guarded kernel reads, and reporting written pages to all askers. These are synthetic watch/journal unit tests, not a title workload. |
Plan only requested pages outside pending GPU writes. Use a verified reservation extent for dense groups and share a fresh observation within each group. Query journal chunks against the oldest valid shadow bytes. Adapt the clean guarded-memory path from PR Marvisak#393 and the guarded view lookup cache from PR Marvisak#490. Remap and allocation notifications invalidate their proof. Preserve exact byte coverage and journal observations across mixed allocations, including the wholly reserved case examined in Marvisak#515. Co-authored-by: KaiserBloo <kaiserbloo@protonmail.com> Co-authored-by: wrothgaril <211408787+wrothgaril@users.noreply.github.com>
|
Measured in the world on an RTX 4070 SUPER + i7-13700KF (diag build, same ~20-PR stack before and after, 2 minutes in the world,
What remains on that path here is ~81,000 guard page faults per frame and ~136 MB of unchanged textures hashed per frame, so the frame time only moved from about 550 to 500 ms; #185's per-reservation write-watch looks like the next step. 🤖 Generated with Claude Code |
…s from journal (PR Marvisak#393) Merge Batch refreshes per 64 KiB page rather than spanning untouched middles of large buffers, and answer clean guarded ranges from the watch journal without kernel or page-guard syscalls.
…s (PR Marvisak#693) Allocate Shadow host copies in D3D12_HEAP_TYPE_DEFAULT VRAM and stage dirty 64 KiB page uploads and pre/post GPU-write readbacks through pooled 4 MiB StagingArenas, integrated with bindless prepare (Marvisak#413), page-coalesced refreshes (Marvisak#393), and lock-free retirement (Marvisak#609). Update raw_view_tests::unknown_stride_reads to stage via DEFAULT buffers.
|
Test report on a 6 GB / 16 GB laptop: this PR takes write-watch time from 475 ms to 13 ms per world frame, and frames get 16% shorter. Setup: RTX 3050 6 GB Laptop (NVIDIA, driver 32.0.16.2124), i7-13700H, 16 GB RAM, Windows 11 26300, diag build. Title 1.0.2.1, Series X profile, the story load. Base tree:
Not tested: more than one run, a release build, AMD. I didn't check correctness beyond the run not failing (no device removal or title stop in the 300 s window). AI use: Claude Code (Claude Opus 5.5) built the trees, ran the title on my machine and drafted this report; results are from the runs described. |
…er clean guarded views from the journal
Refresh ranges are kept separate and merged only where their 64 KiB pages touch, so the untouched middle of a big buffer is neither checked nor copied; clean guarded view ranges are answered from the journal without a GetWriteWatch kernel call; and copy-back caches pages already compared against the snapshot so overlapping ranges skip them. Ported from Marvisak/VIctory Marvisak#393 and Marvisak#124. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…er clean guarded views from the journal
Summary
Two costs in the per-submission refresh of host buffer copies.
Batch::addmerged every range of a copy into one bounding range. A submission that reads a few small ranges at the low and high ends of one big shared buffer (a heap of over 100 MB, say) then hadShadow::updateaskwatch::writes(and soGetWriteWatch, or the guard walk) about the whole untouched middle, and copy whatever was stale there, though nothing declared it read.Batchnow keeps aVec<(from, to)>per copy. At the flush,coalesce_ranges(&mut ranges, watch::PAGE)sorts them and merges ranges whose 64 KiB pages overlap or touch (next_from / page <= cur_to.div_ceil(page)). Ranges with a whole untouched page between them stay apart, and each one is updated by itself.address + lensaturates.pending) are skipped byupdateas before.watch::writes(.., guarded = true)on a clean guarded view. Views can't be write-watched, so every asking first calledGetWriteWatch, which fails for them, and thenguard'sVirtualQuery. If every block of the range is already guarded and still clean, nothing has written there since it was guarded: a title write faults into our handler, which removes the block fromclean.writing()andtitle_memory_remapped()remove it too. So the journal already has the answer.guarded && first < lastandguards().clean.range(first..last).count() == last - first, skip both syscalls, bumpaskedand returnwritten.range(first..last)as usual.JOURNALis taken, thenGUARDS, the same orderguard()already uses.install(),guard(),open(),writing(),title_memory_remapped()and the vectored handler only ever takeGUARDS, and none of them takeJOURNAL. Nothing takes the two locks in the opposite order, so this can't deadlock.constassert pinsBLOCK == PAGE, which the fast path relies on (blocks are pages).Related: #119 makes
guard's query cheaper. This change skips the query when every block is clean, so the two complement each other.Testing
All the tests are synthetic: they use their own allocations and pagefile sections, and no title data.
host::batch:empty_ranges_are_dropped,ranges_in_one_page_merge,ranges_in_touching_pages_merge,ranges_pages_apart_stay_apart(low and high ends of a 256 MiB range),ranges_at_the_top_of_the_address_space_do_not_overflow.watch::tests::clean_guarded_views_are_answered_from_the_journalcovers repeatedwrites(.., true)on a clean mapped section. A test-only thread-local counter shows the kernel isn't asked again, and the answer stays the same. A later title write (through the handler),writing()andtitle_memory_remapped()are each still reported, then the range settles back onto the fast path.watch::tests::partly_clean_ranges_ask_the_kernelchecks that a partly guarded range still takes the slow path, and that unguarded askers never take the journal's word.written_pages_are_reported_to_every_askercould see stale entries if its allocation lands at the same address.Results:
cargo test -p victory-gpu: 50 passed. With-- --test-threads=1: 50 passed. With--features diagnostics -- --test-threads=1: 52 passed.cargo clippy -p victory-gpu --features diagnostics -- -D warningsand the same without features: clean.cargo clippy -p victory-gpu --all-targets [--features diagnostics] -- -D warnings: the only error is the existing missingSAFETYcomment athost.rs:267onmain, which Chore: clear two workspace Clippy errors #355 fixes. With that line patched locally, both are clean.cargo xtask policy:asset policy: 151 files ok.In-game frame time is not measured here.
🤖 Generated with Claude Code