Repository navigation
Conversation
… it reads into: DirectStorage reads into views kept in the runtime's books (VICTORY_SOFT_VIEWS) put their bytes into the pages through the section's view, and the views stay in the books.
paales
marked this pull request as draft
November 30, 2026 01:49
Closed
1 task done
1 task done
paales
marked this pull request as ready for review
November 30, 2026 09:48
1 task done
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.
Written by 🤖:
What it changes
With
VICTORY_SOFT_VIEWS=1(orpool), the title'sXMemMapPhysicalPagesviews stay in the runtime's books, with no view of the host's. But a DirectStorage request with a memory destination (not a page list) opened its destination withvictory_gpu::kernel_writingbefore the kernel wrote the file's bytes there, and that made every soft view in the range a mapping of the host's first (watch::materialize). Then the view cost a map now and an unmap later, as without the switch.A call-site count in
watch::materialize(a local diagnostic, not in this change) showed where the views that the GPU side made real came from: in a 3.5-minute run of the intro cutscene, 35,182 of 35,183 came fromkernel_writing, for 11.5 GB of DirectStorage reads.Now
into_destinationchecks the destination first (xmem::soft_in). If views in the books show any of it, the request fills a buffer, andxmem::soft_writeputs the bytes of each soft view into its pages through the section's view (Section::window, assoft_readreads them and as page-list destinations are written). The rest of the range gets a plain copy, which faults into the GPU side's guard as the title's own writes do. The notices after the write are the same as before. The views stay in the books. Without soft views in the range, nothing changes.How it was tested
GPU and profile: RTX 5070 Ti 16 GB, 32 GB RAM, Windows 11; Series X 2560x1440, DLSS Performance, DLSS frame generation 2X, ray tracing off;
VICTORY_SAMPLED_EVICT=1,VICTORY_TEXSPK_PASS_MS=24. Each run: the intro cutscene with replayed input, 170 s from its first scene frame, saves restored first.Views the GPU side made real, per run: 35,183 before (
VICTORY_SOFT_VIEWS=1), 73 after. The soft-view line every 10 s: before, about 23,000 "asked for by the GPU side"; after, 140, of them 139 by a fault of the title's code.The title's mapping calls over the 45 s after the cut to the boat (
VICTORY_DSTORAGE_LOG,Mlines):VICTORY_SOFT_VIEWS=1, beforeVICTORY_SOFT_VIEWS=1, afterTextures picked by index that wait for the title to fill their memory, the most at the cut: 3,884 and 4,568 with soft views off (2 runs); 287 and 375 with
VICTORY_SOFT_VIEWS=1and this change (2 runs). Textures that show the neutral texture (due plus waiting for their memory) in the 40 s after the cut: 82,735 and 90,370 slot-seconds before; 43,730 and 47,710 after.fps median / 10th percentile: soft views off 25.0 / 15.4 and 25.2 / 17.9;
VICTORY_SOFT_VIEWS=1before 23.4 / 13.5; after 26.8 / 17.5 and 25.0 / 17.5.Build of these runs: v2026.11.29.04 with this change (
xmem.rsanddstorage.rsare the same as onmain41adb55 apart from this change).For shader changes, the wave sizes tested: no shader change.
cargo testpassed for the crates it touches:cargo test -p victory-hle --lib: 423 passed. A new test,soft_writes_go_into_the_pages_and_leave_the_view_in_the_books.a_read_by_range_waits_only_for_a_remapping_that_meets_itfails in the full parallel run, onmainwithout this change too, and passes alone.Checked for overlap
SoftViews::writefor what shaders wrote, the copy-back path; this is the DirectStorage path), watch: lock-free DirectStorage stream notices and soft-view guard fast paths #2655 (the notices after a DirectStorage write; this keeps them as they are), Page-mapping copies: the locks taken once a call (VICTORY_MAP_ONCE, opt-in): worst frame while the world streams 170-210 ms where it was 300-555 ms #3850 (VICTORY_MAP_ONCE: the page-mapping locks, the other side of the same contention). DirectStorage: a file released with reads of it in flight stays open until they are done #3586 and DirectStorage: a request's source and zlib intermediate are not zeroed before they are written over #3607 also changedstorage.rs: each merges cleanly with this change, also onmain.The crash in the same runs
Some runs of the intro ended with
a host command list did not close (0x80070057)at the cut into the montage, with and without this change. A run withVICTORY_D3D12_DEBUG=1named the command:CopyTextureRegionfrom aBC3_TYPELESStexture into aBC7_TYPELESStexture. The console copies the blocks as they are. Direct3D 12 refuses a copy between two block-compressed families. The title makes this copy in some runs only, so the crash came in some runs only.#3043 sends such copies through a buffer. With this change and #3043 on v2026.11.29.04, a run hit the same copy at the cut (format 78 into 99), #3043 sent it through a buffer, and the run went on. This change does not touch texture copies.