perf(vk): VRAM held for nothing given back: frame generation's images when off, the recording streams and descriptor pools #1158

Open
GummiNaomi wants to merge 2 commits from GummiNaomi/Longshot:perf/vram-held-idle into main
Member

Type: perf · Risk: low · Tested on: Windows 11, RTX 4070 SUPER (NVIDIA 617.42) · Needs: a Steam Deck; AMD on Linux; an 8 GB card; frame generation turned off in play

Why

On 4-8 GB cards and the Steam Deck the textures get what the rest leaves, and every MB the rest holds for nothing is a texture evicted and made again. In a 6 GB simulation of Castle Town's gate route (RX_VK_TEST_ALLOWED_MB=5600, a 6 GB card's mirror and texture budgets, 1080p) the textures used in the last 8 presents were 1,860 MB against a budget squeezed to 1,851 MB: 12,640 textures evicted in 140 s. Three things held VRAM they never used. (A fourth, the BC3 scratch's 140 MB, is #384's.)

What changed

Three places stop holding VRAM they don't use: 48 MB of streams on every card with resizable BAR, ~100 MB of descriptor pools on RADV (estimate), and up to ~800 MB where frame generation was tried and turned off; none of it changes the picture.

  • vk: frame interpolation's images, and FSR 3.1 frame interpolation's, are let go after 120 presents with frame generation off (or the other one chosen); before, only a resize let them go (framegen_idle, gpu/vk/vk_framegen.cpp; fsr3fi::release, gpu/vk/vk_fsr3fi.cpp). The check runs after the present's framegen_queue, and a present that recorded made frames counts as on whatever the row says by then (gpu/vk/framegen_idle.h), so a drain never waits for a set not handed to the display thread yet. ~150 MB at 2560x1440 2x, ~800 MB at 4K 8x.
  • vk: the 48 recording streams start at 1 MB instead of 2 (RX_VK_STREAM_MB; host-visible VRAM where the card has resizable BAR): 48 MB. A recording that needs more still gets a bigger stream.
  • vk: a recording slot's descriptor pool starts at half its size and is made whole after a recording runs out of it (RX_VK_DESC_POOL_GROW=0: whole from the start). RADV keeps a pool's descriptors in GPU memory (~4 MB a whole pool, 48 slots: an estimate from RADV's descriptor sizes, not measured); NVIDIA does not hold a pool to its per-type sizes, so nothing changes there (gpu/vk/vk_draw.cpp).
  • log: the recording streams' line gives the most sets and descriptors of each type a recording took and the slots' pools made whole; the write-back diff's line gives how much of the shadows holds anything (what shadows made of parts would take: 208 of 356 MB here).
  • tests: tests/test_framegen_idle.py compiles the idle rule and runs present sequences (among them: off for 119, then a present that records with the row on and reads Off at the check); tests/test_vram_held_idle.py (the order in the present's path, the streams and pools).
  • docs: RX_VK_STREAM_MB, RX_VK_DESC_POOL_GROW in docs/development.md.

Measurements

Verdict: the memory each change gives back, read from the logs; no frame-rate claim. Single runs of the 6 GB simulation vary by 20-30 % in slow frames between identical builds, more than ~190 MB moves them, so the frame rate is left to testers on small cards.

Hardware: Windows 11 Pro 26200, RTX 4070 SUPER 12 GB (NVIDIA 617.42), Ryzen 9 9950X3D (16 cores, SMT off), 32 GB
Scene: save set "First Step into Hyrule Town", Castle Town's gate into Hyrule Field and back (gate-bridge-wall.txt, wall clock), 2560x1440, DLAA, uncapped, RX_VK_TEST_ALLOWED_MB=10200
Method: headless runs; the figures are the log's own lines (the recording streams', the write-back diff's) and the sizes of what is made
Baseline: main's sizes are fixed (2 MB streams, whole pools), so the before column is what main allocates, not a run
How to reproduce: the route above; read the log's "recording streams" and "write-back diff" lines; RX_VK_STREAM_MB=2 RX_VK_DESC_POOL_GROW=0 gives main's sizes

Before: main @ 71b1edd8 After: this PR @ 4e889b09
Recording streams 48 x 2 MB 48 x 1 MB (the most one held: 371-453 KB; 0 made on demand)
A slot's descriptor pool 8,192 sets, 32,768 sampled images 4,096 and 16,384, whole after running out (a recording took at most 289 sets and 17,251 sampled images)
Frame interpolation's images after it is turned off kept to the next resize let go after 120 presents

Flags and settings

One default changes and one switch is new (RX_VK_DESC_POOL_GROW).

Flag What it is Before this PR After this PR Effect Helps / doesn't help / untested Recommendation
RX_VK_STREAM_MB a recording's first stream 2 1 48 MB less RTX 4070 SUPER; untested elsewhere 1
RX_VK_DESC_POOL_GROW a slot's pool starts at half and grows (none: whole) 1 ~100 MB less on RADV (estimate) untested on AMD 1

Testing

Tested: Windows 11, RTX 4070 SUPER, NVIDIA 617.42: the gate route several times on this change (no device loss); tests/test_vram_held_idle.py passes; tests/test_framegen_idle.py passes with emsdk's clang++ (--cxx); python -I -B tests/run_all.py: the same 64 failing tests as main 71b1edd8 on this PC (its toolchain: Windows line endings, fixtures needing gcc or clang++), plus tests/test_longshot_ctl.py's relaunch case in two of the full runs (a stand-in process stopped by exit not quit, a file still open at cleanup; it passes alone here and on main, and touches nothing this PR changes). tests/test_parallel_init_order.py and tests/test_fsr_uniform_ownership.py do not build their fixtures on main (FpsRtWait, fps_stats missing from their stand-ins since #928).

Not tested: frame generation turned off in play (headless runs cannot change the row), AMD and RADV (the descriptor pools' saving and their growth), the Steam Deck, a real 6-8 GB card.

Must be tested:

  • Any GPU, Windows or Linux: frame generation on, played a minute, then off, then on again, expecting the log's frame interpolation off: its images ... let go line about 2 s after turning it off, nothing wrong on screen, and frame generation working again when turned back on (by hand)
  • A Steam Deck or Linux AMD: Castle Town's market and Hyrule Field for a few minutes, the "recording streams" line's pools made whole and pools added, expecting few; no rendering difference (Test Farm: @Beanstalk linux)
  • An 8 GB card: the same, expecting fewer textures retired ... budget lines in the log than main gives (by hand)

Risks

What could break: a descriptor pool too small for a scene on a driver that holds the sizes costs one whole pool made for that recording, then the slot's pool is whole. Frame generation turned on again after being let go makes its images again (one device wait, as a resize does).

Turning it off: RX_VK_STREAM_MB=2 RX_VK_DESC_POOL_GROW=0; frame generation's release has no switch.

Compatibility: Nothing changes.

Issues

Related: #939 (6 GB cards over the driver's allowance). The BC3 scratch: #384.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value.
  • A file in docs/tested/ for each new measured run (format in docs/tested-configurations.md).
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Docs updated.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (Built on Windows only.)

🤖 Generated with Claude Code

**Type:** perf · **Risk:** low · **Tested on:** Windows 11, RTX 4070 SUPER (NVIDIA 617.42) · **Needs:** a Steam Deck; AMD on Linux; an 8 GB card; frame generation turned off in play ## Why On 4-8 GB cards and the Steam Deck the textures get what the rest leaves, and every MB the rest holds for nothing is a texture evicted and made again. In a 6 GB simulation of Castle Town's gate route (`RX_VK_TEST_ALLOWED_MB=5600`, a 6 GB card's mirror and texture budgets, 1080p) the textures used in the last 8 presents were 1,860 MB against a budget squeezed to 1,851 MB: 12,640 textures evicted in 140 s. Three things held VRAM they never used. (A fourth, the BC3 scratch's 140 MB, is #384's.) ## What changed Three places stop holding VRAM they don't use: 48 MB of streams on every card with resizable BAR, ~100 MB of descriptor pools on RADV (estimate), and up to ~800 MB where frame generation was tried and turned off; none of it changes the picture. - vk: frame interpolation's images, and FSR 3.1 frame interpolation's, are let go after 120 presents with frame generation off (or the other one chosen); before, only a resize let them go (`framegen_idle`, `gpu/vk/vk_framegen.cpp`; `fsr3fi::release`, `gpu/vk/vk_fsr3fi.cpp`). The check runs after the present's `framegen_queue`, and a present that recorded made frames counts as on whatever the row says by then (`gpu/vk/framegen_idle.h`), so a drain never waits for a set not handed to the display thread yet. ~150 MB at 2560x1440 2x, ~800 MB at 4K 8x. - vk: the 48 recording streams start at 1 MB instead of 2 (`RX_VK_STREAM_MB`; host-visible VRAM where the card has resizable BAR): 48 MB. A recording that needs more still gets a bigger stream. - vk: a recording slot's descriptor pool starts at half its size and is made whole after a recording runs out of it (`RX_VK_DESC_POOL_GROW=0`: whole from the start). RADV keeps a pool's descriptors in GPU memory (~4 MB a whole pool, 48 slots: an estimate from RADV's descriptor sizes, not measured); NVIDIA does not hold a pool to its per-type sizes, so nothing changes there (`gpu/vk/vk_draw.cpp`). - log: the recording streams' line gives the most sets and descriptors of each type a recording took and the slots' pools made whole; the write-back diff's line gives how much of the shadows holds anything (what shadows made of parts would take: 208 of 356 MB here). - tests: `tests/test_framegen_idle.py` compiles the idle rule and runs present sequences (among them: off for 119, then a present that records with the row on and reads Off at the check); `tests/test_vram_held_idle.py` (the order in the present's path, the streams and pools). - docs: `RX_VK_STREAM_MB`, `RX_VK_DESC_POOL_GROW` in `docs/development.md`. ## Measurements **Verdict:** the memory each change gives back, read from the logs; no frame-rate claim. Single runs of the 6 GB simulation vary by 20-30 % in slow frames between identical builds, more than ~190 MB moves them, so the frame rate is left to testers on small cards. Hardware: Windows 11 Pro 26200, RTX 4070 SUPER 12 GB (NVIDIA 617.42), Ryzen 9 9950X3D (16 cores, SMT off), 32 GB Scene: save set "First Step into Hyrule Town", Castle Town's gate into Hyrule Field and back (gate-bridge-wall.txt, wall clock), 2560x1440, DLAA, uncapped, `RX_VK_TEST_ALLOWED_MB=10200` Method: headless runs; the figures are the log's own lines (the recording streams', the write-back diff's) and the sizes of what is made Baseline: main's sizes are fixed (2 MB streams, whole pools), so the before column is what main allocates, not a run How to reproduce: the route above; read the log's "recording streams" and "write-back diff" lines; `RX_VK_STREAM_MB=2 RX_VK_DESC_POOL_GROW=0` gives main's sizes | | Before: main @ 71b1edd8 | After: this PR @ 4e889b09 | |---|---|---| | Recording streams | 48 x 2 MB | 48 x 1 MB (the most one held: 371-453 KB; 0 made on demand) | | A slot's descriptor pool | 8,192 sets, 32,768 sampled images | 4,096 and 16,384, whole after running out (a recording took at most 289 sets and 17,251 sampled images) | | Frame interpolation's images after it is turned off | kept to the next resize | let go after 120 presents | ### Flags and settings One default changes and one switch is new (`RX_VK_DESC_POOL_GROW`). | Flag | What it is | Before this PR | After this PR | Effect | Helps / doesn't help / untested | Recommendation | |---|---|---|---|---|---|---| | `RX_VK_STREAM_MB` | a recording's first stream | 2 | 1 | 48 MB less | RTX 4070 SUPER; untested elsewhere | 1 | | `RX_VK_DESC_POOL_GROW` | a slot's pool starts at half and grows | (none: whole) | 1 | ~100 MB less on RADV (estimate) | untested on AMD | 1 | ## Testing **Tested:** Windows 11, RTX 4070 SUPER, NVIDIA 617.42: the gate route several times on this change (no device loss); `tests/test_vram_held_idle.py` passes; `tests/test_framegen_idle.py` passes with emsdk's clang++ (`--cxx`); `python -I -B tests/run_all.py`: the same 64 failing tests as main 71b1edd8 on this PC (its toolchain: Windows line endings, fixtures needing gcc or clang++), plus `tests/test_longshot_ctl.py`'s relaunch case in two of the full runs (a stand-in process stopped by exit not quit, a file still open at cleanup; it passes alone here and on main, and touches nothing this PR changes). `tests/test_parallel_init_order.py` and `tests/test_fsr_uniform_ownership.py` do not build their fixtures on main (`FpsRtWait`, `fps_stats` missing from their stand-ins since #928). **Not tested:** frame generation turned off in play (headless runs cannot change the row), AMD and RADV (the descriptor pools' saving and their growth), the Steam Deck, a real 6-8 GB card. **Must be tested:** - Any GPU, Windows or Linux: frame generation on, played a minute, then off, then on again, expecting the log's `frame interpolation off: its images ... let go` line about 2 s after turning it off, nothing wrong on screen, and frame generation working again when turned back on (by hand) - A Steam Deck or Linux AMD: Castle Town's market and Hyrule Field for a few minutes, the "recording streams" line's pools made whole and pools added, expecting few; no rendering difference (Test Farm: @Beanstalk linux) - An 8 GB card: the same, expecting fewer `textures retired ... budget` lines in the log than main gives (by hand) ## Risks **What could break:** a descriptor pool too small for a scene on a driver that holds the sizes costs one whole pool made for that recording, then the slot's pool is whole. Frame generation turned on again after being let go makes its images again (one device wait, as a resize does). **Turning it off:** `RX_VK_STREAM_MB=2 RX_VK_DESC_POOL_GROW=0`; frame generation's release has no switch. **Compatibility:** Nothing changes. ## Issues Related: #939 (6 GB cards over the driver's allowance). The BC3 scratch: #384. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. - [x] A file in `docs/tested/` for each new measured run (format in `docs/tested-configurations.md`). - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [x] Docs updated. - [ ] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (Built on Windows only.) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
perf(vk): VRAM held for nothing given back: the BC3 scratch, frame generation's images when off, the recording streams and descriptor pools
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
CI / Workflow lint (actionlint) (pull_request) Successful in 11s
Third-party parts / As their notes say (pull_request) Successful in 14s
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 4s
141d45bbb7
Four things held VRAM they did not use:

- The BC3 scratch was 2048 x 2048 x 8 RGBA8 and a 32 MB buffer, 160 MB held
  for the run, while a pass takes RX_VK_BC_LAYERS layers, 1 by default: now
  made for those (20 MB a layer). Every card that keeps ASTC as BC3 (under
  8.5 GB allowed, integrated GPUs, the Steam Deck). The copy into BC3
  textures follows the same count.
- Frame interpolation's images and FSR 3.1 frame interpolation's were let go
  only on a resize: now after 120 presents with frame generation off (or the
  other one chosen). ~150 MB at 2560x1440 2x, ~800 MB at 4K 8x.
- The 48 recording streams start at 1 MB, not 2 (host-visible VRAM where the
  card has resizable BAR): the most one held was 371-453 KB, and a stream
  still grows on demand.
- A recording slot's descriptor pool starts at half its size and is made
  whole after a recording runs out of it (RADV keeps a pool's descriptors in
  GPU memory). A recording took at most 289 sets and 17,251 sampled images
  of 8,192 and 32,768.

The streams' line now gives what a recording took of its pool, and the
write-back diff's line how much of the shadows holds anything.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator

Possibly related, for context:

  • PR #384 perf(vk): the BC3 scratch has the layers a run uses, 20 MB instead of 160 — Overlapping BC3 scratch sizing work; same core change
  • issue #939 Game: on a 6 GB card VRAM goes over the driver's allowance after a few area changes, Hyrule Field falls from 31 to 14 fps until a restart (GTX 1060, nightly-189) — Reports low-FPS VRAM pressure on 6 GB NVIDIA cards this aims to alleviate
Possibly related, for context: - PR #384 perf(vk): the BC3 scratch has the layers a run uses, 20 MB instead of 160 — Overlapping BC3 scratch sizing work; same core change - issue #939 Game: on a 6 GB card VRAM goes over the driver's allowance after a few area changes, Hyrule Field falls from 31 to 14 fps until a restart (GTX 1060, nightly-189) — Reports low-FPS VRAM pressure on 6 GB NVIDIA cards this aims to alleviate
futondestroyer left a comment

Reviewed exact head 141d45bbb72e75d6c9fdce6b3e721438538a5d54, code and existing evidence only. No builds, tests or gameplay run here. This remains WIP.

[P1] Do not drain a recorded frame-generation set before it has been queued. In gpu/vk/vk_replay.cpp, the new framegen_idle() call is before framegen_queue(value). framegen_record() has already marked its selected set busy and saved it in fg.recorded, while only the later queue call gives the display thread the job that eventually clears busy. The new idle function rereads opts.framegen (the menu runs on the display thread), rather than using whether this present actually recorded interpolation. After at least 119 off presents, consider a present that records a set while enabled, then observes Off in framegen_idle(): its off counter reaches the threshold and waits for every set to become non-busy, including the current set whose queue call this same replay thread has not reached. Neither thread can clear that set, so the wait hangs. Merely reaching a device idle cannot fix the unqueued display job. Enqueue any recorded job before a possible drain, or explicitly suppress/reset idle retirement for a present that recorded a set; handle current-frame ownership independently of a second menu read. Add a behavioral regression covering a pending recorded/busy set and an on/off change between recording and idle. The current test checks only that wait/drop strings occur in the function and cannot catch this ordering bug.

Split out the already-developed BC3 scratch work. #384 is open with approvals and substantially stronger Deck/desktop and batch-bound coverage for the same scratch-sizing change. Prefer landing/rebasing over that PR, then keep this PR focused on the remaining stream/pool/FG work; don't land duplicate implementations or discard the existing tests/evidence.

Other readiness gaps: descriptor-pool growth and FG off/on behavior have not been exercised on the target drivers; tests here mostly assert source spelling rather than execute lifecycle/batching/growth. Changing three defaults calls for real target-hardware evidence. The single-run measurements and analytical allocation sizes establish requested storage reductions, not actual low-VRAM frame-rate or eviction improvements. The source checks were heavily skipped on the author's toolchain. The current forge guide-image/source-review status fails and must be resolved or explained before merge.

Verdict: request changes for the cleanup ordering; keep WIP. Holding farm authorization until that potential hang is addressed. Afterward the useful runs are FG on/off/on in a window and RADV/Deck descriptor-growth and BC3 coverage, with actual low-VRAM results distinguished from a lowered software allowance.

Reviewed exact head `141d45bbb72e75d6c9fdce6b3e721438538a5d54`, code and existing evidence only. No builds, tests or gameplay run here. This remains WIP. **[P1] Do not drain a recorded frame-generation set before it has been queued.** In `gpu/vk/vk_replay.cpp`, the new `framegen_idle()` call is before `framegen_queue(value)`. `framegen_record()` has already marked its selected set busy and saved it in `fg.recorded`, while only the later queue call gives the display thread the job that eventually clears busy. The new idle function rereads `opts.framegen` (the menu runs on the display thread), rather than using whether this present actually recorded interpolation. After at least 119 off presents, consider a present that records a set while enabled, then observes Off in `framegen_idle()`: its off counter reaches the threshold and waits for every set to become non-busy, including the current set whose queue call this same replay thread has not reached. Neither thread can clear that set, so the wait hangs. Merely reaching a device idle cannot fix the unqueued display job. Enqueue any recorded job before a possible drain, or explicitly suppress/reset idle retirement for a present that recorded a set; handle current-frame ownership independently of a second menu read. Add a behavioral regression covering a pending recorded/busy set and an on/off change between recording and idle. The current test checks only that wait/drop strings occur in the function and cannot catch this ordering bug. **Split out the already-developed BC3 scratch work.** https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/384 is open with approvals and substantially stronger Deck/desktop and batch-bound coverage for the same scratch-sizing change. Prefer landing/rebasing over that PR, then keep this PR focused on the remaining stream/pool/FG work; don't land duplicate implementations or discard the existing tests/evidence. Other readiness gaps: descriptor-pool growth and FG off/on behavior have not been exercised on the target drivers; tests here mostly assert source spelling rather than execute lifecycle/batching/growth. Changing three defaults calls for real target-hardware evidence. The single-run measurements and analytical allocation sizes establish requested storage reductions, not actual low-VRAM frame-rate or eviction improvements. The source checks were heavily skipped on the author's toolchain. The current forge guide-image/source-review status fails and must be resolved or explained before merge. Verdict: request changes for the cleanup ordering; keep WIP. Holding farm authorization until that potential hang is addressed. Afterward the useful runs are FG on/off/on in a window and RADV/Deck descriptor-growth and BC3 coverage, with actual low-VRAM results distinguished from a lowered software allowance.
fix(vk): frame generation's images let go after the present's queue, never on a present that recorded; the BC3 scratch left to #384
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 11s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 19s
CI / Workflow lint (actionlint) (pull_request) Successful in 20s
Third-party parts / As their notes say (pull_request) Successful in 25s
PR description / Description follows the template (pull_request_target) Failing after 5s
4e889b096c
Review of #1158: framegen_idle ran before framegen_queue and read the row
again. Off for 119 presents, a present that recorded made frames with it on
and read Off at the check counted as the 120th and drained, waiting for its
own set, which only the queue call after it hands to the display thread: a
hang. Now the check is after the queue, and a present that recorded counts
as on whatever the row says by then (gpu/vk/framegen_idle.h, a rule with no
Vulkan in it). tests/test_framegen_idle.py compiles it and runs the
sequences, the one found among them.

The BC3 scratch's size is the same change as #384, which has the Steam Deck
and batch coverage: taken out of this PR (vk_texture.cpp, its stand-in, its
docs row and checks back as on main).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
GummiNaomi changed title from WIP: perf(vk): VRAM held for nothing given back: the BC3 scratch, frame generation's images when off, the recording streams and descriptor pools to WIP: perf(vk): VRAM held for nothing given back: frame generation's images when off, the recording streams and descriptor pools 2026-11-16 16:55:45 +00:00
Author
Member

Thanks, both points taken, pushed as 4e889b09 (a new commit, nothing rewritten):

  • [P1] the hang: right, and confirmed reading it again. framegen_idle now runs after framegen_queue(value), and a present that recorded made frames counts as on whatever the row says by the check, so a drain can't wait for a set the display thread hasn't been handed. The counting is a small rule with no Vulkan in it (gpu/vk/framegen_idle.h); tests/test_framegen_idle.py compiles it and runs present sequences, including the one you found (off for 119, then a present that records with the row on and reads Off at the check), plus the order of the two calls in the present's path.
  • The BC3 scratch: taken out of this PR; #384 covers it with better evidence. vk_texture.cpp, its test stand-in, the docs row and the checks are back as on main.

The rest stands as you say: the descriptor pools' growth and frame generation off/on still need the target drivers (RADV/Deck, a windowed FG off/on/off), and the measurements are allocation sizes, not low-VRAM frame-rate results; the description says so. The @Beanstalk runs you listed would be the useful ones once you're happy with the ordering fix.

Also from my side: in full run_all runs on Windows, tests/test_longshot_ctl.py's relaunch case failed twice on my branches (stopped by exit not quit, a file still open at cleanup) and passes alone here and on main: a timing flake, unrelated. And tests/test_parallel_init_order.py / tests/test_fsr_uniform_ownership.py don't build their fixtures on main since #928 (FpsRtWait, fps_stats lack stand-ins); I can send a small fix for those separately.

🤖 Generated with Claude Code

Thanks, both points taken, pushed as 4e889b09 (a new commit, nothing rewritten): - **[P1] the hang:** right, and confirmed reading it again. `framegen_idle` now runs after `framegen_queue(value)`, and a present that recorded made frames counts as on whatever the row says by the check, so a drain can't wait for a set the display thread hasn't been handed. The counting is a small rule with no Vulkan in it (`gpu/vk/framegen_idle.h`); `tests/test_framegen_idle.py` compiles it and runs present sequences, including the one you found (off for 119, then a present that records with the row on and reads Off at the check), plus the order of the two calls in the present's path. - **The BC3 scratch:** taken out of this PR; #384 covers it with better evidence. `vk_texture.cpp`, its test stand-in, the docs row and the checks are back as on main. The rest stands as you say: the descriptor pools' growth and frame generation off/on still need the target drivers (RADV/Deck, a windowed FG off/on/off), and the measurements are allocation sizes, not low-VRAM frame-rate results; the description says so. The `@Beanstalk` runs you listed would be the useful ones once you're happy with the ordering fix. Also from my side: in full `run_all` runs on Windows, `tests/test_longshot_ctl.py`'s relaunch case failed twice on my branches (stopped by `exit` not `quit`, a file still open at cleanup) and passes alone here and on main: a timing flake, unrelated. And `tests/test_parallel_init_order.py` / `tests/test_fsr_uniform_ownership.py` don't build their fixtures on main since #928 (`FpsRtWait`, `fps_stats` lack stand-ins); I can send a small fix for those separately. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
GummiNaomi changed title from WIP: perf(vk): VRAM held for nothing given back: frame generation's images when off, the recording streams and descriptor pools to perf(vk): VRAM held for nothing given back: frame generation's images when off, the recording streams and descriptor pools 2026-11-16 17:06:25 +00:00
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 11s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 19s
CI / Workflow lint (actionlint) (pull_request) Successful in 20s
Third-party parts / As their notes say (pull_request) Successful in 25s
PR description / Description follows the template (pull_request_target) Failing after 5s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'perf/vram-held-idle:GummiNaomi-perf/vram-held-idle'
git switch 'GummiNaomi-perf/vram-held-idle'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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
MagicBeanDev/Longshot!1158
No description provided.