Batch consecutive pool-page mappings in an opt-in mode #1063
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!1063
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1063"
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?
@gmankab on GitHub · 2026-11-25 18:07 UTC · original
gmankab:perf/batch-page-mapping-runs→main· +192 −40 · 4 files · 2 commits · draftTexture streaming can spend substantial time replacing one host view per mapped page. This experiment combines consecutive pool-page requests and maps one host view when the backing pages are also consecutive in the same section.
Enable with
VICTORY_BATCH_PAGE_MAPPINGS=1. Overlapping source and destination ranges and repeated-page mappings retain their original order. A failed joined request retries the original requests. A successful multi-page view can later be split by an ordinary one-page update.The queue fixture passed, and all 12 XMem tests passed with the switch on and with it off. The XMem fixture verifies the common allocation base and reads both neighbors after a one-page replacement.
In a separate Win32 API microbenchmark under Wine, 4,096 updates of four pages took 821–830 ms with individual views and 196–197 ms with a four-page view. Both modes verified the bytes they mapped. That measures the remap calls in isolation.
Paired RX 6800 title run
Both 420-second Series S runs used the same instrumented executable, input sequence, and separate reflink clones of one Wine prefix.
VICTORY_BATCH_PAGE_MAPPINGSwas the only setting changed. Both runs opened the story archives and reached 3D rendering.The loading window covers 10 to 120 seconds after the story archive opened. The 3D window starts at the first host report with at least 500 draws per frame and covers 162 seconds. Draw counts differ between the two 3D samples. This pair provides insufficient evidence for a repeatable FPS gain or a texture-correctness claim, so the switch stays opt-in and the PR remains a draft.
Depends-on: #1060
Tested-on: RX 6800, Xeon E5-2670 v3, Fedora Linux 45 x86_64, Wayland, Wine and RADV in the Victory Flatpak. Synthetic tests used the same Wine environment with DRM devices hidden.
Assisted-by: gpt-6.2 sol xhigh
@tikD1337 on GitHub · 2026-11-25 19:22 UTC · original
Heads-up: I'm testing this PR right now on native Windows 11 + NVIDIA (RTX 4070 Ti SUPER, Ryzen 5 7600), Series X profile, merged on current
main. Three scripted launches withVICTORY_BATCH_PAGE_MAPPINGS=1and three without, same diagnostics build: failed multi-page views, remap time per frame, frame time while streaming, and frame captures compared for corruption. Results here in about 20 minutes.For context, on the same machine a plain batch WITHOUT coalescing the destination's one-page placeholders failed 4,913 of 47,808 multi-page views with error 487 in
MapViewOfFile3(MEM_REPLACE_PLACEHOLDER), leaving pages unmapped, which looks like the cause of the black and red faces in the README's reverted attempt. So the coalescing step in this PR matters.@tikD1337 on GitHub · 2026-11-25 20:09 UTC · original
Tested on native Windows 11, RTX 4070 Ti SUPER (driver 621.01), Ryzen 5 7600, Series X profile: a diagnostics build of
origin/main(d510ee4) with this PR merged, plus counters of my own around the batch path (not part of the PR). Launcher switchesASYNC_SUBMIT QUEUE2 TEXTURE_NO_WAIT WIDE_REFRESH JOIN_PARTS BACK_OWN_VIEW, warm cache. Every run is the same 330 s script: menus, then the opening cutscene, then standing in the prison, with no input after the menu. 3 runs withVICTORY_BATCH_PAGE_MAPPINGS=1and 3 without, alternating, all on the same build.The batch path is used. Each run asks for about 20k multi-page mappings, nearly all of them one run of one section.
MapViewOfFile3failed (487)mapping physical pages failedWARN, about 2.3–2.6k lines a run.MEM_RELEASE | MEM_COALESCE_PLACEHOLDERSonly accepts a range made of whole placeholders. It is refused when the first or the last placeholder reaches past the range, for example a leftover piece of a larger view thatunmapsplit, or the untouched part of the reservation.VirtualFree(base, 64K, MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER)and the same forbase + len - 64K, then coalesce. In my own variant of the batching, which does that, 3 runs of about 50k multi-page views each had 0 failures.Speed: remap time falls, frame time does not. Means over all world frames (more than 1,000 draws a frame) of the 3 runs:
My variant showed the same pattern: 50.9 vs 83.6 ms remap, 212 vs 204 ms frame. In every run the frame log's
RemapWaitUsis at most 0.2 ms/frame: the remap time is spent holding the lock, not waiting for readers. See #1069.Picture.
Verdict. Correct mapping on Windows, no frame-rate gain on this machine, and an open question about the different picture in some batched runs.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.