perf(vk): memory priorities: when VRAM is overcommitted, what is drawn every frame stays in VRAM first #1159

Open
GummiNaomi wants to merge 1 commit from GummiNaomi/Longshot:perf/memory-priority into main
Member

Type: perf · Risk: low · Tested on: Windows 11, RTX 4070 SUPER (NVIDIA 617.42) · Needs: a card that runs out of VRAM (4-8 GB) on Windows; AMD; Linux; a Steam Deck

Why

When a 4-8 GB card's VRAM is overcommitted, Windows' memory manager (or the driver) moves some of the process's memory to system memory, and the GPU then reads it over PCIe. Without priorities it chooses alone: a render target or DLSS's history moved out is read and written every frame. VK_EXT_memory_priority lets the renderer say what should stay. NVIDIA's own guidance is to give critical resources a high priority for this (Vulkan dos and don'ts), and DXVK gives render targets and descriptor heaps 1.0, other memory 0.5, host-visible VRAM 0.1 (dxvk_memory.cpp).

What changed

Every VRAM allocation gets a priority, so a card that runs out moves textures and upload buffers to system memory before the frame being drawn; where VRAM isn't short, nothing changes.

  • vk: VK_EXT_memory_priority asked for where the device has it, its feature on, and VMA told (VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT) (gpu/vk/vk_main.cpp, gpu/vk/vk_vma.cpp). RX_VK_MEMORY_PRIORITY=0: not asked for.
  • vk: the render targets' blocks and the images' pool (DLSS, frame interpolation, the scratch images) 1.0; textures, mirrors, shadows and buffers VMA's 0.5; host-visible VRAM (the recording streams, staging) 0.1. Every VMA pool and allocation is given one: a pool left at its create info's zero would have been the lowest of all.
  • tests: tests/test_memory_priority.py (asked for, and every pool and allocation given a priority).
  • docs: RX_VK_MEMORY_PRIORITY in docs/development.md.

Measurements

Verdict: nothing to measure on this PC: priorities only matter when VRAM is really overcommitted, and RX_VK_TEST_ALLOWED_MB lowers the renderer's view of the allowance without filling the card, so no paging happens here. The log says the extension is on; the frame rate on a small card is for testers.

Flags and settings

One new switch, on by default.

Flag What it is Before this PR After this PR Effect Helps / doesn't help / untested Recommendation
RX_VK_MEMORY_PRIORITY memory priorities on VRAM allocations (none) 1 what stays in VRAM when it runs out untested on a card that runs out 1

Testing

Tested: Windows 11, RTX 4070 SUPER, NVIDIA 617.42: the gate route (no device loss; the log's vk: memory priorities (VK_EXT_memory_priority): on); tests/test_memory_priority.py passes (4 tests); python -I -B tests/run_all.py: 227 passed, 64 failed, 387 skipped, and main 71b1edd8 on the same PC has the same 64 failing tests (this PC's toolchain: Windows line endings, fixtures needing gcc or clang++).

Not tested: a card that runs out of VRAM, AMD, Intel, Linux, the Steam Deck.

Must be tested:

  • A 4-8 GB card, Windows: Castle Town's market at 1440p or higher with the texture budget high, until the overlay shows VRAM at the card's limit, then the same with RX_VK_MEMORY_PRIORITY=0, expecting fewer and shorter dips with it on (by hand)
  • Linux, AMD (RADV maps the priority to the kernel's buffer priority): the same, expecting the same (Test Farm: @Beanstalk amd)

Risks

What could break: a driver that mishandles the extension; it is only asked for where the device lists it, and RX_VK_MEMORY_PRIORITY=0 turns it off. Where VRAM is short, textures may now go to system memory before render targets did, which is the intent.

Turning it off: RX_VK_MEMORY_PRIORITY=0.

Compatibility: Nothing changes.

Issues

None found.

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 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 card that runs out of VRAM (4-8 GB) on Windows; AMD; Linux; a Steam Deck ## Why When a 4-8 GB card's VRAM is overcommitted, Windows' memory manager (or the driver) moves some of the process's memory to system memory, and the GPU then reads it over PCIe. Without priorities it chooses alone: a render target or DLSS's history moved out is read and written every frame. `VK_EXT_memory_priority` lets the renderer say what should stay. NVIDIA's own guidance is to give critical resources a high priority for this ([Vulkan dos and don'ts](https://developer.nvidia.com/blog/vulkan-dos-donts/)), and DXVK gives render targets and descriptor heaps 1.0, other memory 0.5, host-visible VRAM 0.1 (`dxvk_memory.cpp`). ## What changed Every VRAM allocation gets a priority, so a card that runs out moves textures and upload buffers to system memory before the frame being drawn; where VRAM isn't short, nothing changes. - vk: `VK_EXT_memory_priority` asked for where the device has it, its feature on, and VMA told (`VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT`) (`gpu/vk/vk_main.cpp`, `gpu/vk/vk_vma.cpp`). `RX_VK_MEMORY_PRIORITY=0`: not asked for. - vk: the render targets' blocks and the images' pool (DLSS, frame interpolation, the scratch images) 1.0; textures, mirrors, shadows and buffers VMA's 0.5; host-visible VRAM (the recording streams, staging) 0.1. Every VMA pool and allocation is given one: a pool left at its create info's zero would have been the lowest of all. - tests: `tests/test_memory_priority.py` (asked for, and every pool and allocation given a priority). - docs: `RX_VK_MEMORY_PRIORITY` in `docs/development.md`. ## Measurements **Verdict:** nothing to measure on this PC: priorities only matter when VRAM is really overcommitted, and `RX_VK_TEST_ALLOWED_MB` lowers the renderer's view of the allowance without filling the card, so no paging happens here. The log says the extension is on; the frame rate on a small card is for testers. ### Flags and settings One new switch, on by default. | Flag | What it is | Before this PR | After this PR | Effect | Helps / doesn't help / untested | Recommendation | |---|---|---|---|---|---|---| | `RX_VK_MEMORY_PRIORITY` | memory priorities on VRAM allocations | (none) | 1 | what stays in VRAM when it runs out | untested on a card that runs out | 1 | ## Testing **Tested:** Windows 11, RTX 4070 SUPER, NVIDIA 617.42: the gate route (no device loss; the log's `vk: memory priorities (VK_EXT_memory_priority): on`); `tests/test_memory_priority.py` passes (4 tests); `python -I -B tests/run_all.py`: 227 passed, 64 failed, 387 skipped, and main 71b1edd8 on the same PC has the same 64 failing tests (this PC's toolchain: Windows line endings, fixtures needing gcc or clang++). **Not tested:** a card that runs out of VRAM, AMD, Intel, Linux, the Steam Deck. **Must be tested:** - A 4-8 GB card, Windows: Castle Town's market at 1440p or higher with the texture budget high, until the overlay shows VRAM at the card's limit, then the same with `RX_VK_MEMORY_PRIORITY=0`, expecting fewer and shorter dips with it on (by hand) - Linux, AMD (RADV maps the priority to the kernel's buffer priority): the same, expecting the same (Test Farm: @Beanstalk amd) ## Risks **What could break:** a driver that mishandles the extension; it is only asked for where the device lists it, and `RX_VK_MEMORY_PRIORITY=0` turns it off. Where VRAM is short, textures may now go to system memory before render targets did, which is the intent. **Turning it off:** `RX_VK_MEMORY_PRIORITY=0`. **Compatibility:** Nothing changes. ## Issues None found. ## 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 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): memory priorities: when VRAM is overcommitted, what is drawn every frame stays in VRAM first
Some checks reported errors
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) Failing after 6s
beanstalk/approval approved by futondestroyer (reviewed)
beanstalk/windows+nvidia 0/1 pass, 1 error
beanstalk/linux+amd 1/1 pass
f0ec466210
VK_EXT_memory_priority where the device has it (RX_VK_MEMORY_PRIORITY=0:
not asked for). Where VRAM is overcommitted the driver or the OS moves the
lowest priority to system memory first; without priorities it chose alone,
and a render target moved there is read over PCIe every frame. As DXVK gives
them: the render targets' blocks and the images' pool (DLSS, frame
interpolation, the scratch images) 1.0; textures, mirrors and buffers VMA's
0.5; host-visible VRAM (the recording streams, staging) 0.1. Every VMA pool
and allocation is given one: left at the zero of its create info, a pool
would have been the lowest of all. Nothing changes where VRAM is not short.

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

Possibly related, for context:

  • PR #560 feat(vk): RX_VK_MEMORY_PRIORITY tells the driver which memory to keep in VRAM when it runs short (off by default) — Open duplicate proposal for VK memory-priority allocation policy; this PR differs in defaults and priority tiers.
  • PR #1141 WIP: perf(vk): give the VRAM mirrors to the pools the GPU reads most on 4-6 GB cards — Overlapping VRAM-pressure performance work prioritizes frequently read pools through mirror allocation.
  • 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) — Open 6 GB NVIDIA report of VRAM overcommit and severe frame-rate decline, relevant target scenario.
Possibly related, for context: - PR #560 feat(vk): RX_VK_MEMORY_PRIORITY tells the driver which memory to keep in VRAM when it runs short (off by default) — Open duplicate proposal for VK memory-priority allocation policy; this PR differs in defaults and priority tiers. - PR #1141 WIP: perf(vk): give the VRAM mirrors to the pools the GPU reads most on 4-6 GB cards — Overlapping VRAM-pressure performance work prioritizes frequently read pools through mirror allocation. - 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) — Open 6 GB NVIDIA report of VRAM overcommit and severe frame-rate decline, relevant target scenario.
futondestroyer left a comment

Reviewed exact head f0ec466210da0d120f8ea9e4bc1026c7938ec50c, code and evidence only. No code from the PR, tests, builds or gameplay run here. This remains WIP; this review is not merge approval.

No blocking implementation defect found in the extension setup: both extension presence and the queried memoryPriority feature gate the VMA allocator flag, and the switch leaves that allocator feature off. The custom-pool priorities are explicitly supplied, and allocation infos are initialized throughout the wrappers, including fallback paths. No renderer API version change or vendored edit is involved. Note that VMA custom-pool priority is per memory block; per-allocation priorities do not independently control pooled suballocations.

Merge concerns to settle:

  • This overlaps #560, which already supplies the same extension/VMA plumbing, an opt-in control and substantial paging measurements. Pick/consolidate one implementation rather than landing both. The difference is substantive policy, not just naming: this PR defaults on, leaves textures at 0.5 and gives host-visible buffers 0.1; 560 defaults off and its normal enabled tier lowers textures to 0.25. Its reported 1,0.5 experiment deteriorated over time, so its successful lower-texture-priority numbers must not be attributed to this different policy. That experiment also differs in host-visible priority and build, so it is not proof this PR regresses either.
  • No overcommit result is supplied for this PR. The author correctly says RX_VK_TEST_ALLOWED_MB does not cause actual paging. Before shipping this default on, compare off/on under measured real VRAM pressure and include a no-pressure comparison. Vendor documentation and an extension-enabled log line are not that measurement.
  • The four new tests check source strings/counts. They do not run device-feature combinations, allocator arguments or the switch-off behavior; a small production-code fixture would strengthen those guarantees.
  • The current guide-image/source-review CI status fails; Linux build and target-vendor coverage are outstanding. Keep WIP until the applicable evidence and checklist are complete.

Ready for limited farm validation of default-on versus off on Windows NVIDIA and Linux AMD where the farm permits this switch and workers support it. A high-VRAM smoke run is useful for compatibility but does not satisfy the 4-8 GB/paging requirement. Plans/reports should explicitly distinguish extension unsupported, insufficient VRAM pressure and unsupported metrics from a passing efficacy test. Do not introduce an external VRAM-filling tool through a test plan. I will authorize this exact head for farm testing separately; the duplicate/policy decision and real-pressure evidence remain open.

Reviewed exact head `f0ec466210da0d120f8ea9e4bc1026c7938ec50c`, code and evidence only. No code from the PR, tests, builds or gameplay run here. This remains WIP; this review is not merge approval. No blocking implementation defect found in the extension setup: both extension presence and the queried memoryPriority feature gate the VMA allocator flag, and the switch leaves that allocator feature off. The custom-pool priorities are explicitly supplied, and allocation infos are initialized throughout the wrappers, including fallback paths. No renderer API version change or vendored edit is involved. Note that VMA custom-pool priority is per memory block; per-allocation priorities do not independently control pooled suballocations. **Merge concerns to settle:** - This overlaps https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/560, which already supplies the same extension/VMA plumbing, an opt-in control and substantial paging measurements. Pick/consolidate one implementation rather than landing both. The difference is substantive policy, not just naming: this PR defaults on, leaves textures at 0.5 and gives host-visible buffers 0.1; 560 defaults off and its normal enabled tier lowers textures to 0.25. Its reported `1,0.5` experiment deteriorated over time, so its successful lower-texture-priority numbers must not be attributed to this different policy. That experiment also differs in host-visible priority and build, so it is not proof this PR regresses either. - No overcommit result is supplied for this PR. The author correctly says RX_VK_TEST_ALLOWED_MB does not cause actual paging. Before shipping this default on, compare off/on under measured real VRAM pressure and include a no-pressure comparison. Vendor documentation and an extension-enabled log line are not that measurement. - The four new tests check source strings/counts. They do not run device-feature combinations, allocator arguments or the switch-off behavior; a small production-code fixture would strengthen those guarantees. - The current guide-image/source-review CI status fails; Linux build and target-vendor coverage are outstanding. Keep WIP until the applicable evidence and checklist are complete. Ready for limited farm validation of default-on versus off on Windows NVIDIA and Linux AMD where the farm permits this switch and workers support it. A high-VRAM smoke run is useful for compatibility but does not satisfy the 4-8 GB/paging requirement. Plans/reports should explicitly distinguish extension unsupported, insufficient VRAM pressure and unsupported metrics from a passing efficacy test. Do not introduce an external VRAM-filling tool through a test plan. I will authorize this exact head for farm testing separately; the duplicate/policy decision and real-pressure evidence remain open.
Member

@Beanstalk Test reviewed head f0ec466210 on Windows NVIDIA and Linux AMD. Compare the default with RX_VK_MEMORY_PRIORITY=0 if allowed by the farm switch policy, frame generation off, using the same Market/Hyrule Field route and settings. Record extension support, crashes, frame times and VRAM. Prefer 4-8 GB hardware where available. Only claim a pressure benefit if real paging/overcommit is actually established; a software allowance limit or high-VRAM smoke pass does not establish that. Do not use external memory-filling programs; report unsupported switch comparisons or pressure measurements as untested. This is WIP validation, not merge approval.

@Beanstalk Test reviewed head f0ec466210da0d120f8ea9e4bc1026c7938ec50c on Windows NVIDIA and Linux AMD. Compare the default with RX_VK_MEMORY_PRIORITY=0 if allowed by the farm switch policy, frame generation off, using the same Market/Hyrule Field route and settings. Record extension support, crashes, frame times and VRAM. Prefer 4-8 GB hardware where available. Only claim a pressure benefit if real paging/overcommit is actually established; a software allowance limit or high-VRAM smoke pass does not establish that. Do not use external memory-filling programs; report unsupported switch comparisons or pressure measurements as untested. This is WIP validation, not merge approval.
Member

Beanstalk test farm

Commit f0ec466 · tier reviewed · approved by futondestroyer · dashboard

What will be tested · AI plan (gpt-6.1-terra)

This WIP validation runs the reviewed head against main on Windows NVIDIA and Linux AMD, preferably with 4–8 GB VRAM. Each run follows the same Market and Hyrule Field route with frame generation off; the switch matrix compares priorities enabled and disabled on the PR. The plan records extension status in logs, crashes, frame times and VRAM, and checks for visual and performance regressions over roughly 25 minutes per tester. Real paging is not measured, so a pressure benefit remains untested; this is not merge approval.

  • Where: windows+nvidia (1 report), linux+amd (1 report).
  • Matrix: 2 cells, each on main and the PR: RX_VK_MEMORY_PRIORITY 1 or 0 (PR only).
  • market-field-route: from a new save (settings frame_generation=0), then teleport to Market, take the picture market to compare with main, measure market for 30 s (after 10 s warm-up), teleport to Hyrule Field, take the picture field to compare with main, measure field for 30 s (after 10 s warm-up); 1 run on each side for each of 2 cells (2 game starts a run).
  • Measured: crashes, frame times, stutters and hitches, VRAM use, the game's log.
  • The PR fails if: it crashes; or a picture differs from main by more than 5%; or peak VRAM is more than 10% above main; or frame time (p99) is more than 15% above main; or forbidden log lines is above 0.
  • Time: about 30 min of game runs per tester (4 game starts), plus the two builds.

Done. Comment @Beanstalk to run it again.

Target Reports Crash Frame p99 (ms) vs main VRAM peak (MB) vs main Result
windows+nvidia · 1: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3070 Laptop GPU, 621.24.0 1/1 1 none 23.8 vs 25.0 (−5%) 6,328 vs 6,422 (−1%) error
linux+amd · 1: linux+amd+radv+dgpu AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7 1/1 1 none 1115.0 vs 1115.9 (−0%) 7,919 vs 7,600 (+4%) pass
Scenario · matrix cell Target Frame p99 (ms) vs main Result
market-field-route · RX_VK_MEMORY_PRIORITY=1 (PR only) windows+nvidia — pass
market-field-route · RX_VK_MEMORY_PRIORITY=1 (PR only) linux+amd 1115.0 vs 1115.9 (−0%) pass
market-field-route · RX_VK_MEMORY_PRIORITY=0 (PR only) windows+nvidia 23.8 vs 25.0 (−5%) pass
market-field-route · RX_VK_MEMORY_PRIORITY=0 (PR only) linux+amd 1125.7 vs 1115.4 (+1%) pass

Measurements · windows+nvidia

Verdict: could not be judged on windows+nvidia (1/1 report).

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3070 Laptop GPU, 621.24.0 AMD Ryzen 9 5900HX with Radeon Graphics, 32 GB RAM
Scene: market-field-route, from a new save (frame_generation=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); market-field-route: 1 game start a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up; each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Before: main @ 71b1edd After: this PR @ f0ec466
market-field-route · RX_VK_MEMORY_PRIORITY=1 (PR only) · forbidden log lines 0.0 0.0
market-field-route · RX_VK_MEMORY_PRIORITY=0 (PR only) · field · peak VRAM (MB) 6,422 6,328 (−1%)
market-field-route · RX_VK_MEMORY_PRIORITY=0 (PR only) · market · peak VRAM (MB) 6,310 6,386 (+1%)
market-field-route · RX_VK_MEMORY_PRIORITY=0 (PR only) · field · frame time (p99) (ms) 25.0 23.8 (−5%)
market-field-route · RX_VK_MEMORY_PRIORITY=0 (PR only) · market · frame time (p99) (ms) 43.0 41.7 (−3%)
market-field-route · RX_VK_MEMORY_PRIORITY=0 (PR only) · forbidden log lines 0.0 0.0

Flags and settings

Flag What it is Values tried Before this PR After this PR Effect (peak VRAM) Helps / doesn't help / untested
RX_VK_MEMORY_PRIORITY switch the PR adds (set on the PR side only) 1, 0 not in main the PR's default market-field-route, main without it → the PR with 1: not measured untested
Markdown for the PR description
## Measurements

**Verdict:** could not be judged on windows+nvidia (1/1 report).

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3070 Laptop GPU, 621.24.0` `AMD Ryzen 9 5900HX with Radeon Graphics, 32 GB RAM`  
Scene: market-field-route, from a new save (frame_generation=0); each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); market-field-route: 1 game start a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up; each number the median of the runs, then of 1 report  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

| | Before: main @ 71b1edd | After: this PR @ f0ec466 |
|---|---|---|
| market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · forbidden log lines | 0.0 | 0.0 |
| market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · field · peak VRAM (MB) | 6,422 | 6,328 (−1%) |
| market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · market · peak VRAM (MB) | 6,310 | 6,386 (+1%) |
| market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · field · frame time (p99) (ms) | 25.0 | 23.8 (−5%) |
| market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · market · frame time (p99) (ms) | 43.0 | 41.7 (−3%) |
| market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · forbidden log lines | 0.0 | 0.0 |

### Flags and settings

| Flag | What it is | Values tried | Before this PR | After this PR | Effect (peak VRAM) | Helps / doesn't help / untested |
|---|---|---|---|---|---|---|
| `RX_VK_MEMORY_PRIORITY` | switch the PR adds (set on the PR side only) | `1`, `0` | not in main | the PR's default | market-field-route, main without it → the PR with 1: not measured | untested |

Measurements · linux+amd

Verdict: pass on linux+amd (1/1 report): no rule failed and no PR run crashed.

Hardware: 1: linux+amd+radv+dgpu AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7 AMD Ryzen 7 5800X3D 8-Core Processor, 64 GB RAM
Scene: market-field-route, from a new save (frame_generation=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); market-field-route: 1 game start a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up; each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Before: main @ 71b1edd After: this PR @ f0ec466
market-field-route · RX_VK_MEMORY_PRIORITY=1 (PR only) · field · peak VRAM (MB) 7,600 7,919 (+4%)
market-field-route · RX_VK_MEMORY_PRIORITY=1 (PR only) · market · peak VRAM (MB) 7,600 7,919 (+4%)
market-field-route · RX_VK_MEMORY_PRIORITY=1 (PR only) · field · frame time (p99) (ms) 1,116 1,115 (−0%)
market-field-route · RX_VK_MEMORY_PRIORITY=1 (PR only) · market · frame time (p99) (ms) 1,134 1,149 (+1%)
market-field-route · RX_VK_MEMORY_PRIORITY=1 (PR only) · forbidden log lines 0.0 0.0
market-field-route · RX_VK_MEMORY_PRIORITY=0 (PR only) · field · peak VRAM (MB) 7,194 7,147 (−1%)
market-field-route · RX_VK_MEMORY_PRIORITY=0 (PR only) · market · peak VRAM (MB) 7,194 7,147 (−1%)
market-field-route · RX_VK_MEMORY_PRIORITY=0 (PR only) · field · frame time (p99) (ms) 1,115 1,126 (+1%)
market-field-route · RX_VK_MEMORY_PRIORITY=0 (PR only) · market · frame time (p99) (ms) 1,155 1,117 (−3%)
market-field-route · RX_VK_MEMORY_PRIORITY=0 (PR only) · forbidden log lines 0.0 0.0

Flags and settings

Flag What it is Values tried Before this PR After this PR Effect (peak VRAM) Helps / doesn't help / untested
RX_VK_MEMORY_PRIORITY switch the PR adds (set on the PR side only) 1, 0 not in main the PR's default market-field-route, main without it → the PR with 1: 7,600 → 7,919 (+4%) doesn't help
Markdown for the PR description
## Measurements

**Verdict:** pass on linux+amd (1/1 report): no rule failed and no PR run crashed.

Hardware: 1: linux+amd+radv+dgpu `AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7` `AMD Ryzen 7 5800X3D 8-Core Processor, 64 GB RAM`  
Scene: market-field-route, from a new save (frame_generation=0); each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); market-field-route: 1 game start a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up; each number the median of the runs, then of 1 report  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

| | Before: main @ 71b1edd | After: this PR @ f0ec466 |
|---|---|---|
| market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · field · peak VRAM (MB) | 7,600 | 7,919 (+4%) |
| market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · market · peak VRAM (MB) | 7,600 | 7,919 (+4%) |
| market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · field · frame time (p99) (ms) | 1,116 | 1,115 (−0%) |
| market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · market · frame time (p99) (ms) | 1,134 | 1,149 (+1%) |
| market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · forbidden log lines | 0.0 | 0.0 |
| market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · field · peak VRAM (MB) | 7,194 | 7,147 (−1%) |
| market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · market · peak VRAM (MB) | 7,194 | 7,147 (−1%) |
| market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · field · frame time (p99) (ms) | 1,115 | 1,126 (+1%) |
| market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · market · frame time (p99) (ms) | 1,155 | 1,117 (−3%) |
| market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · forbidden log lines | 0.0 | 0.0 |

### Flags and settings

| Flag | What it is | Values tried | Before this PR | After this PR | Effect (peak VRAM) | Helps / doesn't help / untested |
|---|---|---|---|---|---|---|
| `RX_VK_MEMORY_PRIORITY` | switch the PR adds (set on the PR side only) | `1`, `0` | not in main | the PR's default | market-field-route, main without it → the PR with 1: 7,600 → 7,919 (+4%) | doesn't help |
<!-- beanstalk:sticky --> ### Beanstalk test farm Commit `f0ec466` · tier **reviewed** · approved by futondestroyer · [dashboard](https://beanstalk.magicbean.dev/prs/1159) **What will be tested** · AI plan (`gpt-6.1-terra`) This WIP validation runs the reviewed head against main on Windows NVIDIA and Linux AMD, preferably with 4–8 GB VRAM. Each run follows the same Market and Hyrule Field route with frame generation off; the switch matrix compares priorities enabled and disabled on the PR. The plan records extension status in logs, crashes, frame times and VRAM, and checks for visual and performance regressions over roughly 25 minutes per tester. Real paging is not measured, so a pressure benefit remains untested; this is not merge approval. - **Where:** windows+nvidia (1 report), linux+amd (1 report). - **Matrix:** 2 cells, each on main and the PR: RX_VK_MEMORY_PRIORITY `1` or `0` (PR only). - **market-field-route:** from a new save (settings frame_generation=0), then teleport to Market, take the picture market to compare with main, measure market for 30 s (after 10 s warm-up), teleport to Hyrule Field, take the picture field to compare with main, measure field for 30 s (after 10 s warm-up); 1 run on each side for each of 2 cells (2 game starts a run). - **Measured:** crashes, frame times, stutters and hitches, VRAM use, the game's log. - **The PR fails if:** it crashes; or a picture differs from main by more than 5%; or peak VRAM is more than 10% above main; or frame time (p99) is more than 15% above main; or forbidden log lines is above 0. - **Time:** about 30 min of game runs per tester (4 game starts), plus the two builds. Done. Comment `@Beanstalk` to run it again. | Target | Reports | Crash | Frame p99 (ms) vs main | VRAM peak (MB) vs main | Result | | --- | --- | --- | --- | --- | --- | | windows+nvidia · 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3070 Laptop GPU, 621.24.0` | 1/1 [1](https://beanstalk.magicbean.dev/reports/rp_ad1da90f44d642a1) | none | 23.8 vs 25.0 (−5%) | 6,328 vs 6,422 (−1%) | error | | linux+amd · 1: linux+amd+radv+dgpu `AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7` | 1/1 [1](https://beanstalk.magicbean.dev/reports/rp_ae8c81d1d65bb2a6) | none | 1115.0 vs 1115.9 (−0%) | 7,919 vs 7,600 (+4%) | pass | | Scenario · matrix cell | Target | Frame p99 (ms) vs main | Result | | --- | --- | --- | --- | | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` | windows+nvidia | — | pass | | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` | linux+amd | 1115.0 vs 1115.9 (−0%) | pass | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` | windows+nvidia | 23.8 vs 25.0 (−5%) | pass | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` | linux+amd | 1125.7 vs 1115.4 (+1%) | pass | #### Measurements · windows+nvidia **Verdict:** could not be judged on windows+nvidia (1/1 report). Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3070 Laptop GPU, 621.24.0` `AMD Ryzen 9 5900HX with Radeon Graphics, 32 GB RAM` Scene: market-field-route, from a new save (frame_generation=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); market-field-route: 1 game start a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up; each number the median of the runs, then of 1 report How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 71b1edd | After: this PR @ f0ec466 | |---|---|---| | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · field · peak VRAM (MB) | 6,422 | 6,328 (−1%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · market · peak VRAM (MB) | 6,310 | 6,386 (+1%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · field · frame time (p99) (ms) | 25.0 | 23.8 (−5%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · market · frame time (p99) (ms) | 43.0 | 41.7 (−3%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · forbidden log lines | 0.0 | 0.0 | ### Flags and settings | Flag | What it is | Values tried | Before this PR | After this PR | Effect (peak VRAM) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `RX_VK_MEMORY_PRIORITY` | switch the PR adds (set on the PR side only) | `1`, `0` | not in main | the PR's default | market-field-route, main without it → the PR with 1: not measured | untested | <details><summary>Markdown for the PR description</summary> ```markdown ## Measurements **Verdict:** could not be judged on windows+nvidia (1/1 report). Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3070 Laptop GPU, 621.24.0` `AMD Ryzen 9 5900HX with Radeon Graphics, 32 GB RAM` Scene: market-field-route, from a new save (frame_generation=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); market-field-route: 1 game start a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up; each number the median of the runs, then of 1 report How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 71b1edd | After: this PR @ f0ec466 | |---|---|---| | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · field · peak VRAM (MB) | 6,422 | 6,328 (−1%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · market · peak VRAM (MB) | 6,310 | 6,386 (+1%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · field · frame time (p99) (ms) | 25.0 | 23.8 (−5%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · market · frame time (p99) (ms) | 43.0 | 41.7 (−3%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · forbidden log lines | 0.0 | 0.0 | ### Flags and settings | Flag | What it is | Values tried | Before this PR | After this PR | Effect (peak VRAM) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `RX_VK_MEMORY_PRIORITY` | switch the PR adds (set on the PR side only) | `1`, `0` | not in main | the PR's default | market-field-route, main without it → the PR with 1: not measured | untested | ``` </details> #### Measurements · linux+amd **Verdict:** pass on linux+amd (1/1 report): no rule failed and no PR run crashed. Hardware: 1: linux+amd+radv+dgpu `AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7` `AMD Ryzen 7 5800X3D 8-Core Processor, 64 GB RAM` Scene: market-field-route, from a new save (frame_generation=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); market-field-route: 1 game start a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up; each number the median of the runs, then of 1 report How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 71b1edd | After: this PR @ f0ec466 | |---|---|---| | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · field · peak VRAM (MB) | 7,600 | 7,919 (+4%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · market · peak VRAM (MB) | 7,600 | 7,919 (+4%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · field · frame time (p99) (ms) | 1,116 | 1,115 (−0%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · market · frame time (p99) (ms) | 1,134 | 1,149 (+1%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · field · peak VRAM (MB) | 7,194 | 7,147 (−1%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · market · peak VRAM (MB) | 7,194 | 7,147 (−1%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · field · frame time (p99) (ms) | 1,115 | 1,126 (+1%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · market · frame time (p99) (ms) | 1,155 | 1,117 (−3%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · forbidden log lines | 0.0 | 0.0 | ### Flags and settings | Flag | What it is | Values tried | Before this PR | After this PR | Effect (peak VRAM) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `RX_VK_MEMORY_PRIORITY` | switch the PR adds (set on the PR side only) | `1`, `0` | not in main | the PR's default | market-field-route, main without it → the PR with 1: 7,600 → 7,919 (+4%) | doesn't help | <details><summary>Markdown for the PR description</summary> ```markdown ## Measurements **Verdict:** pass on linux+amd (1/1 report): no rule failed and no PR run crashed. Hardware: 1: linux+amd+radv+dgpu `AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7` `AMD Ryzen 7 5800X3D 8-Core Processor, 64 GB RAM` Scene: market-field-route, from a new save (frame_generation=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); market-field-route: 1 game start a side, market 30 s after 10 s warm-up, field 30 s after 10 s warm-up; each number the median of the runs, then of 1 report How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 71b1edd | After: this PR @ f0ec466 | |---|---|---| | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · field · peak VRAM (MB) | 7,600 | 7,919 (+4%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · market · peak VRAM (MB) | 7,600 | 7,919 (+4%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · field · frame time (p99) (ms) | 1,116 | 1,115 (−0%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · market · frame time (p99) (ms) | 1,134 | 1,149 (+1%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · field · peak VRAM (MB) | 7,194 | 7,147 (−1%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · market · peak VRAM (MB) | 7,194 | 7,147 (−1%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · field · frame time (p99) (ms) | 1,115 | 1,126 (+1%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · market · frame time (p99) (ms) | 1,155 | 1,117 (−3%) | | market-field-route · `RX_VK_MEMORY_PRIORITY=0 (PR only)` · forbidden log lines | 0.0 | 0.0 | ### Flags and settings | Flag | What it is | Values tried | Before this PR | After this PR | Effect (peak VRAM) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `RX_VK_MEMORY_PRIORITY` | switch the PR adds (set on the PR side only) | `1`, `0` | not in main | the PR's default | market-field-route, main without it → the PR with 1: 7,600 → 7,919 (+4%) | doesn't help | ``` </details>
Author
Member

Thanks for the review. Agreed on not landing two: I've suggested on #560 that it goes forward (it has the real paging measurements and a tested parser), carrying over the host-visible 0.1 tier and the farm's RADV result from here, and that I close this one once that's settled. Keeping it open until then so the Windows NVIDIA farm report can finish.

🤖 Generated with Claude Code

Thanks for the review. Agreed on not landing two: I've suggested on #560 that it goes forward (it has the real paging measurements and a tested parser), carrying over the host-visible 0.1 tier and the farm's RADV result from here, and that I close this one once that's settled. Keeping it open until then so the Windows NVIDIA farm report can finish. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
GummiNaomi changed title from WIP: perf(vk): memory priorities: when VRAM is overcommitted, what is drawn every frame stays in VRAM first to perf(vk): memory priorities: when VRAM is overcommitted, what is drawn every frame stays in VRAM first 2026-11-16 17:06:37 +00:00
Owner

Needs proper testing, use the VRAM limiting flag

Needs proper testing, use the VRAM limiting flag
Some checks reported errors
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) Failing after 6s
beanstalk/approval approved by futondestroyer (reviewed)
beanstalk/windows+nvidia 0/1 pass, 1 error
beanstalk/linux+amd 1/1 pass
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/memory-priority:GummiNaomi-perf/memory-priority'
git switch 'GummiNaomi-perf/memory-priority'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 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!1159
No description provided.