Measured on RX 9070: GPU-only VRAM copies of never-CPU-touched physical pages (placement step 4) #17

Open
opened 2026-11-30 19:00:19 +00:00 by github-bot · 9 comments
Owner

@⁠grykom on GitHub · 2026-11-30 18:58 UTC · original

Follow-up to #9, same machine and method (RX 9070 16 GB, 7800X3D, 32 GB, Linux 7.3, RADV 26.3.1; VIctory-xmem, not
VKtory; ABBA in one session, prison cell after control is handed over, scripted, diag build).

We implemented a variant of your placement step 4. Physical-pool pages that no alias was ever materialized for the CPU,
and that the card has already asked for, get a copy in 64 MiB VRAM blocks; only the card's view of every alias is
re-pointed at the copy, while the CPU keeps the RAM page, which stays the source of truth. The card's view goes back to
RAM — no copy-back needed — on the first CPU access, when an alias already mapped for the CPU is bound, and before our
own pool-window writes (DirectStorage, copies); on known card writes the slot is copied back first. Pages move
continuously (128 MB per 5 s) as long as 1.3 GB of VRAM stays free; freed slots are reused after 3 s.

prison cell without with copies in VRAM gain
1080p output (720p render) 34.9 fps 42.2 fps 2.8 GB +21 %
1440p output, render scale 0.5 35.3 42.3 2.1 GB +20 %
1440p output (960p render) 32.0 37.2 1.9 GB +16 %
4K output, FSR 4 performance 28.5 28.9 0.9 GB +1 %
  • About 3 ms/frame per GB moved — the same rate as moving the 710 MB write-combined pool alone (−4.0 ms, ABBA) and
    in line with your prison30.md.
  • Free VRAM is now the limit. At 4K there is no room left; in the open world (title + layer ~13 GB) only ~1.4 GB
    fit and the gain drops to ~5–9 %, with heavy churn: tens of thousands of pages a minute go back because DirectStorage
    rewrites them. Next for us: giving back texture-block slack (cf. xmem issue lobomfz/VIctory-xmem#21) and moving only pages that stay quiet
    longer.
  • The never-touched pages are scattered (census: no 64 MB block of the 6.2 GB pool without a CPU-touched page; 52 % of
    them in runs ≥1 MB), so it has to work per 64 KiB page, not as a static split of the pool.
  • A verification mode compares copy and RAM: 0 mismatches in 480 sampled live pages; in ~4 % of returns the RAM page
    had already changed right before our own write (never the copy) — cause still open. No visual artefacts seen.

Happy to share the code or run something specific on the 9070.

**@⁠grykom** on GitHub · 2026-11-30 18:58 UTC · [original](https://github.com/vktory6/VKtory/issues/17) Follow-up to #9, same machine and method (RX 9070 16 GB, 7800X3D, 32 GB, Linux 7.3, RADV 26.3.1; VIctory-xmem, not VKtory; ABBA in one session, prison cell after control is handed over, scripted, diag build). We implemented a variant of your placement step 4. Physical-pool pages that no alias was ever materialized for the CPU, and that the card has already asked for, get a copy in 64 MiB VRAM blocks; only the card's view of every alias is re-pointed at the copy, while the CPU keeps the RAM page, which stays the source of truth. The card's view goes back to RAM — no copy-back needed — on the first CPU access, when an alias already mapped for the CPU is bound, and before our own pool-window writes (DirectStorage, copies); on known card writes the slot is copied back first. Pages move continuously (128 MB per 5 s) as long as 1.3 GB of VRAM stays free; freed slots are reused after 3 s. | prison cell | without | with copies | in VRAM | gain | |---|---|---|---|---| | 1080p output (720p render) | 34.9 fps | **42.2 fps** | 2.8 GB | +21 % | | 1440p output, render scale 0.5 | 35.3 | **42.3** | 2.1 GB | +20 % | | 1440p output (960p render) | 32.0 | **37.2** | 1.9 GB | +16 % | | 4K output, FSR 4 performance | 28.5 | 28.9 | 0.9 GB | +1 % | - About **3 ms/frame per GB** moved — the same rate as moving the 710 MB write-combined pool alone (−4.0 ms, ABBA) and in line with your `prison30.md`. - **Free VRAM is now the limit.** At 4K there is no room left; in the open world (title + layer ~13 GB) only ~1.4 GB fit and the gain drops to ~5–9 %, with heavy churn: tens of thousands of pages a minute go back because DirectStorage rewrites them. Next for us: giving back texture-block slack (cf. xmem issue lobomfz/VIctory-xmem#21) and moving only pages that stay quiet longer. - The never-touched pages are scattered (census: no 64 MB block of the 6.2 GB pool without a CPU-touched page; 52 % of them in runs ≥1 MB), so it has to work per 64 KiB page, not as a static split of the pool. - A verification mode compares copy and RAM: **0 mismatches in 480 sampled live pages**; in ~4 % of returns the RAM page had already changed right before our own write (never the copy) — cause still open. No visual artefacts seen. Happy to share the code or run something specific on the 9070.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 19:00:19 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-11-30 23:19 UTC · original · edited 2026-11-30 23:22 UTC

Thanks, this is exactly the measurement our planned GTT-master + VRAM-replica placement needed. I created a task update based on your report: github.com/vktory6/VKtory@73cfff406a

Three things we would like to understand:

  1. The ~4 % of returns where the RAM page changed before your own write. Could that be a CPU write through a mapping that was already materialized but not tracked as touched (a write-combined alias)?
  2. In the open world, how many of the returning pages come back within seconds (DirectStorage), so a "quiet for N seconds" threshold could be sized?
  3. Is the ~3 ms/GB rate the same for pages the card reads every frame and for pages it reads rarely?

Re your next step: we see the same slack on our side (our image arena keeps 1.7-2.2 GB free inside its blocks), so for us the replica and the arena share one VRAM budget, and giving that slack back is part of the same task.

No need to share the code for now: we re-implement in our own design, but your description of the revert triggers is very useful.

**@⁠vktory6** on GitHub · 2026-11-30 23:19 UTC · [original](https://github.com/vktory6/VKtory/issues/17#issuecomment-7294981772) · edited 2026-11-30 23:22 UTC Thanks, this is exactly the measurement our planned GTT-master + VRAM-replica placement needed. I created a task update based on your report: https://github.com/vktory6/VKtory/commit/73cfff406a9c54bbdbcb0825c21efb172141fda2 Three things we would like to understand: 1. The ~4 % of returns where the RAM page changed before your own write. Could that be a CPU write through a mapping that was already materialized but not tracked as touched (a write-combined alias)? 2. In the open world, how many of the returning pages come back within seconds (DirectStorage), so a "quiet for N seconds" threshold could be sized? 3. Is the ~3 ms/GB rate the same for pages the card reads every frame and for pages it reads rarely? Re your next step: we see the same slack on our side (our image arena keeps 1.7-2.2 GB free inside its blocks), so for us the replica and the arena share one VRAM budget, and giving that slack back is part of the same task. No need to share the code for now: we re-implement in our own design, but your description of the revert triggers is very useful.
Author
Owner

@⁠CuteBooty on GitHub · 2026-12-01 01:08 UTC · original

A data point on the slack you both mention, from the Windows / D3D12 side (VIctory-NVIDIA, a different code base; RTX 3070 8 GB, Series S, normal play):

  • 28 minutes on v2026.11.30.01: about half of the texture blocks were free space inside blocks, 1,340 of 2,688 MB.
  • 65 minutes on v2026.11.29.05: the blocks grew from 3.5 to 6.4 GB, with 1.1 to 2.9 GB free inside them.

There, too, that free space counts as room, and none of it goes back to the card.

Two things from that tracker that may save you a step when you give the slack back:

On 8 GB the slack is the room a VRAM replica like this one would need, so the two tasks meet here as well.

**@⁠CuteBooty** on GitHub · 2026-12-01 01:08 UTC · [original](https://github.com/vktory6/VKtory/issues/17#issuecomment-7297139983) A data point on the slack you both mention, from the Windows / D3D12 side (VIctory-NVIDIA, a different code base; RTX 3070 8 GB, Series S, normal play): - 28 minutes on v2026.11.30.01: about half of the texture blocks were free space inside blocks, 1,340 of 2,688 MB. - 65 minutes on v2026.11.29.05: the blocks grew from 3.5 to 6.4 GB, with 1.1 to 2.9 GB free inside them. There, too, that free space counts as room, and none of it goes back to the card. Two things from that tracker that may save you a step when you give the slack back: - A test on an RTX 4060 showed that a half-empty heap gives back 0 bytes of the card's usage, and an emptied heap that is then dropped gives back exactly its 64 MiB. So only whole emptied blocks count. https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3680 - The plan for one owner of the card budget on 8 GB cards includes compaction for this: moving copies out of the sparsest blocks a few MB per frame, so whole blocks empty and can be freed. https://github.com/trustno1-coder/VIctory-NVIDIA/issues/4462 On 8 GB the slack is the room a VRAM replica like this one would need, so the two tasks meet here as well.
Author
Owner

@⁠grykom on GitHub · 2026-12-01 06:38 UTC · original

Thanks! Answers as far as we have data:

1. The ~4 % ram_changed returns. Most likely not a write-combined alias but a race in our own code, found by lobomfz in review (lobomfz/VIctory-xmem#40): our write hooks did not lock the page, so a write that started while the mover was copying the page wrote RAM concurrently; the slot then held torn bytes, and the check saw "RAM changed, slot not". That fits with it always happening right before our own write. We did not re-measure with a fix, because we dropped the copy path and moved the idea into xmem's residency instead. So: probable, not verified.

2. Returns in the open world. What we have (open world, 1440p, walking, release build, 3.5 min): ~1.4 GB copied to VRAM and ~49.6k returns caused by DirectStorage writes into those pages, so heavy churn. We did not record how soon after the move a page came back; I'll measure that (time from move to return) and post it in a follow-up.

3. Is ~3 ms/GB the same for hot and rarely read pages? We don't know; we only measured totals. The candidates were all pages the card had asked for at least once, without a per-page read rate. The points we have (prison cell, 1080p): 1 GB → −2.7 ms, 1.7 GB → −5.5 ms, so the second batch was worth no less than the first; and the 710 MB WC pool alone gave −4.0 ms at 1440p. A real split by read frequency would need a per-page heat measure, which we don't have yet.

On the shared budget: agreed. On our side too, VRAM capacity is now the limit (15.4 GB peak at 1080p with 1.7 GB moved); giving back texture slack is the next thing we test.

**@⁠grykom** on GitHub · 2026-12-01 06:38 UTC · [original](https://github.com/vktory6/VKtory/issues/17#issuecomment-7303096031) Thanks! Answers as far as we have data: **1. The ~4 % `ram_changed` returns.** Most likely not a write-combined alias but a race in our own code, found by lobomfz in review (lobomfz/VIctory-xmem#40): our write hooks did not lock the page, so a write that started while the mover was copying the page wrote RAM concurrently; the slot then held torn bytes, and the check saw "RAM changed, slot not". That fits with it always happening right before our own write. We did not re-measure with a fix, because we dropped the copy path and moved the idea into xmem's residency instead. So: probable, not verified. **2. Returns in the open world.** What we have (open world, 1440p, walking, release build, 3.5 min): ~1.4 GB copied to VRAM and ~49.6k returns caused by DirectStorage writes into those pages, so heavy churn. We did not record how soon after the move a page came back; I'll measure that (time from move to return) and post it in a follow-up. **3. Is ~3 ms/GB the same for hot and rarely read pages?** We don't know; we only measured totals. The candidates were all pages the card had asked for at least once, without a per-page read rate. The points we have (prison cell, 1080p): 1 GB → −2.7 ms, 1.7 GB → −5.5 ms, so the second batch was worth no less than the first; and the 710 MB WC pool alone gave −4.0 ms at 1440p. A real split by read frequency would need a per-page heat measure, which we don't have yet. On the shared budget: agreed. On our side too, VRAM capacity is now the limit (15.4 GB peak at 1080p with 1.7 GB moved); giving back texture slack is the next thing we test.
Author
Owner

@⁠vktory6 on GitHub · 2026-12-01 07:35 UTC · original

Thanks to both of you. I added the follow-up to the VRAM replica task in github.com/vktory6/VKtory@5169307: the likely cause of the ~4 % returns (not verified), and the point that only whole emptied blocks give card memory back, so returning the arena's slack needs compaction.

**@⁠vktory6** on GitHub · 2026-12-01 07:35 UTC · [original](https://github.com/vktory6/VKtory/issues/17#issuecomment-7304234561) Thanks to both of you. I added the follow-up to the VRAM replica task in https://github.com/vktory6/VKtory/commit/5169307: the likely cause of the ~4 % returns (not verified), and the point that only whole emptied blocks give card memory back, so returning the arena's slack needs compaction.
Author
Owner

@⁠grykom on GitHub · 2026-12-01 19:45 UTC · original · edited 2026-12-01 19:52 UTC

@⁠vktory6
Follow-up with the return times I promised (question 2).

Setup: VIctory-xmem 37bb30f (upstream page residency with the "seen" source from #40) plus a counter that records
how long each page stayed on the card before it went down (commit 9054887, now in https://github.com/grykom/VIctory-xmem/tree/give-back-main).
RX 9070 16 GB, 1440p, diag build, RT off, physical monitor. "Room" for the title is 4 GB (xmem's VRAM - 12 GiB) and
it was full in both scenes.

Pages that went down, by time on the card (<=1 s / <=5 s / <=30 s / <=120 s / longer):

scene moved up went down <=1 s <=5 s <=30 s <=120 s longer
prison cell, 7 min, run 1 19.4k 3.6k (19 %) 59 399 1101 1115 952
prison cell, 7 min, run 2 19.1k 3.2k (17 %) 49 205 1319 1018 639
open world (walk + drive), ~6.5 min 36.5k 20.2k (55 %) 321 1497 3567 7524 7288
  • Almost all of them went down because the CPU touched them; "cold" and "for room" were ~0 in the histogram.
  • Very few come back within a second. Most come back after 30 s to a few minutes, so a longer quiet period before
    moving would catch only a small share. In the open world more than half of the moved pages came back during the
    run, so for streaming-heavy scenes it's mostly churn.
  • Of the pages from the "seen, never CPU-touched" source the share is similar (open world: 10.1k of 20.5k came back).
    "Never touched" so far doesn't mean "won't be touched".

Effect on frames, same build, PAGES=1 vs PAGES=0 (details in lobomfz/VIctory-xmem#14):
cell +10 % fps in steady state; open world about equal on average with worse 1 % lows.

On question 3 (hot vs rarely read pages) we still have no per-page read rate, so nothing new there.

**@⁠grykom** on GitHub · 2026-12-01 19:45 UTC · [original](https://github.com/vktory6/VKtory/issues/17#issuecomment-7323367315) · edited 2026-12-01 19:52 UTC @⁠vktory6 Follow-up with the return times I promised (question 2). Setup: VIctory-xmem `37bb30f` (upstream page residency with the "seen" source from #40) plus a counter that records how long each page stayed on the card before it went down (commit `9054887`, now in https://github.com/grykom/VIctory-xmem/tree/give-back-main). RX 9070 16 GB, 1440p, diag build, RT off, physical monitor. "Room" for the title is 4 GB (xmem's VRAM - 12 GiB) and it was full in both scenes. Pages that went down, by time on the card (<=1 s / <=5 s / <=30 s / <=120 s / longer): | scene | moved up | went down | <=1 s | <=5 s | <=30 s | <=120 s | longer | |---|---|---|---|---|---|---|---| | prison cell, 7 min, run 1 | 19.4k | 3.6k (19 %) | 59 | 399 | 1101 | 1115 | 952 | | prison cell, 7 min, run 2 | 19.1k | 3.2k (17 %) | 49 | 205 | 1319 | 1018 | 639 | | open world (walk + drive), ~6.5 min | 36.5k | 20.2k (55 %) | 321 | 1497 | 3567 | 7524 | 7288 | - Almost all of them went down because the CPU touched them; "cold" and "for room" were ~0 in the histogram. - Very few come back within a second. Most come back after 30 s to a few minutes, so a longer quiet period before moving would catch only a small share. In the open world more than half of the moved pages came back during the run, so for streaming-heavy scenes it's mostly churn. - Of the pages from the "seen, never CPU-touched" source the share is similar (open world: 10.1k of 20.5k came back). "Never touched" so far doesn't mean "won't be touched". Effect on frames, same build, PAGES=1 vs PAGES=0 (details in lobomfz/VIctory-xmem#14): cell +10 % fps in steady state; open world about equal on average with worse 1 % lows. On question 3 (hot vs rarely read pages) we still have no per-page read rate, so nothing new there.
Author
Owner

@⁠grykom on GitHub · 2026-12-01 19:48 UTC · original · edited 2026-12-01 19:52 UTC

On the shared VRAM budget we talked about: here is the texture-slack side of it (CuteBooty saw ~50 % slack on
VIctory-NVIDIA, we saw 3.3 GB here). Same text as in lobomfz/VIctory-xmem#21:

What it does (behind VICTORY_VRAM_GIVE_BACK=1): 16 MiB texture/staging blocks instead of 64 MiB, best-fit into the
fullest blocks, compaction of the sparsest texture blocks once a second (GPU->GPU copy, descriptor swap, old copy kept
~1 s + 4 frames), idle staging returned after 5-15 s. Details in lobomfz/VIctory-xmem#21. Branch: https://github.com/grykom/VIctory-xmem/tree/give-back-main (on top of 37bb30f, all behind switches; unset = xmem main).

Setup: RX 9070 16 GB, prison cell, 2560x1440, diag build, RT off, 7 min runs, order A B C C B A, physical monitor
(desktop uses ~0.4 GB). Run-to-run spread in this series ~0.4 fps.

arm VRAM peak free VRAM at end title pages on the card fps 360-420 s 1 % low 360-420 s
A main (residency room 4 GB) 14,455 / 14,495 MB 1.78 / 1.74 GB 3.87 GB 41.7 / 41.4 18.4 / 18.7
B + give-back 13,271 / 13,243 MB 3.09 / 3.18 GB 3.87 GB 41.5 / 41.4 21.1 / 19.8
C + give-back + room 7 GB (VICTORY_CARD_KEPT_MB=9216) 14,015 / 14,091 MB 2.52 / 2.34 GB 5.37 / 5.40 GB 43.9 / 44.2 21.4 / 19.7
  • Give-back alone: peak -1.2 GB, +1.4 GB free, fps unchanged, because residency's room is fixed at VRAM - 12 GiB and
    doesn't use the space. Texture pool slack goes from ~3.3 GB (measured earlier with 64 MiB blocks) to ~100 MB;
    ~7-8k textures (0.8-0.9 GB) compacted per run.
  • With a larger room residency puts 1.5 GB more title pages on the card: +6 % fps at the end of the run, and the peak is
    still 0.4 GB below main. The room was not full (5.4 of 7.1 GB) and 2.3-2.5 GB stayed free: 43k pages in 7 min is
    exactly the 128 pages/s pace, so pace is the next limit.
  • Steady-state 1 % lows are better with give-back; over the whole run they are a bit worse because of extra frames
    over 80 ms when compaction starts during the cutscene (9-19 vs 7-12). Copy waits on its fence and the texture scan
    takes up to ~13 ms; both are known and not fixed yet.

Open world (Mandy save, walk then drive, ~6 min, one run per arm, played by hand on a similar route) is a different
story:

arm avg fps 1 % low frames > 80 ms worst
main, PAGES=0 28.7 11.1 84 115 ms
main, PAGES=1 29.2 9.5 121 678 ms
+ give-back + room 7 GB 28.8 8.7 194 675 ms
  • No fps gain and more stutter. Residency filled only 4.4 of its 7.1 GB room: of 44.8k pages moved up, 21.2k (47 %)
    went back down because the CPU touched them, most after 30 s to a few minutes (return times in vktory6/VKtory#17).
    A bigger room in a streaming scene mostly means more churn, not more pages staying on the card.
  • Texture slack while driving was 1.3 GB (vs ~0.1 GB in the cell): textures stream in faster than compaction moves
    them (32-64 MiB/s).
  • So: in a static scene free VRAM is the limit and give-back turns it into fps; in the open world the limit is page
    churn, and more room doesn't help until pages that will be touched again are told apart from those that won't.

How to measure it on your card (no extra tooling, all in the normal log):

  • A/B: unset vs VICTORY_VRAM_GIVE_BACK=1, and optionally VICTORY_CARD_KEPT_MB=<VRAM - room you want, in MB> to
    let residency use what comes back (we used 9216 on 16 GB; on 8-12 GB cards try a smaller room first).
  • vram give-back ... line: pool_reserved_mb vs pool_live_mb (slack), returned_blocks, compacted_mb.
  • page residency: ... line: MB on the card, room, MB of the card free.
  • page returns (...) line (from the counter commit): how long pages stayed on the card before the CPU pulled them back.
  • compaction pass timing (diag, passes over 5 ms): where the compaction time goes.
  • Compare fps and 1 % low over a fixed window late in the run (we use 360-420 s); the first minutes are dominated by
    residency filling up.
    Most useful to us: small cards (8-12 GB) and open world, which we can't test.

Not for merging as is: the pace/room switches are local experiments, and the give-back stutter at compaction start is
open. If you'd rather take only parts of it (block size + best-fit, staging return, compaction), say which.

**@⁠grykom** on GitHub · 2026-12-01 19:48 UTC · [original](https://github.com/vktory6/VKtory/issues/17#issuecomment-7323485662) · edited 2026-12-01 19:52 UTC On the shared VRAM budget we talked about: here is the texture-slack side of it (CuteBooty saw ~50 % slack on VIctory-NVIDIA, we saw 3.3 GB here). Same text as in lobomfz/VIctory-xmem#21: What it does (behind `VICTORY_VRAM_GIVE_BACK=1`): 16 MiB texture/staging blocks instead of 64 MiB, best-fit into the fullest blocks, compaction of the sparsest texture blocks once a second (GPU->GPU copy, descriptor swap, old copy kept ~1 s + 4 frames), idle staging returned after 5-15 s. Details in lobomfz/VIctory-xmem#21. Branch: https://github.com/grykom/VIctory-xmem/tree/give-back-main (on top of `37bb30f`, all behind switches; unset = xmem `main`). Setup: RX 9070 16 GB, prison cell, 2560x1440, diag build, RT off, 7 min runs, order A B C C B A, physical monitor (desktop uses ~0.4 GB). Run-to-run spread in this series ~0.4 fps. | arm | VRAM peak | free VRAM at end | title pages on the card | fps 360-420 s | 1 % low 360-420 s | |---|---|---|---|---|---| | A `main` (residency room 4 GB) | 14,455 / 14,495 MB | 1.78 / 1.74 GB | 3.87 GB | 41.7 / 41.4 | 18.4 / 18.7 | | B + give-back | 13,271 / 13,243 MB | 3.09 / 3.18 GB | 3.87 GB | 41.5 / 41.4 | 21.1 / 19.8 | | C + give-back + room 7 GB (`VICTORY_CARD_KEPT_MB=9216`) | 14,015 / 14,091 MB | 2.52 / 2.34 GB | 5.37 / 5.40 GB | 43.9 / 44.2 | 21.4 / 19.7 | - Give-back alone: peak -1.2 GB, +1.4 GB free, fps unchanged, because residency's room is fixed at VRAM - 12 GiB and doesn't use the space. Texture pool slack goes from ~3.3 GB (measured earlier with 64 MiB blocks) to ~100 MB; ~7-8k textures (0.8-0.9 GB) compacted per run. - With a larger room residency puts 1.5 GB more title pages on the card: +6 % fps at the end of the run, and the peak is still 0.4 GB below `main`. The room was not full (5.4 of 7.1 GB) and 2.3-2.5 GB stayed free: 43k pages in 7 min is exactly the 128 pages/s pace, so pace is the next limit. - Steady-state 1 % lows are better with give-back; over the whole run they are a bit worse because of extra frames over 80 ms when compaction starts during the cutscene (9-19 vs 7-12). Copy waits on its fence and the texture scan takes up to ~13 ms; both are known and not fixed yet. Open world (Mandy save, walk then drive, ~6 min, one run per arm, played by hand on a similar route) is a different story: | arm | avg fps | 1 % low | frames > 80 ms | worst | |---|---|---|---|---| | `main`, PAGES=0 | 28.7 | 11.1 | 84 | 115 ms | | `main`, PAGES=1 | 29.2 | 9.5 | 121 | 678 ms | | + give-back + room 7 GB | 28.8 | 8.7 | 194 | 675 ms | - No fps gain and more stutter. Residency filled only 4.4 of its 7.1 GB room: of 44.8k pages moved up, 21.2k (47 %) went back down because the CPU touched them, most after 30 s to a few minutes (return times in vktory6/VKtory#17). A bigger room in a streaming scene mostly means more churn, not more pages staying on the card. - Texture slack while driving was 1.3 GB (vs ~0.1 GB in the cell): textures stream in faster than compaction moves them (32-64 MiB/s). - So: in a static scene free VRAM is the limit and give-back turns it into fps; in the open world the limit is page churn, and more room doesn't help until pages that will be touched again are told apart from those that won't. How to measure it on your card (no extra tooling, all in the normal log): - A/B: unset vs `VICTORY_VRAM_GIVE_BACK=1`, and optionally `VICTORY_CARD_KEPT_MB=<VRAM - room you want, in MB>` to let residency use what comes back (we used 9216 on 16 GB; on 8-12 GB cards try a smaller room first). - `vram give-back ...` line: `pool_reserved_mb` vs `pool_live_mb` (slack), `returned_blocks`, `compacted_mb`. - `page residency: ...` line: MB on the card, room, MB of the card free. - `page returns (...)` line (from the counter commit): how long pages stayed on the card before the CPU pulled them back. - `compaction pass timing` (diag, passes over 5 ms): where the compaction time goes. - Compare fps and 1 % low over a fixed window late in the run (we use 360-420 s); the first minutes are dominated by residency filling up. Most useful to us: small cards (8-12 GB) and open world, which we can't test. Not for merging as is: the pace/room switches are local experiments, and the give-back stutter at compaction start is open. If you'd rather take only parts of it (block size + best-fit, staging return, compaction), say which.
Author
Owner

@⁠vktory6 on GitHub · 2026-12-01 19:57 UTC · original

Thanks for both. That answers question 2 clearly.

  • Return times: "never CPU-touched so far" turns out to be a weak predictor in streaming scenes: 55 % of moved pages came back in the open world, most after 30 s or more. We'll measure churn on our side before moving pages to VRAM on that basis. That's step 4 of the placement design in docs/learnings/memory-placement.md.
  • Texture-pool slack: a different allocator on our side (vkback's arena: 0.8-1.1 GB free in about 33 blocks in the boat start, 256 MiB largest free range), so it doesn't port directly. Your finding that slack only turns into fps once something uses the freed room, and that compaction lags behind streaming, is still useful to us.

Both are recorded as hints in docs/learnings/memory-placement.md ("Fork hints from issue #17"). Nothing to merge from it as is. On our side the next VRAM step is different: binding render targets over their own game memory, where the census shows up to ~4 GB.

**@⁠vktory6** on GitHub · 2026-12-01 19:57 UTC · [original](https://github.com/vktory6/VKtory/issues/17#issuecomment-7323756600) Thanks for both. That answers question 2 clearly. - **Return times:** "never CPU-touched so far" turns out to be a weak predictor in streaming scenes: 55 % of moved pages came back in the open world, most after 30 s or more. We'll measure churn on our side before moving pages to VRAM on that basis. That's step 4 of the placement design in docs/learnings/memory-placement.md. - **Texture-pool slack:** a different allocator on our side (vkback's arena: 0.8-1.1 GB free in about 33 blocks in the boat start, 256 MiB largest free range), so it doesn't port directly. Your finding that slack only turns into fps once something uses the freed room, and that compaction lags behind streaming, is still useful to us. Both are recorded as hints in docs/learnings/memory-placement.md ("Fork hints from issue #17"). Nothing to merge from it as is. On our side the next VRAM step is different: binding render targets over their own game memory, where the census shows up to ~4 GB.
Author
Owner

@⁠TheRifai on GitHub · 2026-12-02 15:55 UTC · original

Prior-art check on the XCL UMA fix (Discord post + PRs xcl-dev/xcl#3695, #3696, upstream #2844/#2977). No code was copied; this is a portability assessment with a local data point.

XCL's problem is Windows/D3D12-specific: with XCL_COHERENT_MB=512 the title's 1,277/1,162/258 MB GPU heaps end up in plain, write-watched memory the GPU cannot see, so shaders read zeros and ~2.7 GB is copied/watched per submit. Their fix gives those heaps committed windows of their own in a 16-slot aperture, as NVIDIA driver CUSTOM write-back heaps (#3696), and stops counting freed heaps in the stored coherent-window size (#3695).

Our Vulkan path already solves the same visibility problem differently: umem owns sparse title windows at the title's own addresses (greenfield/umem/src/lib.rs window/WIN_SHIFT), and GPU-only pools are mapped with pool_view_gpu_only + victory_gpu::title_gpu_only_mapped (no CPU mapping), so the GPU reads/writes heap bytes where the title has them. There is no fixed 16-window aperture and no copy-back for those views. Local check on main 3aea0e4, RX 9070 XT / GE-Proton11-16, house rt3, 80 s warm-store run with UMEM_MEMREPORT=1 (/home/shlong/Documents/VKtory-capture/uma-check/20261202-165333/): views shown 180,600 hidden 13,397, window pages 701, small reads from umem's backing (GPU-only views) 0, pool errors 0. So #3696's symptom does not reproduce here.

The one transferable idea is #3695's accounting: count the heaps alive at once (and holes below the highest used block), not every heap ever asked for. Our VRAM budget is queried live from VK_EXT_memory_budget rather than stored across runs, so that leak does not exist here either. The analogous local issue is vkback's arena free space inside blocks (issue #241: 1.5 GB free in 33 blocks, largest range 256 MB), which is a fragmentation problem, not a stored-size problem.

**@⁠TheRifai** on GitHub · 2026-12-02 15:55 UTC · [original](https://github.com/vktory6/VKtory/issues/17#issuecomment-7351147665) Prior-art check on the XCL UMA fix (Discord post + PRs `xcl-dev/xcl#3695`, `#3696`, upstream `#2844`/`#2977`). No code was copied; this is a portability assessment with a local data point. XCL's problem is Windows/D3D12-specific: with `XCL_COHERENT_MB=512` the title's 1,277/1,162/258 MB GPU heaps end up in plain, write-watched memory the GPU cannot see, so shaders read zeros and ~2.7 GB is copied/watched per submit. Their fix gives those heaps committed windows of their own in a 16-slot aperture, as NVIDIA driver CUSTOM write-back heaps (`#3696`), and stops counting freed heaps in the stored coherent-window size (`#3695`). Our Vulkan path already solves the same visibility problem differently: `umem` owns sparse title windows at the title's own addresses (`greenfield/umem/src/lib.rs` `window`/`WIN_SHIFT`), and GPU-only pools are mapped with `pool_view_gpu_only` + `victory_gpu::title_gpu_only_mapped` (no CPU mapping), so the GPU reads/writes heap bytes where the title has them. There is no fixed 16-window aperture and no copy-back for those views. Local check on main `3aea0e4`, RX 9070 XT / GE-Proton11-16, house `rt3`, 80 s warm-store run with `UMEM_MEMREPORT=1` (`/home/shlong/Documents/VKtory-capture/uma-check/20261202-165333/`): `views shown 180,600 hidden 13,397`, `window pages 701`, `small reads from umem's backing (GPU-only views) 0`, pool errors 0. So `#3696`'s symptom does not reproduce here. The one transferable idea is `#3695`'s accounting: count the heaps *alive at once* (and holes below the highest used block), not every heap ever asked for. Our VRAM budget is queried live from `VK_EXT_memory_budget` rather than stored across runs, so that leak does not exist here either. The analogous local issue is vkback's arena free space inside blocks (issue #241: 1.5 GB free in 33 blocks, largest range 256 MB), which is a fragmentation problem, not a stored-size problem.
Author
Owner

@⁠vktory6 on GitHub · 2026-12-02 18:38 UTC · original

Thanks for the portability check and the local UMA run.

Agreed on both points. Our windows already map the GPU-only pools at the title's own addresses, and small reads from umem's backing (GPU-only views) 0 confirms #3696's symptom doesn't exist here. The VRAM budget is read live from VK_EXT_memory_budget, so #3695's stored-size leak doesn't exist here either. The arena fragmentation you point to is already tracked: compaction in "Memory placement: VRAM vs GTT", and the #241 growth in "Long sessions and VRAM headroom". Nothing new for TASKS from this one.

This issue's own findings (placement step 4, return times, pool slack) are in "Memory placement: VRAM vs GTT" and in docs/learnings/memory-placement.md, so I'm closing it. Thanks to everyone who measured here.

**@⁠vktory6** on GitHub · 2026-12-02 18:38 UTC · [original](https://github.com/vktory6/VKtory/issues/17#issuecomment-7354922695) Thanks for the portability check and the local UMA run. Agreed on both points. Our windows already map the GPU-only pools at the title's own addresses, and `small reads from umem's backing (GPU-only views) 0` confirms #3696's symptom doesn't exist here. The VRAM budget is read live from `VK_EXT_memory_budget`, so #3695's stored-size leak doesn't exist here either. The arena fragmentation you point to is already tracked: compaction in "Memory placement: VRAM vs GTT", and the #241 growth in "Long sessions and VRAM headroom". Nothing new for TASKS from this one. This issue's own findings (placement step 4, return times, pool slack) are in "Memory placement: VRAM vs GTT" and in docs/learnings/memory-placement.md, so I'm closing it. Thanks to everyone who measured here.
This discussion has been locked. Commenting is limited to contributors.
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/vktory6--VKtory#17
No description provided.