ReadFile: VICTORY_READ_BOUNCE, large reads through a buffer of ours (start-up int3: shader database read with runs of zeros) #368
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/368"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by afutuga on 2026-11-27T21:31:58Z.
PC: Windows 10 22H2 (19045), RTX 4060 Ti 16 GB, Ryzen 7 5700X (8 cores, 16 threads), 32 GB.
Built from source, release profile. This PR now holds one commit, which merges cleanly into
current
main(the earlier DirectStorage-workers commits are gone:mainhas its ownVICTORY_DSTORAGE_WORKERSnow, and they were not the cause).The problem
In streaks of hours, every start ended about 2 seconds in with the title's own breakpoint:
(
+0x22106e0isint3; ret, reached from an assert-not-null at+0x2a34d0.)What it was
+0x2499630,SGD5files): it reads a 0x90 headerand a size from its stream, allocates the size, and asserts the pointer. The size was 0.
0x520000000),valid at its start and end, but a run of zeros (512 KiB or 1 MiB, 64 KiB aligned) where it was
reading.
+0x313fc0→ the file device'sReadBulk→ oneReadFileof271,044,608 bytes, straight into pages the title mapped just before with
XMemMapPhysicalPagesScatter(same thread, the mapping call returned first).ReadFilereturned TRUE with every byte read: 3-9 runs of 64 KiBblocks of zeros already there. The views were
MEM_COMMIT,PAGE_READWRITE,MEM_MAPPED, thesame as their neighbours with bytes; no pages were uncommitted before the read; no mapping call
touched the range during it; reading the file again at that offset gives the bytes.
So the kernel's write into those mapped physical pages does not land, now and then, while the
call reports success. I did not find why; whatever it is, a user-mode copy does not lose them.
This change
VICTORY_READ_BOUNCE=1: a titleReadFileof 64 KiB or more reads into a buffer of ours,8 MiB at a time, and copies it into the title's memory from user mode (as
freadalready doesfor the guards). An asynchronous handle's read is waited for, so the call stays synchronous, as
the title's are. Off by default.
Results in the same hours: with it, no run of zeros after the read and 8 starts of 8 (3 in a
diagnostics build, 5 in release); without it, the stop as before (two control starts: one stopped).
The extra copy costs a few tens of ms for the 271 MiB file. It may be worth having on by default
once someone else confirms it.