Memory: free idle textures under PC memory pressure; stop placed-view shapes from filling up #206

Open
kripotker wants to merge 16 commits from upstream-pr/206 into main
kripotker commented 2026-11-26 11:37:49 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by kripotker on 2026-11-26T11:37:49Z.


Two memory fixes, measured on an RX 7900 XTX with 32 GB RAM (play.ps1 with VICTORY_PORT_CONSTANTS=1).

1. Idle texture copies go after 5 s under PC memory pressure

resource::let_go_idle kept idle host textures for 10 minutes while the card was under 88 % of its budget. But what the card spills to system memory counts against the PC's commit too: at 18 minutes the process had 41 GB private and only 1.4 GB of commit left.

Now, while crate::residency::pressured() is set, idle copies go after 5 s. play.ps1 turns on VICTORY_RESIDENCY=1, which was already in the code but off.

2. Placed-view shapes: padding zeroed, index keyed by hash

The padding words of placed views' descriptions hold the title's stack junk: resource words 1 and 13, a shader resource view's word 3, and a buffer view's word 9. Values like bf800000 and 3f7ff8ac showed up there. Direct3D reads none of them, but each new value made a new shape.

The 4,194,304 shapes were full after about 30 minutes. After that, every placed view became a table entry that is never freed (over 1 million in one run, and growing).

I found the words with a temporary census: over 200,000 new shapes, I counted how many stayed distinct with each word zeroed. Zeroing word 3 alone merged 42 %.

placed() now zeroes those words when the view is recorded. The shape index is also keyed by the shape's hash, checked against the list, instead of holding a second full copy of every shape.

Results

Before After
Process private memory 41.3 GB 28.5 GB
Commit left 1.4 GB 3.2 GB
Card memory in use 20.5 GB 11.9 GB
Spilled to system memory 10.0 GB 7.5 GB
Frame time (avg of 30 lines) 63.6 ms 57.6 ms
New placed-view shapes ~85,000/min ~4,500/min

The before and after frame times come from different scenes (on foot against in a boat), so treat that row as "no worse", not a measured gain.

The cost of fix 1 is re-uploads: about 45,000 textures (5.4 GB) were made again over about 38 minutes. I saw no pop-in while driving.

Testing

  • cargo test -p victory-gpu --lib -- descriptor residency pool vram_: 64 passed. The descriptor test now also checks that junk in the padding words gives the same view and shape.
  • The buffer-view word 9 case is not covered by a unit test.
  • Played in-game with --profile diag --features diagnostics.

🤖 Generated with Claude Code

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:5509330017 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/206). Originally posted by [kripotker](https://github.com/kripotker) on 2026-11-26T11:37:49Z. --- Two memory fixes, measured on an RX 7900 XTX with 32 GB RAM (`play.ps1` with `VICTORY_PORT_CONSTANTS=1`). ## 1. Idle texture copies go after 5 s under PC memory pressure `resource::let_go_idle` kept idle host textures for 10 minutes while the card was under 88 % of its budget. But what the card spills to system memory counts against the PC's commit too: at 18 minutes the process had 41 GB private and only 1.4 GB of commit left. Now, while `crate::residency::pressured()` is set, idle copies go after 5 s. `play.ps1` turns on `VICTORY_RESIDENCY=1`, which was already in the code but off. ## 2. Placed-view shapes: padding zeroed, index keyed by hash The padding words of placed views' descriptions hold the title's stack junk: resource words 1 and 13, a shader resource view's word 3, and a buffer view's word 9. Values like `bf800000` and `3f7ff8ac` showed up there. Direct3D reads none of them, but each new value made a new shape. The 4,194,304 shapes were full after about 30 minutes. After that, every placed view became a table entry that is never freed (over 1 million in one run, and growing). I found the words with a temporary census: over 200,000 new shapes, I counted how many stayed distinct with each word zeroed. Zeroing word 3 alone merged 42 %. `placed()` now zeroes those words when the view is recorded. The shape index is also keyed by the shape's hash, checked against the list, instead of holding a second full copy of every shape. ## Results | | Before | After | |---|---|---| | Process private memory | 41.3 GB | 28.5 GB | | Commit left | 1.4 GB | 3.2 GB | | Card memory in use | 20.5 GB | 11.9 GB | | Spilled to system memory | 10.0 GB | 7.5 GB | | Frame time (avg of 30 lines) | 63.6 ms | 57.6 ms | | New placed-view shapes | ~85,000/min | ~4,500/min | The before and after frame times come from different scenes (on foot against in a boat), so treat that row as "no worse", not a measured gain. The cost of fix 1 is re-uploads: about 45,000 textures (5.4 GB) were made again over about 38 minutes. I saw no pop-in while driving. ## Testing - `cargo test -p victory-gpu --lib -- descriptor residency pool vram_`: 64 passed. The descriptor test now also checks that junk in the padding words gives the same view and shape. - The buffer-view word 9 case is not covered by a unit test. - Played in-game with `--profile diag --features diagnostics`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kripotker commented 2026-11-26 13:29:59 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by kripotker on 2026-11-26T13:29:59Z.


Update: two more commits, Series X memory and fps

Measured on an RX 7900 XTX with 31 GB of RAM, in Series X mode. Each figure is at the same spot, standing still at the boat start, with play.ps1.

Before this PR First two commits All four commits
Process private (commit) 41.3 GB 28.5–29.3 GB 26.3 GB
Of it in RAM 20.3 GB* 22.3–23.5 GB 20.9 GB
Card memory in use 20.5 GB 11.9–12.4 GB 11.8 GB
PC memory shared with the card 10.0 GB 7.5–8.5 GB 6.8 GB
Host copies of title memory 4.3 GB 3.3–4.0 GB 3.3 GB
Frame time 63.6 ms 53–58 ms 48.8–49.3 ms (~20 fps)

*Before this PR, about half of the 41 GB was paged out.

081a286: preludes share their list's allocator

On this card, a command list made on a fresh allocator costs 1.16 MB of commit: the allocator's first block. On an allocator that already has a block, a list costs 0.15 MB, and recording 600,000 commands then resetting adds nothing. The ignored test inplace::tests::lists_cost measures this.

A lazily made prelude now records into its host list's own allocator. That allocator is idle then, and it is reset only after the list's submissions have run. That saves about 1 MB per prelude, about 1.1 GB for the ~1,100 preludes in a run. No prelude errors in testing. VICTORY_SHARED_PRELUDE=0 restores an allocator of its own.

Also in this commit:

  • VICTORY_CARD_BUDGET_MB, off by default. A 9 GB cap holds the card at about 9.5 GB, but frames go from about 58 to 85 ms. Card copies of title buffers no longer fit and get snapshotted on the CPU instead (29 ms against 2).
  • heaps_opened_per_part_cost: 256 heaps opened from address cost about 1 MB of commit in all.

605569d: VICTORY_PORT_ALL, 1 MiB windows, fewer spare blocks

  • VICTORY_PORT_ALL=1 lets renderer port 1 go past the title's 32-bit graphics memory. Every buffer or window that is one stretch of a section is used in place.
  • play.ps1 turns it on together with VICTORY_WINDOW_KB=1024; -Safe leaves both off. The earlier 256 KiB slowdown doesn't show at 1 MiB: snapshots take 1.3 ms a frame.
  • On PCs with 32 GB of RAM or less, the texture pool keeps 12 spare blocks, not 64.
  • play.ps1 -Console series-s passes the console model.

Negative results, for the record

  • VICTORY_PORT_ALL=1 + VICTORY_INPLACE=2 + VICTORY_CARD_BUFFERS=0 together: private memory climbed from 29 to 87 GB in about 40 s, until commit ran out. Each switch alone stays at 26–27 GB. I haven't found the cause; avoid that combination.
  • Filling the fullest texture block first (to let sparse blocks drain) showed black blotches on a character's shirt in a cutscene that rendered clean without it. Likely textures not fully uploaded, showing leftover data from reused holes. Reverted. In this run 3.5 of 5.5 GB of texture blocks were free, almost all of it holes in blocks still in use.

Series S, for comparison (-Console series-s, same spot)

21 fps (48 ms). 18.6 GB in RAM against 23.5 GB in Series X with the first two commits. The title asks for 9.8 GB of memory against 15.0 GB, and host render targets take 1.4 GB against 2.9 GB.

Private memory came out almost the same (28.7 against 29.3 GB). In Series S the title asks for a 16 GB reservation hundreds of times; in Series X it asks once for 24 GB. Not investigated yet.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7193434676 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/206#issuecomment-7193434676). Originally posted by [kripotker](https://github.com/kripotker) on 2026-11-26T13:29:59Z. --- ## Update: two more commits, Series X memory and fps Measured on an RX 7900 XTX with 31 GB of RAM, in Series X mode. Each figure is at the same spot, standing still at the boat start, with `play.ps1`. | | Before this PR | First two commits | All four commits | |---|---|---|---| | Process private (commit) | 41.3 GB | 28.5–29.3 GB | **26.3 GB** | | Of it in RAM | 20.3 GB* | 22.3–23.5 GB | **20.9 GB** | | Card memory in use | 20.5 GB | 11.9–12.4 GB | **11.8 GB** | | PC memory shared with the card | 10.0 GB | 7.5–8.5 GB | **6.8 GB** | | Host copies of title memory | 4.3 GB | 3.3–4.0 GB | 3.3 GB | | Frame time | 63.6 ms | 53–58 ms | **48.8–49.3 ms** (~20 fps) | \*Before this PR, about half of the 41 GB was paged out. ### `081a286`: preludes share their list's allocator On this card, a command list made on a fresh allocator costs 1.16 MB of commit: the allocator's first block. On an allocator that already has a block, a list costs 0.15 MB, and recording 600,000 commands then resetting adds nothing. The ignored test `inplace::tests::lists_cost` measures this. A lazily made prelude now records into its host list's own allocator. That allocator is idle then, and it is reset only after the list's submissions have run. That saves about 1 MB per prelude, about 1.1 GB for the ~1,100 preludes in a run. No prelude errors in testing. `VICTORY_SHARED_PRELUDE=0` restores an allocator of its own. Also in this commit: - `VICTORY_CARD_BUDGET_MB`, off by default. A 9 GB cap holds the card at about 9.5 GB, but frames go from about 58 to 85 ms. Card copies of title buffers no longer fit and get snapshotted on the CPU instead (29 ms against 2). - `heaps_opened_per_part_cost`: 256 heaps opened from address cost about 1 MB of commit in all. ### `605569d`: `VICTORY_PORT_ALL`, 1 MiB windows, fewer spare blocks - `VICTORY_PORT_ALL=1` lets renderer port 1 go past the title's 32-bit graphics memory. Every buffer or window that is one stretch of a section is used in place. - `play.ps1` turns it on together with `VICTORY_WINDOW_KB=1024`; `-Safe` leaves both off. The earlier 256 KiB slowdown doesn't show at 1 MiB: snapshots take 1.3 ms a frame. - On PCs with 32 GB of RAM or less, the texture pool keeps 12 spare blocks, not 64. - `play.ps1 -Console series-s` passes the console model. ### Negative results, for the record - **`VICTORY_PORT_ALL=1` + `VICTORY_INPLACE=2` + `VICTORY_CARD_BUFFERS=0` together:** private memory climbed from 29 to 87 GB in about 40 s, until commit ran out. Each switch alone stays at 26–27 GB. I haven't found the cause; avoid that combination. - **Filling the fullest texture block first** (to let sparse blocks drain) showed black blotches on a character's shirt in a cutscene that rendered clean without it. Likely textures not fully uploaded, showing leftover data from reused holes. Reverted. In this run 3.5 of 5.5 GB of texture blocks were free, almost all of it holes in blocks still in use. ### Series S, for comparison (`-Console series-s`, same spot) 21 fps (48 ms). 18.6 GB in RAM against 23.5 GB in Series X with the first two commits. The title asks for 9.8 GB of memory against 15.0 GB, and host render targets take 1.4 GB against 2.9 GB. Private memory came out almost the same (28.7 against 29.3 GB). In Series S the title asks for a 16 GB reservation hundreds of times; in Series X it asks once for 24 GB. Not investigated yet.
kripotker commented 2026-11-26 13:48:16 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by kripotker on 2026-11-26T13:48:16Z.


6505796: 16 MiB texture blocks

Same spot and method as above, about 8 minutes after launch, against 605569d:

64 MiB blocks 16 MiB blocks
Process private 26.4 GB 25.2 GB
Card memory in use 11.8 GB 10.9 GB
Texture blocks 5.5 GB, 3.5 GB of it free 4.5 GB, 2.4 GB free
Frame time 51.3 ms 53.4 ms (within the run-to-run spread at this spot)

Bug found on the way: the first upload of a texture recorded an aliasing barrier whenever the pool was on. A texture bigger than a block is committed, and the host refuses that barrier: the list fails to close. Before this, a texture had to be over 64 MiB to hit it; with 16 MiB blocks it happens at startup. pool::pooled now tells pooled textures apart by their private data, and only those get the barrier.

VICTORY_BIG_TRACE=1 logs a backtrace for every block of our own of 256 MiB or more. The 401 MB block in the memory line since run 65 is the title's own audio heap (ApuAlloc).

Since the PR was opened: 41.3 → 25.2 GB private and 20.5 → 10.9 GB card in Series X, with frame time down from about 64 ms to about 50.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7193860231 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/206#issuecomment-7193860231). Originally posted by [kripotker](https://github.com/kripotker) on 2026-11-26T13:48:16Z. --- ## `6505796`: 16 MiB texture blocks Same spot and method as above, about 8 minutes after launch, against `605569d`: | | 64 MiB blocks | 16 MiB blocks | |---|---|---| | Process private | 26.4 GB | **25.2 GB** | | Card memory in use | 11.8 GB | **10.9 GB** | | Texture blocks | 5.5 GB, 3.5 GB of it free | **4.5 GB, 2.4 GB free** | | Frame time | 51.3 ms | 53.4 ms (within the run-to-run spread at this spot) | **Bug found on the way:** the first upload of a texture recorded an aliasing barrier whenever the pool was on. A texture bigger than a block is committed, and the host refuses that barrier: the list fails to close. Before this, a texture had to be over 64 MiB to hit it; with 16 MiB blocks it happens at startup. `pool::pooled` now tells pooled textures apart by their private data, and only those get the barrier. `VICTORY_BIG_TRACE=1` logs a backtrace for every block of our own of 256 MiB or more. The 401 MB block in the memory line since run 65 is the title's own audio heap (`ApuAlloc`). **Since the PR was opened:** 41.3 → 25.2 GB private and 20.5 → 10.9 GB card in Series X, with frame time down from about 64 ms to about 50.
kripotker commented 2026-11-26 15:33:55 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by kripotker on 2026-11-26T15:33:55Z.


Update: texture blocks back to 64 MiB, and what the remaining memory is

Pushed: ef2ce61 sets the texture blocks back to 64 MiB by default. With 16 MiB blocks, one run showed garbage 4x4 blocks on a character's shirt in the boat cutscene; with 64 MiB the same scene renders clean. VICTORY_TEXTURE_BLOCK_MB=16 still picks the smaller blocks, which save about 1 GB of card memory at the same frame time.

Series X at the boat start (7900 XTX):

Setting Card (local) Private Frame
64 MiB blocks (default) 10.9–11.9 GB 26.2 GB 49.1 ms
16 MiB blocks 10.55 GB 24.7 GB 49.1 ms

Run-to-run noise in card usage is about ±0.5 GB.

True RAM footprint: closing the game freed 20.46 GB of RAM, so Series X uses about 20.5 GB of RAM plus about 10.9 GB of card memory, roughly 31.4 GB in all.

Tried and dropped (nothing pushed):

  • Consecutive slices for the title's physical pages (VICTORY_PORT_ALL): of 131,072 mapping calls, 126,600 map a single page, and with the neighbour's slice taken into account 120,050 of them were already in order, so not one page needed moving. The scattered title memory is recycled pages (not fresh) and GPU page-mapping aliases (69,557 pages) of views that are already mapped. Renaming slices cannot fix either.
  • Zeros for textures placed in reused pool memory and fullest-block-first placement: neither reproduced the garbage blocks in four runs, fewer than 64 textures landed in reused holes, and fullest-first's gain is within noise.

Leads:

  • The garbage-block runs both logged a block's heap pointer being reused (a block let go and a new one made at once), about 40 s before the garbage showed. Smaller blocks and fullest-first both churn blocks more. A slot that still names a dead texture would then read the new block's textures. This needs a reliable repro first.
  • The 6.09 GiB view outside title memory is the title pool's section window (xmem). Its 5.3 GB of resident pages are the title's own pages, shared, so it costs no extra RAM.

🤖 Generated with Claude Code

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7196444375 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/206#issuecomment-7196444375). Originally posted by [kripotker](https://github.com/kripotker) on 2026-11-26T15:33:55Z. --- ### Update: texture blocks back to 64 MiB, and what the remaining memory is **Pushed:** `ef2ce61` sets the texture blocks back to 64 MiB by default. With 16 MiB blocks, one run showed garbage 4x4 blocks on a character's shirt in the boat cutscene; with 64 MiB the same scene renders clean. `VICTORY_TEXTURE_BLOCK_MB=16` still picks the smaller blocks, which save about 1 GB of card memory at the same frame time. **Series X at the boat start (7900 XTX):** | Setting | Card (local) | Private | Frame | |---|---|---|---| | 64 MiB blocks (default) | 10.9–11.9 GB | 26.2 GB | 49.1 ms | | 16 MiB blocks | 10.55 GB | 24.7 GB | 49.1 ms | Run-to-run noise in card usage is about ±0.5 GB. **True RAM footprint:** closing the game freed 20.46 GB of RAM, so Series X uses about 20.5 GB of RAM plus about 10.9 GB of card memory, roughly 31.4 GB in all. **Tried and dropped (nothing pushed):** - *Consecutive slices for the title's physical pages* (`VICTORY_PORT_ALL`): of 131,072 mapping calls, 126,600 map a single page, and with the neighbour's slice taken into account 120,050 of them were already in order, so not one page needed moving. The scattered title memory is recycled pages (not fresh) and GPU page-mapping aliases (69,557 pages) of views that are already mapped. Renaming slices cannot fix either. - *Zeros for textures placed in reused pool memory* and *fullest-block-first placement*: neither reproduced the garbage blocks in four runs, fewer than 64 textures landed in reused holes, and fullest-first's gain is within noise. **Leads:** - The garbage-block runs both logged a block's heap pointer being reused (a block let go and a new one made at once), about 40 s before the garbage showed. Smaller blocks and fullest-first both churn blocks more. A slot that still names a dead texture would then read the new block's textures. This needs a reliable repro first. - The 6.09 GiB view outside title memory is the title pool's section window (xmem). Its 5.3 GB of resident pages are the title's own pages, shared, so it costs no extra RAM. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kripotker commented 2026-11-26 17:18:54 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by kripotker on 2026-11-26T17:18:54Z.


Update: where the unexplained memory went, and 1 GB less RAM

Traced (WPR VirtualAllocation trace with call stacks, live regions at the boat matched to the allocation that made them):

Owner Resident
Host copies of title memory (cached system memory the driver allocates on our list threads) 3.4 GB
Upload and staging buffers (write-combined) 3.1 GB
AMD driver's own heaps 2.1 GB
Our own heap 2.2 GB

Pushed:

  • c53599e play.ps1 now cuts windows on 64 KiB (VICTORY_WINDOW_KB=64, was 1024) and sets VICTORY_INPLACE=1. On the 1 MiB grid, 1.1 GB of window copies lay over the title's unmapped pages; for most of them the unmapped pages were inside the asked range, between separate asks in one cell. On 64 KiB the windows fall between those pages and the port uses them in place (39,882 placed against 907).
  • fb489d5 the port unmaps its view of a region the title remapped once nothing is placed in its heap. Before, those views stayed mapped for good, which the finer grid would have turned into thousands of leaked views (12,993 forgotten regions in one run).

At the boat, Series X (RAM measured as memory freed when the game closes):

Old defaults New defaults
Host copies of title memory 3,311 MB 1,998 MB
RAM 20.41 GB 19.41 GB
Frame 49–50 ms 50–51 ms

Card usage moved between 11.2 and 12.5 GB across runs with either setting. The difference is empty spare blocks the texture pool keeps while the card has room (5,120 against 6,464 MB in blocks, with the same live textures), not the windows.

Rendering: with the old settings, one run showed the grey shirt dark with black blotches and the floral shirt neon green in the boat cutscene. The new defaults rendered the same shots correctly in four runs. That points the earlier garbage reports at stale copies of title memory, not at texture block size.

Tried and reverted: a fresh command allocator per list reset (no RAM saved, 150 ms a frame); VICTORY_WINDOW_TAILS=1 with a 256 KiB grid (RAM −0.7 GB, no gain overall).

Tests: victory-gpu passed 370/370 in 5 of 6 full runs. descriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytes failed once in a full run and passes alone, so it looks like a shared-state flake.

🤖 Generated with Claude Code

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7198814495 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/206#issuecomment-7198814495). Originally posted by [kripotker](https://github.com/kripotker) on 2026-11-26T17:18:54Z. --- ### Update: where the unexplained memory went, and 1 GB less RAM **Traced** (WPR VirtualAllocation trace with call stacks, live regions at the boat matched to the allocation that made them): | Owner | Resident | |---|---| | Host copies of title memory (cached system memory the driver allocates on our list threads) | 3.4 GB | | Upload and staging buffers (write-combined) | 3.1 GB | | AMD driver's own heaps | 2.1 GB | | Our own heap | 2.2 GB | **Pushed:** - `c53599e` play.ps1 now cuts windows on 64 KiB (`VICTORY_WINDOW_KB=64`, was 1024) and sets `VICTORY_INPLACE=1`. On the 1 MiB grid, 1.1 GB of window copies lay over the title's unmapped pages; for most of them the unmapped pages were inside the asked range, between separate asks in one cell. On 64 KiB the windows fall between those pages and the port uses them in place (39,882 placed against 907). - `fb489d5` the port unmaps its view of a region the title remapped once nothing is placed in its heap. Before, those views stayed mapped for good, which the finer grid would have turned into thousands of leaked views (12,993 forgotten regions in one run). **At the boat, Series X (RAM measured as memory freed when the game closes):** | | Old defaults | New defaults | |---|---|---| | Host copies of title memory | 3,311 MB | 1,998 MB | | RAM | 20.41 GB | 19.41 GB | | Frame | 49–50 ms | 50–51 ms | Card usage moved between 11.2 and 12.5 GB across runs with either setting. The difference is empty spare blocks the texture pool keeps while the card has room (5,120 against 6,464 MB in blocks, with the same live textures), not the windows. **Rendering:** with the old settings, one run showed the grey shirt dark with black blotches and the floral shirt neon green in the boat cutscene. The new defaults rendered the same shots correctly in four runs. That points the earlier garbage reports at stale copies of title memory, not at texture block size. **Tried and reverted:** a fresh command allocator per list reset (no RAM saved, 150 ms a frame); `VICTORY_WINDOW_TAILS=1` with a 256 KiB grid (RAM −0.7 GB, no gain overall). **Tests:** victory-gpu passed 370/370 in 5 of 6 full runs. `descriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytes` failed once in a full run and passes alone, so it looks like a shared-state flake. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Fedalv commented 2026-11-26 18:11:08 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by Fedalv on 2026-11-26T18:11:08Z.


Linux/Proton (RADV, RX 7900 XTX): the play.ps1 part of this PR makes the frame 2.5x slower here; the code part is fine

Setup: Linux (kernel 7.2), Ryzen 7 7800X3D (SMT off), 30 GB RAM, RX 7900 XTX, Mesa RADV 26.2.5, Proton Experimental 11.0-20261112 with the view-tree wineserver (#111) and vkd3d-proton master 71cae09. Tree: main 2de9980 plus this PR and others, diagnostics build, Series X profile, the launcher's settings. Same opening sequence each run, 300 s.

median ms/frame "on the GPU" (submitting thread waiting for the card) copying back
without this PR's play.ps1 lines 52.0 1.4 ms ~24 ms
with them (VICTORY_INPLACE=1, VICTORY_PORT_ALL=1, VICTORY_WINDOW_KB=64, VICTORY_RESIDENCY=1) 132.7 28.9 ms ~43 ms
this PR's code, those four settings removed again 55.5 — —

(±4 ms is the spread between identical runs here.) The counters point at the wait: with the four settings, 0.4 submissions a frame settle for "title memory read … by a fill of upload memory", 19.7 ms of waiting for the card a frame, against 0.1 settles and 0.8 ms without them; card steps refused 0.38 a frame against 0.05.

I did not separate the four settings from each other. VICTORY_INPLACE is the likely one: reading title buffers where they are means the card reads PC memory over PCIe, and the 60 fps plan in #43 lists the single-copy path as measured 2-4x slower (R1). The Windows numbers in the PR text (49 ms) suggest it behaves differently there, so maybe the play.ps1 change could be kept out of this PR, or made a separate opt-in, rather than turned on for every launcher user.

AI-assisted (Claude Code); runs on my machine.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7200153276 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/206#issuecomment-7200153276). Originally posted by [Fedalv](https://github.com/Fedalv) on 2026-11-26T18:11:08Z. --- **Linux/Proton (RADV, RX 7900 XTX): the `play.ps1` part of this PR makes the frame 2.5x slower here; the code part is fine** Setup: Linux (kernel 7.2), Ryzen 7 7800X3D (SMT off), 30 GB RAM, RX 7900 XTX, Mesa RADV 26.2.5, Proton Experimental 11.0-20261112 with the view-tree wineserver (#111) and vkd3d-proton master `71cae09`. Tree: main `2de9980` plus this PR and others, diagnostics build, Series X profile, the launcher's settings. Same opening sequence each run, 300 s. | | median ms/frame | "on the GPU" (submitting thread waiting for the card) | copying back | |---|---|---|---| | without this PR's `play.ps1` lines | 52.0 | 1.4 ms | ~24 ms | | with them (`VICTORY_INPLACE=1`, `VICTORY_PORT_ALL=1`, `VICTORY_WINDOW_KB=64`, `VICTORY_RESIDENCY=1`) | 132.7 | 28.9 ms | ~43 ms | | this PR's code, those four settings removed again | 55.5 | — | — | (±4 ms is the spread between identical runs here.) The counters point at the wait: with the four settings, 0.4 submissions a frame settle for "title memory read … by a fill of upload memory", 19.7 ms of waiting for the card a frame, against 0.1 settles and 0.8 ms without them; card steps refused 0.38 a frame against 0.05. I did not separate the four settings from each other. `VICTORY_INPLACE` is the likely one: reading title buffers where they are means the card reads PC memory over PCIe, and the 60 fps plan in #43 lists the single-copy path as measured 2-4x slower (R1). The Windows numbers in the PR text (49 ms) suggest it behaves differently there, so maybe the `play.ps1` change could be kept out of this PR, or made a separate opt-in, rather than turned on for every launcher user. AI-assisted (Claude Code); runs on my machine.
kripotker commented 2026-11-26 18:49:48 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by kripotker on 2026-11-26T18:49:48Z.


@Fedalv thanks for measuring this, and for separating the code from the settings.

You're right. Those four settings are aimed at PCs whose graphics share their memory (an iGPU with LPDDR5X is the target), where reading the game's memory in place costs nothing and saves a copy. On Windows with a 7900 XTX they measured neutral here (50–51 ms against 49–50 at the boat), but a 2.5× hit on RADV is too much for a default.

Done in 996eafa and 4508cae: VICTORY_PORT_ALL, VICTORY_WINDOW_KB=64, VICTORY_INPLACE=1 and VICTORY_RESIDENCY=1 are now opt-in behind play.ps1 -LowMemory, documented in the README. Without the switch, play.ps1 sets what main sets (plus the new -Console option, which defaults to Series X as before).

Your counters fit the PCIe explanation: settles for "title memory read … by a fill of upload memory" and the submitting thread waiting on the card both go up when the card reads PC memory in place. If you get a chance to try the settings one at a time, VICTORY_INPLACE=1 (private memory in place) and VICTORY_PORT_ALL=1 (view memory in place) would be the two to separate. VICTORY_WINDOW_KB=64 on its own only changes how copies are cut.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7200898495 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/206#issuecomment-7200898495). Originally posted by [kripotker](https://github.com/kripotker) on 2026-11-26T18:49:48Z. --- @Fedalv thanks for measuring this, and for separating the code from the settings. You're right. Those four settings are aimed at PCs whose graphics share their memory (an iGPU with LPDDR5X is the target), where reading the game's memory in place costs nothing and saves a copy. On Windows with a 7900 XTX they measured neutral here (50–51 ms against 49–50 at the boat), but a 2.5× hit on RADV is too much for a default. Done in `996eafa` and `4508cae`: `VICTORY_PORT_ALL`, `VICTORY_WINDOW_KB=64`, `VICTORY_INPLACE=1` and `VICTORY_RESIDENCY=1` are now opt-in behind `play.ps1 -LowMemory`, documented in the README. Without the switch, `play.ps1` sets what main sets (plus the new `-Console` option, which defaults to Series X as before). Your counters fit the PCIe explanation: settles for "title memory read … by a fill of upload memory" and the submitting thread waiting on the card both go up when the card reads PC memory in place. If you get a chance to try the settings one at a time, `VICTORY_INPLACE=1` (private memory in place) and `VICTORY_PORT_ALL=1` (view memory in place) would be the two to separate. `VICTORY_WINDOW_KB=64` on its own only changes how copies are cut.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/206:upstream-pr/206'
git switch 'upstream-pr/206'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/206'
git switch 'upstream-pr/206'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/206'
git switch 'upstream-pr/206'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/206'
git switch 'main'
git merge --squash 'upstream-pr/206'
git switch 'main'
git merge --ff-only 'upstream-pr/206'
git switch 'main'
git merge 'upstream-pr/206'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
avatarmanz/VIctory-7900XTX!206
No description provided.