Memory: windows of title memory in place over the page pool, soft writes (12-13 GB at copies' speed under Proton) #2776

Open
github-bot wants to merge 31 commits from github-bot/gh-2776 into main AGit
Owner

@⁠kc01-8 on GitHub · 2026-11-29 17:10 UTC · original
kc01-8:kc/memory-in-place → main · +1177 −46 · 11 files · 31 commits · open

What this does

Windows of title memory in place over the page pool, through views of our own, instead of copies; and the rest of what makes that fast. Everything is off unless asked for: nothing changes for anyone who does not set these.

Switch Does
VICTORY_INPLACE=1 + VICTORY_INPLACE_VIEWS=1 windows over the page pool are the title's own pages, mapped through views of our own (inplace::OwnViews), not copies the card pins
VICTORY_INPLACE_VIEWS_CHURN=4 a pool cell the title lets go 4 times gets copies (cells remapped all the time cost more as views)
VICTORY_SOFT_VIEWS=1 (F1: SOFT VIEWS → ALL) the title's mapping calls kept in the runtime's books too, not only its page-mapping copies; new here: what shaders wrote goes into such a view's pages through the section (SoftViews::write), instead of making the view real

Also in these commits, active only with the switches above:

  • a pool window in place goes only when the pages read through it change, and the heap slots that showed it are made again (with VICTORY_INPLACE_VIEWS, trustno1's re-make for growing windows runs for them too);
  • windows in place are indexed by their 64 KiB pages, so a remap looks only at its own pages' windows (was 1.5–3.4 s a frame of the runtime's remap notes);
  • windows are made with no lock on their table (a window takes milliseconds under Wine; readers of the table waited 17–19 ms at a time);
  • the write watch is not asked about views of the title's pages (the system refuses it, and under Wine even the refusal waits on its address-space lock), nor again about a range it refused until its mappings change;
  • a view the runtime made real is opened without waiting for the guards' lock (that wait deadlocked against the runtime's own lock);
  • counts of views mapped and unmapped every 10 s, and of pool cells let go 1, 2, 4 ... 32 times.

Measured

RTX 3080 Ti 12 GB, Ryzen 7 5800X3D, 32 GB, Linux 7.3 with Proton Experimental and vkd3d-proton, Series X profile, 1440p. Each run is in docs/kc-linux-status.md of kc01-8/VIctoryNVIDIALINUX (branch kc/foxhound).

memory that could not be reclaimed fps over 60–240 s
page-pool windows as copies 15.4–16.6 GB (4.4 GB of it the driver's pins of the copies) about 10
in place, before soft views 11.9–13.4 GB 4.9 (the wineserver at 68 % of a core)
in place + VICTORY_SOFT_VIEWS=1 + soft writes 12.1–13.4 GB about 10 (wineserver 3 %), 14–16 in play

So copies' frame rate at about 3 GB less memory. The wineserver part (every map/unmap walks the process's ~90,000 views under Wine) is Proton's; the memory part should hold on Windows too, but I have not measured it on Windows.

Merge notes

Picked onto today's main (829188e9). Where it met newer code: windows that grow (VICTORY_WINDOW_GROW) keep the page index when they take a window's place, and the in-place staleness check is on the normal path only. The two have not been run together. made_window is called with the table's lock let go; carded takes only its own lock.

Tests

Under Proton's Wine (no D3D12 debug layer), without the diagnostics feature: victory-gpu 905 passed / 14 failed, victory-hle 417 / 6. main alone gives 901 / 14 and 417 / 6, the same failures (Wine: placeholders, ws2_32, NTFS links and others). The diagnostics build of main does not compile at the moment, before these commits: copystat.rs:1350 calls an mb() that is not there, and in host.rs around line 9168 a local timing shadows timing().

Where this comes from

kc01-8/VIctoryNVIDIALINUX, branch kc/foxhound: the title on Linux under Proton on an RTX 3080 Ti, with every run's numbers in docs/kc-linux-status.md and the plan in its README. Also from there: the frame recorder and replay working under vkd3d-proton, a hang watcher that dumps every thread's place without the loader lock, and a fix for a double unlock in vkd3d-proton's memory budget lock.

🤖 Generated with Claude Code

**@⁠kc01-8** on GitHub · 2026-11-29 17:10 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2776) `kc01-8:kc/memory-in-place` → `main` · +1177 −46 · 11 files · 31 commits · open ## What this does Windows of title memory **in place** over the page pool, through views of our own, instead of copies; and the rest of what makes that fast. Everything is **off unless asked for**: nothing changes for anyone who does not set these. | Switch | Does | |---|---| | `VICTORY_INPLACE=1` + `VICTORY_INPLACE_VIEWS=1` | windows over the page pool are the title's own pages, mapped through views of our own (`inplace::OwnViews`), not copies the card pins | | `VICTORY_INPLACE_VIEWS_CHURN=4` | a pool cell the title lets go 4 times gets copies (cells remapped all the time cost more as views) | | `VICTORY_SOFT_VIEWS=1` (F1: SOFT VIEWS → ALL) | the title's mapping calls kept in the runtime's books too, not only its page-mapping copies; **new here:** what shaders wrote goes into such a view's pages through the section (`SoftViews::write`), instead of making the view real | Also in these commits, active only with the switches above: - a pool window in place goes only when the pages read through it change, and the heap slots that showed it are made again (with `VICTORY_INPLACE_VIEWS`, trustno1's re-make for growing windows runs for them too); - windows in place are indexed by their 64 KiB pages, so a remap looks only at its own pages' windows (was 1.5–3.4 s a frame of the runtime's remap notes); - windows are made with no lock on their table (a window takes milliseconds under Wine; readers of the table waited 17–19 ms at a time); - the write watch is not asked about views of the title's pages (the system refuses it, and under Wine even the refusal waits on its address-space lock), nor again about a range it refused until its mappings change; - a view the runtime made real is opened without waiting for the guards' lock (that wait deadlocked against the runtime's own lock); - counts of views mapped and unmapped every 10 s, and of pool cells let go 1, 2, 4 ... 32 times. ## Measured RTX 3080 Ti 12 GB, Ryzen 7 5800X3D, 32 GB, Linux 7.3 with Proton Experimental and vkd3d-proton, Series X profile, 1440p. Each run is in [docs/kc-linux-status.md](https://github.com/kc01-8/VIctoryNVIDIALINUX/blob/kc/foxhound/docs/kc-linux-status.md) of [kc01-8/VIctoryNVIDIALINUX](https://github.com/kc01-8/VIctoryNVIDIALINUX) (branch `kc/foxhound`). | | memory that could not be reclaimed | fps over 60–240 s | |---|---|---| | page-pool windows as copies | 15.4–16.6 GB (4.4 GB of it the driver's pins of the copies) | about 10 | | in place, before soft views | 11.9–13.4 GB | 4.9 (the wineserver at 68 % of a core) | | in place + `VICTORY_SOFT_VIEWS=1` + soft writes | **12.1–13.4 GB** | **about 10** (wineserver 3 %), 14–16 in play | So copies' frame rate at about 3 GB less memory. The wineserver part (every map/unmap walks the process's ~90,000 views under Wine) is Proton's; the memory part should hold on Windows too, but **I have not measured it on Windows**. ## Merge notes Picked onto today's `main` (829188e9). Where it met newer code: windows that grow (`VICTORY_WINDOW_GROW`) keep the page index when they take a window's place, and the in-place staleness check is on the normal path only. The two have **not been run together**. `made_window` is called with the table's lock let go; `carded` takes only its own lock. ## Tests Under Proton's Wine (no D3D12 debug layer), without the diagnostics feature: victory-gpu 905 passed / 14 failed, victory-hle 417 / 6. `main` alone gives 901 / 14 and 417 / 6, **the same failures** (Wine: placeholders, ws2_32, NTFS links and others). The diagnostics build of `main` does not compile at the moment, before these commits: `copystat.rs:1350` calls an `mb()` that is not there, and in `host.rs` around line 9168 a local `timing` shadows `timing()`. ## Where this comes from [kc01-8/VIctoryNVIDIALINUX](https://github.com/kc01-8/VIctoryNVIDIALINUX), branch `kc/foxhound`: the title on Linux under Proton on an RTX 3080 Ti, with every run's numbers in `docs/kc-linux-status.md` and the plan in its README. Also from there: the frame recorder and replay working under vkd3d-proton, a hang watcher that dumps every thread's place without the loader lock, and a fix for a double unlock in vkd3d-proton's memory budget lock. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
VICTORY_INPLACE_VIEWS=1 (off by default, with VICTORY_INPLACE): a window
outside buffers over the title's page pool is no longer copied. The pool
pages it covers are mapped again, in order, into a range of our own (a
page of zeros where the title shows none), and that range is opened as
a host heap by its address (OpenExistingHeapFromAddress1). Windows
refuses such a range; vkd3d-proton passes it to the driver
(VK_EXT_external_memory_host). Under Proton these windows are most of
the GPU copies kept in the PC's memory (run 25: 2.4 of 3.9 GB).

The views stay mapped until the buffer and heap are gone (the shadow's
last field). The in-place let-go on a remap now looks as far below a
range as the longest window in place. The probe gains a case that maps
section pages out of order with a hole and checks the GPU reads them in
that order. Not run on the GPU yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 44a54dd5959d72c59001c6911c1c32da8bb26d9e)
(cherry picked from commit 3522237aa8e135dbddb1136625f52eb480af3b9a)
Run 27 (VICTORY_INPLACE_VIEWS=1) peaked at 15.0 GB instead of reaching
the 18 GB cap, but every unmap under a window over the page pool let it
go: 2,544 in four minutes, each opened again later. And descriptor slots
that showed a window let go kept showing its old pages: the memory
line's count of slots showing another copy than the one brought up to
date was 68,178, against 6 and 9 in runs 24 and 25.

- A window over the pool records what each of its pages shows. It is no
  longer let go when the title unmaps a page, only when the title maps a
  different section page there (title_memory_view). Both cases are
  counted on the in-place line.
- Copies in place taken out of the tables are marked. When any were,
  the pass over the view heap's buffer views makes again the slots that
  showed one, from the copy their view finds now (remake_later). They
  are counted on the memory line.
- Windows over the pool lock no new memory, so they no longer count
  against VICTORY_INPLACE_MB (run 27 turned 7 private windows down).
- profiles/linux-nvidia.env: VICTORY_NO_WATCHDOG=1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit a8516281a1303f7ff0b92b026fd28db3c03ed0b0)
(cherry picked from commit f64330a1b3438b917a83c892da09cb7acb817efa)
Run 28 let go 1,529 windows over the page pool in four minutes even when
only a different page let one go, and not one remap mapped the same page
back: a 4 MiB window covers streamed texture pages beside what is read
through it. Each window now notes the part asks read (an ask without a
length reads to its end). A different page mapped into that part lets the
window go at once; elsewhere the page is only marked changed, and the
window goes at the first ask that reaches a changed page. Both counted on
the in-place line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 25775a3538fe9df782d40bd1987145f8cce2a255)
(cherry picked from commit 22ab3e4b0ffd5c4ae99eb5f2674bc000737ec43f)
The pass over the view heap's buffer views keeps, per slot, the copy it
found, not the one the host slot shows. A slot the title wrote after the
window it showed was let go got the new copy noted while still showing the
old one, so the scan for slots that show a let-go copy missed it (run 29:
17,239 such looks four minutes in). The pass now compares the slot with
the copy it found every time (HostHeap::shows, no longer diagnostics only)
and, while windows over the pool are in place (VICTORY_INPLACE_VIEWS), makes
a mismatched slot again at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit e091779008dd93768ea650c1c483ebee6d9695cf)
(cherry picked from commit 63c8c88d10303a80915156cc355974a275eb7481)
Every remap looked through the windows table for each window in place
that could reach the page, as far below as the longest such window: the
runtime's own notes of its remaps took 1.5-3.4 s a frame in runs 28 and
31 against 135-207 ms in run 24, with the lock held that texture
refreshes wait for. Windows in place are now noted on the 64 KiB pages
they cover, and a remap looks only at its own pages' windows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit fdf2f779a4ef2f2934d5850fabac7890c9a9a76a)
(cherry picked from commit 2df8bafedb07dd8a2debf40dd104df549bcd2151)
Under Wine GetWriteWatch still took about 1.3 ms when it refused, and with
the title's views kept in the books (VICTORY_SOFT_VIEWS) every asking was
refused: 258 a frame in run 35, 325 ms of the threads' time a frame. A
refused range goes to the guards, which is right for any memory. Refused
ranges are now remembered, forgotten when a mapping in them changes
(title_memory_changed) and every ten seconds.

The watch tests give the same result as before (43 pass; the same 4 fail
under Wine without this change too).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 15f6ded0a865de068544bae161aee6ea00689f3f)
Under Wine each view mapped or unmapped is a request to the one-thread
wineserver: with every window over the page pool in views of our own
(run 39) it took 81% of a core, about 2,000 views mapped and as many
unmapped a second, and the title's threads queued behind it. With none
(run 41) it fell to 30% and frames ran 8-14 fps instead of 1.3-15, but
the copies' memory, which NVIDIA's Linux driver pins, rose from 0.2 to
4.4 GB. A cell whose views window was let go VICTORY_INPLACE_VIEWS_CHURN
times (2 unless set; 0: never) now gets copies from then on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 534bf3bc1aa61bc847aef3c42ebd9533db7ed215)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit dcc2ae9866452789c7754b41872e2cf79b85f7a1)
At 2 (run 42), 800-880 page-pool cells had gone to copies by 3-5
minutes and the run reached the 18 GB cap: the churn is spread over most
cells. Off until the cells' counts say where a limit pays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit d84f1f6ac31a6cce345d3bd764a5f2df9df6af45)
The system refuses it for a view, and under Wine even the refusal waits
on its one lock for the address space: 216 of 219 askings a frame were
refusals (run 62); the submitting thread's askings were 633 ms in 2
seconds (run 66). The runtime's books say what is a view.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit dc7ad00b6d4f5b65e5b8fc3d199d99c18e318636)
sources() asked about every 64 KiB page in no view (up to 64 a window):
961 queries in run 68's timeline, 2.8 s of waits on Wine's one lock for
the address space. An answer covers a region of one state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 384c3aa02596103d08317ea4d666127a27b73938)
reads_end made a window (views of the page pool mapped through the
wineserver, buffers made) with LOOSE held for writing, and every reader
waited for it: in run 62's timeline landing jobs waited on it 17-19 ms
at a time, and landings were a fifth of the frames' chains. Now the
window is made with no lock and put in under it; one another thread made
meanwhile is taken instead, and one in place over memory the title
mapped anew meanwhile is made again under the lock. The statistics that
only look at the table take it for reading (they took it for writing
since it was a Mutex). In run 66's timeline landing jobs were off the
frames' chains.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit d12ee4b090e3dd36169f39ebd9f21d2d6e525041)
Under Wine each map and unmap is a request of the wineserver's, and the
server walks the process's whole list of views for each (is_valid_view_addr,
find_mapped_view): perf of the wineserver in run 71 found it 89% busy, 95%
of that in those two walks. The line says the runtime's and the in-place
windows' maps and unmaps over the last 10 s and the views each holds: in
run 72, ~77,000 of the runtime's and ~11,000 of the windows', and the
windows made 3/4 of the requests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit f34ba069a02a6861ea9d59dcca7d48c0d004d676)
write_mapped made every view the runtime keeps in its books alone
(VICTORY_SOFT_VIEWS) real before putting back what shaders wrote: a map
of the host's and later an unmap, each a request of the wineserver's
that walks the process's views (2,135 views in 10 s asked for by the GPU
side, run 85). The runtime now writes those bytes into the view's pages
through the section's own view, as DirectStorage's writes and the GPU
side's reads already go (SoftViews::write); the caller has told of the
write, which counts at every address the page is shown at. Memory in no
such view is written as before.

Run 87 against 85, over 60-240 s: the wineserver from 31 % to 3 % of a
core, maps and unmaps in play from thousands to tens in 10 s, 8.36 fps
to 10.10 (14.6-15.6 from 120 s on), the title drawing about 4,800 draws
a frame where it drew 3,200.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 37b6eba01b634e071b155a6e0ef0eb78aadd690e)
title_memory_made_real waited for the guards' lock with the runtime's
lock on its views held. 76 s into run 91 the whole process stood still,
the title's mapping calls included: a thread that holds the guards and
touches a view kept in the books faults, and the handler has the runtime
make it real (Rust's lock is not taken twice by one thread); or one
holds the guards and asks the runtime to make a view real while another
holds the runtime's lock and waits here. With every mapping call of the
title kept in the books (VICTORY_SOFT_VIEWS=1) views are made real
thousands of times in 10 s while the world loads.

Held elsewhere, the lock is not waited for: the view goes on a list that
the next to take the lock opens first (guards()), as every asking does,
so it counts as written at the next asking as before. The soft-view
guard test now tells of it with the lock held on its own thread.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 2c0b7f09fac742e0cd7533ed0a6e0c0ac0cfb72a)
The item knew only copies (ON) and off. With the views of the title's
mapping calls kept in the runtime's books as well as those of its
page-mapping copies (=1), the wineserver under Proton went from 69 % to
31 % of a core and the frame rate over 60-240 s from 5.35-5.49 fps to
8.36 (RTX 3080 Ti, kc01-8/VIctoryNVIDIALINUX run 85); with the soft
writes before this, 3 % and about 10 fps.

(cherry picked from commit 2d9338513162f03cce46dfd85fd8a45d8850fee9, the menu part)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 17:11:27 +00:00
Author
Owner

@⁠agentiverse on GitHub · 2026-11-29 21:24 UTC · original

was_refused also rejects sub-ranges of a refused range (46090991)

was_refused(first, last) returns true for any range inside a cached refusal. When a merged range in ask_rest (or a half in ask_run) is refused because it crosses into memory that isn't write-watched, kernel_written caches the whole merged range, so the per-piece retry that follows is refused without asking, including pieces that are write-watched. For non-view memory the guard fallback refuses too, writes() returns None, and Shadow::update_free marks the shadow NOT_WATCHED for good. From then on every refresh of it copies the whole range, and merge_under_writes makes every overlap with pending shader writes wait for the flights.

It depends on which ranges get merged, so it's intermittent: when it hits, the "title memory changed under shader writes" settle wait is 30–50 ms per frame.

Suggested fix, treat only the exact range as refused:

fn was_refused(first: usize, last: usize) -> bool {
    refused().1.get(&first) == Some(&last)
}
**@⁠agentiverse** on GitHub · 2026-11-29 21:24 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2776#issuecomment-7262849990) `was_refused` also rejects sub-ranges of a refused range (46090991) `was_refused(first, last)` returns true for any range inside a cached refusal. When a merged range in `ask_rest` (or a half in `ask_run`) is refused because it crosses into memory that isn't write-watched, `kernel_written` caches the whole merged range, so the per-piece retry that follows is refused without asking, including pieces that are write-watched. For non-view memory the guard fallback refuses too, `writes()` returns `None`, and `Shadow::update_free` marks the shadow `NOT_WATCHED` for good. From then on every refresh of it copies the whole range, and `merge_under_writes` makes every overlap with pending shader writes wait for the flights. It depends on which ranges get merged, so it's intermittent: when it hits, the "title memory changed under shader writes" settle wait is 30–50 ms per frame. Suggested fix, treat only the exact range as refused: ```rust fn was_refused(first: usize, last: usize) -> bool { refused().1.get(&first) == Some(&last) } ```
Author
Owner

@⁠neongatzu on GitHub · 2026-11-29 23:54 UTC · original

A Windows run of this, since the description asks for one. Short version: on Windows with an NVIDIA driver the page-pool path is refused by the runtime, so it opens nothing and costs some frame time; the probe says why, and points at what would work.

PC: RTX 3060 Ti 8 GB, 16 GB RAM, Windows 11 26200.9974, NVIDIA 621.24. Series S profile, 1080 upscaled to 1440, DLSS Performance. Caveat: applied onto another fork's tree (it also carries #2910 and #2234), with two small conflicts in shadow.rs (the Shadow struct and stale_pages keep both sides).

The probe (VICTORY_INPLACE_PROBE=1) on this driver:

the device: ID3D12Device3 true, ID3D12Device13 true (parts of an allocation); heap tier 2
private memory, the whole allocation (OpenExistingHeapFromAddress): ok
private memory, a part of it (OpenExistingHeapFromAddress1): ok
a section made reserved, as the page pool is today (OpenExistingHeapFromFileMapping): REFUSED 0x80070057
a section made committed (OpenExistingHeapFromFileMapping): ok
  a buffer placed at the section's offset of a view's pages: ok
  the GPU reads the view's bytes true; the CPU reads through the view what the GPU wrote true;
  the view made read-only under the heap true, and the GPU writes it all the same true;
  the view unmapped under the heap true, the GPU's write then shows in a view mapped afterwards true
the pool through views of our own, opened by their address (OpenExistingHeapFromAddress1; VICTORY_INPLACE_VIEWS): REFUSED 0x80070057
VERDICT: ... a reserved section is refused (the pool must be made committed to be opened); the pool through views of our own: reads false

So the runtime here refuses OpenExistingHeapFromAddress1 on a view of the SEC_RESERVE pool section, the same as it refuses the section itself, while a SEC_COMMIT section opens fine, also through a placed buffer at a view's offset, and survives views being remapped, made read-only or unmapped.

What that did in play (VICTORY_INPLACE=1 VICTORY_INPLACE_VIEWS=1 VICTORY_SOFT_VIEWS=1, 8 minutes, no errors):

title memory in place: 71 windows 109 MB (0 of them 0 MB over the page pool through views of our own,
VICTORY_INPLACE_VIEWS; 6401 such refused by the host, ...)

Views of our own mapped and unmapped for those attempts: 82,925 over the run, up to 11,106 in one 10 s line. Against the same build without VICTORY_INPLACE_VIEWS/VICTORY_SOFT_VIEWS in the same area: shared memory peak 5,370 vs 5,599 MB (noise), median preparing time 58.8 vs 51.6 ms per frame, fps median 11.0 vs 11.8.

The target is right, though. The census 150 s in:

windows outside buffers: 593 of 2437 MB
  private, committed whole (a part can be opened): 62 of 89 MB
  view memory, one run of a section: 4 of 4 MB
  view memory, scattered pages: 27 of 77 MB
  view memory with unmapped pages: 326 of 1414 MB
  private but not committed whole, or guarded: 173 of 846 MB

About 1.5 GB of the 2.4 GB of windows is page-pool memory, which on an 8 GB card with 16 GB of RAM is exactly what runs the shared memory into its cap. Two suggestions, from the probe rather than measured: on Windows, make the pool section SEC_COMMIT (the probe opens that one as one heap, without locking pages); and when the probe finds the views path refused, turn VICTORY_INPLACE_VIEWS off for the run instead of trying each window.

The was_refused comment above: with this PR applied, watch::tests::ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour failed every time here. With the suggested change (refused().1.get(&first) == Some(&last)) it passes, and so does the rest of victory-gpu's library tests (1615 passed, 0 failed).

**@⁠neongatzu** on GitHub · 2026-11-29 23:54 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2776#issuecomment-7264821383) A Windows run of this, since the description asks for one. Short version: on Windows with an NVIDIA driver the page-pool path is refused by the runtime, so it opens nothing and costs some frame time; the probe says why, and points at what would work. **PC:** RTX 3060 Ti 8 GB, 16 GB RAM, Windows 11 26200.9974, NVIDIA 621.24. Series S profile, 1080 upscaled to 1440, DLSS Performance. Caveat: applied onto another fork's tree (it also carries #2910 and #2234), with two small conflicts in `shadow.rs` (the `Shadow` struct and `stale_pages` keep both sides). **The probe (`VICTORY_INPLACE_PROBE=1`) on this driver:** ``` the device: ID3D12Device3 true, ID3D12Device13 true (parts of an allocation); heap tier 2 private memory, the whole allocation (OpenExistingHeapFromAddress): ok private memory, a part of it (OpenExistingHeapFromAddress1): ok a section made reserved, as the page pool is today (OpenExistingHeapFromFileMapping): REFUSED 0x80070057 a section made committed (OpenExistingHeapFromFileMapping): ok a buffer placed at the section's offset of a view's pages: ok the GPU reads the view's bytes true; the CPU reads through the view what the GPU wrote true; the view made read-only under the heap true, and the GPU writes it all the same true; the view unmapped under the heap true, the GPU's write then shows in a view mapped afterwards true the pool through views of our own, opened by their address (OpenExistingHeapFromAddress1; VICTORY_INPLACE_VIEWS): REFUSED 0x80070057 VERDICT: ... a reserved section is refused (the pool must be made committed to be opened); the pool through views of our own: reads false ``` So the runtime here refuses `OpenExistingHeapFromAddress1` on a view of the `SEC_RESERVE` pool section, the same as it refuses the section itself, while a `SEC_COMMIT` section opens fine, also through a placed buffer at a view's offset, and survives views being remapped, made read-only or unmapped. **What that did in play** (`VICTORY_INPLACE=1 VICTORY_INPLACE_VIEWS=1 VICTORY_SOFT_VIEWS=1`, 8 minutes, no errors): ``` title memory in place: 71 windows 109 MB (0 of them 0 MB over the page pool through views of our own, VICTORY_INPLACE_VIEWS; 6401 such refused by the host, ...) ``` Views of our own mapped and unmapped for those attempts: 82,925 over the run, up to 11,106 in one 10 s line. Against the same build without `VICTORY_INPLACE_VIEWS`/`VICTORY_SOFT_VIEWS` in the same area: shared memory peak 5,370 vs 5,599 MB (noise), median preparing time 58.8 vs 51.6 ms per frame, fps median 11.0 vs 11.8. The target is right, though. The census 150 s in: ``` windows outside buffers: 593 of 2437 MB private, committed whole (a part can be opened): 62 of 89 MB view memory, one run of a section: 4 of 4 MB view memory, scattered pages: 27 of 77 MB view memory with unmapped pages: 326 of 1414 MB private but not committed whole, or guarded: 173 of 846 MB ``` About 1.5 GB of the 2.4 GB of windows is page-pool memory, which on an 8 GB card with 16 GB of RAM is exactly what runs the shared memory into its cap. Two suggestions, from the probe rather than measured: on Windows, make the pool section `SEC_COMMIT` (the probe opens that one as one heap, without locking pages); and when the probe finds the views path refused, turn `VICTORY_INPLACE_VIEWS` off for the run instead of trying each window. **The `was_refused` comment above:** with this PR applied, `watch::tests::ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour` failed every time here. With the suggested change (`refused().1.get(&first) == Some(&last)`) it passes, and so does the rest of `victory-gpu`'s library tests (1615 passed, 0 failed).
main gained its own cache of ranges the kernel refused to answer about
(#2834: per thread, exact ranges, kept 64 frames or until the title is
given memory over them). This branch's (4609099: any range inside a
cached refusal counted as refused, forgotten when mappings changed) is
dropped for it. That also fixes what the review on #2776 found: when a
merged range in ask_rest or ask_run was refused because it crossed into
memory that is not write-watched, the per-piece retries were refused
without asking, write-watched pieces too, and their shadows marked
unwatched for good. With main's exact ranges each piece is asked.
main's test of it (watch::tests::ask_rest_falls_back_per_piece_when_
touching_unwatched_neighbour) failed every time with this branch's
cache in a reviewer's run on Windows; it passes here under Proton.

Kept from this branch: views of the title's pages are not asked of the
system's write watch (crate::inplace::cover), after main's check.

Reported-by: agentiverse

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A host that refuses one such window refuses all: Windows' runtime with
NVIDIA's driver refuses OpenExistingHeapFromAddress1 on a view of the
pool's reserved section, as it refuses the section itself. A review's
run on Windows (3060 Ti, driver 621.24, VICTORY_INPLACE_VIEWS=1) had
6,401 refused in eight minutes and 82,925 views of our own mapped and
unmapped for them, each try mapping its views before asking. Now the
first 16 refused with none opened turn the path off for the run (one
warning says so); those windows are copies, as they were. Under Proton,
where vkd3d-proton opens them, nothing changes.

Suggested-by: neongatzu

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠kc01-8 on GitHub · 2026-11-30 01:42 UTC · original · edited 2026-11-30 01:47 UTC

Thanks to you both. Pushed two commits; the branch merges cleanly with main again.

The was_refused sub-range bug (agentiverse): confirmed. A merged range refused because it crossed into memory that isn't write-watched cached the whole span, so the per-piece retries were refused without being asked. Main has since gained its own refusal cache (#2834: per thread, exact ranges, kept 64 frames or until the title is given memory over them), so the merge (d3b5554d1) drops this branch's cache for main's. That's the exact-range fix you suggested, and there's one cache instead of two. Kept from this branch: views of the title's pages still aren't asked of the system's write watch, checked after main's lookup. ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour passes now.

The Windows run (neongatzu): thanks for the probe output. efac61779 adds your second suggestion: if the host refuses the first 16 windows through views of our own and has opened none, the path turns off for the run, with one warning, and those windows stay copies. So VICTORY_INPLACE_VIEWS=1 on Windows with NVIDIA no longer maps and unmaps views for thousands of refusals. Under Proton, where vkd3d-proton opens them, nothing changes. I haven't done the committed pool section on Windows: it changes the pool's commit charge, and I can't measure that here. If you can try it, it looks like the way to get those 1.5 GB in place on Windows.

Tests (Proton Experimental, victory-gpu lib): 911 passed, 15 failed, and main alone gives 907 passed with the same 15 failures. All 15 depend on the environment under Wine (shader compiler, GPU adapter, placeholder memory), and none involves this change.

CI: the red check is main's own. Clippy stops on function unwind_copy is never used (crates/victory-loader/src/crash.rs:804), and main's push CI fails the same way at 41adb5516. This PR doesn't touch victory-loader.

Full work, run logs and status: https://github.com/kc01-8/VIctoryNVIDIALINUX (branch kc/foxhound).

🤖 Generated with Claude Code

**@⁠kc01-8** on GitHub · 2026-11-30 01:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2776#issuecomment-7266368313) · edited 2026-11-30 01:47 UTC Thanks to you both. Pushed two commits; the branch merges cleanly with main again. **The `was_refused` sub-range bug (agentiverse):** confirmed. A merged range refused because it crossed into memory that isn't write-watched cached the whole span, so the per-piece retries were refused without being asked. Main has since gained its own refusal cache (#2834: per thread, exact ranges, kept 64 frames or until the title is given memory over them), so the merge (d3b5554d1) drops this branch's cache for main's. That's the exact-range fix you suggested, and there's one cache instead of two. Kept from this branch: views of the title's pages still aren't asked of the system's write watch, checked after main's lookup. `ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour` passes now. **The Windows run (neongatzu):** thanks for the probe output. efac61779 adds your second suggestion: if the host refuses the first 16 windows through views of our own and has opened none, the path turns off for the run, with one warning, and those windows stay copies. So `VICTORY_INPLACE_VIEWS=1` on Windows with NVIDIA no longer maps and unmaps views for thousands of refusals. Under Proton, where vkd3d-proton opens them, nothing changes. I haven't done the committed pool section on Windows: it changes the pool's commit charge, and I can't measure that here. If you can try it, it looks like the way to get those 1.5 GB in place on Windows. **Tests** (Proton Experimental, victory-gpu lib): 911 passed, 15 failed, and main alone gives 907 passed with the same 15 failures. All 15 depend on the environment under Wine (shader compiler, GPU adapter, placeholder memory), and none involves this change. **CI:** the red check is main's own. Clippy stops on `function unwind_copy is never used` (`crates/victory-loader/src/crash.rs:804`), and main's push CI fails the same way at 41adb5516. This PR doesn't touch `victory-loader`. Full work, run logs and status: https://github.com/kc01-8/VIctoryNVIDIALINUX (branch `kc/foxhound`). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Main (#2538) now opens one run of one section through a view of its own
(`VICTORY_INPLACE_VIEW`, `SectionView`, `place_fallback`) and keeps placed
copies in an exact list for the let-go (`PLACED`). Both stay:

- `inplace::Placed` has this branch's `cpu` and `views` and main's `keep`;
  every constructor fills all three (heap before views in drop order).
- `place_for`: the page-pool windows through views of our own
  (`VICTORY_INPLACE_VIEWS`) first, then main's `place_private`.
- `in_place_let_go`: main's `PLACED` list finds what goes; windows through
  views of our own are left to `own_views_mapped` as before, copies already
  let go are dropped from the list, the mapping change is noted with `LOOSE`
  held for writing (windows made with no lock), and `mark_gone` counts them.
- `Shadow::drop`/`placed`: both sides' bookkeeping (`views`, `place_keep`,
  the residency counts).
- `stale_pages`, `spans`: main's `Buffers::map`, read locks on `LOOSE`.

Tests under Proton (watch::, inplace::, shadow::, port::): 175 of 175 with
an ntdll that answers MemoryRegionInformationEx; on stock Proton the same 4
placeholder tests fail as on main. Whole victory-gpu suite: the 19 that fail
are main's own under Wine (the 5 new to main checked on main's build).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠kc01-8 on GitHub · 2026-11-30 16:45 UTC · original

Merged main again (25dcfe40c); the branch merges cleanly.

Main's #2538 (cwWwWwW) opens a page-pool window over our own view of one run of one section (VICTORY_INPLACE_VIEW). This PR's VICTORY_INPLACE_VIEWS covers the windows that #2538 turns down as Scattered or Holes: pages of several sections, or none, mapped again in order into a range of ours, with zeros where the title shows nothing. Both are kept, and both are off by default.

  • Placed carries both sides' fields.
  • place_for tries our views, then main's place_private.
  • The let-go uses main's exact PLACED list. Windows through our views still go only when the title maps other pages under them.

Tests under Proton (watch::, inplace::, shadow::, port::): 175 of 175 pass with an ntdll that answers MemoryRegionInformationEx. On stock Proton, the same 4 placeholder tests fail as on main. Across the whole victory-gpu suite, the 19 failures under Wine are main's own: I checked the 5 that are new on main against main's own build. The only clippy warnings left are main's (Shadow::ranged, which has no callers left on main; copystat::mb; xmem::parse_port_mode).

**@⁠kc01-8** on GitHub · 2026-11-30 16:45 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2776#issuecomment-7285176540) Merged main again (25dcfe40c); the branch merges cleanly. Main's #2538 (cwWwWwW) opens a page-pool window over our own view of **one run of one section** (`VICTORY_INPLACE_VIEW`). This PR's `VICTORY_INPLACE_VIEWS` covers the windows that #2538 turns down as `Scattered` or `Holes`: pages of several sections, or none, mapped again in order into a range of ours, with zeros where the title shows nothing. Both are kept, and both are off by default. - `Placed` carries both sides' fields. - `place_for` tries our views, then main's `place_private`. - The let-go uses main's exact `PLACED` list. Windows through our views still go only when the title maps other pages under them. Tests under Proton (`watch::`, `inplace::`, `shadow::`, `port::`): 175 of 175 pass with an ntdll that answers `MemoryRegionInformationEx`. On stock Proton, the same 4 placeholder tests fail as on main. Across the whole `victory-gpu` suite, the 19 failures under Wine are main's own: I checked the 5 that are new on main against main's own build. The only clippy warnings left are main's (`Shadow::ranged`, which has no callers left on main; `copystat::mb`; `xmem::parse_port_mode`).
The merge with main left it after `mod world_tests`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The main this branch last merged (84bd61e2c) is no longer in trustno1/main,
so the PR showed its old commits as changes. This merge takes trustno1/main
as it is now and puts back only this PR's own change; nothing is force-pushed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host/menu.rs
  • crates/victory-gpu/src/shadow.rs
  • crates/victory-gpu/src/watch.rs
  • crates/victory-hle/src/modules/xmem.rs
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.
git fetch -u origin '+refs/pull/2776/head:github-bot/gh-2776'
git switch 'github-bot/gh-2776'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2776'
git switch 'github-bot/gh-2776'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2776'
git switch 'github-bot/gh-2776'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2776'
git switch 'main'
git merge --squash 'github-bot/gh-2776'
git switch 'main'
git merge --ff-only 'github-bot/gh-2776'
git switch 'main'
git merge 'github-bot/gh-2776'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!2776
No description provided.