WIP: refactor(vk): remove three finished experiments from the memory model (RX_VK_MIRROR_TIGHT, RX_VK_CPU_OVER_GPU, RX_VK_BG_IMPORT) #2315

Draft
TrashPanda wants to merge 4 commits from TrashPanda/Longshot:refactor/memory-model-dead-attempts into main
Contributor

Summary

The renderer's memory model (gpu/vk/vk_memory.cpp and its neighbours) still carries switches that were experiments: off by default, their question answered, never removed. Standards says to remove a switch once it is settled. This goes through every attempt switch whose code is in the memory model and removes the ones that can go today, and nothing else. It is the part of the memory model that can be removed now; the larger parts stay (below).

What goes, 49 lines deleted and 31 added over 6 files (about 16 of the deleted lines are code, the rest comments and test text):

Commit What
docs(vk) vk_memory.cpp's head said "no mirrored copies, no write-backs, no upload streams": it describes the model it has now. Comment only.
RX_VK_MIRROR_TIGHT Refused new mirrors while VRAM was over 90% full. Its finding is in #237: "The 90% rule for mirrors (RX_VK_MIRROR_TIGHT=1) costs 5 fps and still ends at 95%." Both reads and the vram_usage call behind them go.
RX_VK_CPU_OVER_GPU Took CPU writes over any GPU-written texture. Its finding is in texture_touch's comment: it took over transient render targets' texels "and the menus' letters stayed missing with it". The check tests only_cleared alone, as at default.
RX_VK_BG_IMPORT Imported every pool the game makes on a background thread. Finding, beside the code: "the thread's page locking stalled the game's threads (3-7 fps)". memory_pool_created is an empty function now; MkwVkRenderer::nvn_pool_created stays, so no interface change.

Each removed switch becomes a GONE(...) row in gpu/vk/switches.def (the table is the switches reference; no other page lists them), and each test that read the removed text is updated, none weakened: test_mirror_trim.py expects mirrors_trim's line without the clause; test_drawn_page_map.py loses the one case that ran the check for a texture that is not only cleared (the only-cleared case beside it stays).

Every attempt switch in the memory model, with what was decided (open pull requests: all 401 listed, the heads of 399 merged with this branch and with main in a scratch repository, and their diffs searched for the names and functions; #1143 and #1092 could not be fetched):

Switch Finding written down Open pull request Verdict
RX_VK_MIRROR_TIGHT #237, numbers above none removed
RX_VK_CPU_OVER_GPU texture_touch comment none removed
RX_VK_BG_IMPORT memory_pool_created comment, 3-7 fps none removed
RX_VK_PREFETCH_CHUNKS "slowed the replay thread's own [imports] to 80-127 ms on AMD" #966 (macOS port) adds a call to prefetch_chunks held (I had removed it and put it back)
RX_VK_ASYNC_IMPORT "opt-in: background imports can slow AMD", no number #2210 reads it held
RX_VK_SSBO_STRETCH, RX_VK_SSBO_WIDE none #2210 reads both held
RX_VK_CAPTURE_NT mixed: #1841 no gain and more stutters on an RTX desktop, #1749 "cut its long frames on every run" on an AMD card #2128, #2129 build on it held
RX_VK_PROTECT_BARE "in a first Kokiri run it kept no page (0), so the hook or the trigger needs a closer look": the question is open #2134 edits mirror_sync's page walk held
RX_VK_READBACK_EXACT, RX_VK_READBACK_NO_CATCHUP none (#2042 lists the second with the A/B switches whose removal is "for the maintainer to decide") #2211, #2212 read both held
RX_VK_UB_CUR_ONLY same #2042 list #142, #796 (old) kept
RX_VK_NO_WRITEBACK none; used as a diagnostic in #2325 none kept: the tool a write-back measurement needs
RX_VK_MIRROR_HEAT_EXTRA #1141: "measured on one card only": open none kept
RX_VK_CAP_BLOCKS none #1599 touches its test kept
RX_VK_FOLLOW_STORES n/a #2040 excluded: it is read inside the shader recompiler and its prefix is hashed into the translator stamp, so removing it would have every player prepare shaders again

RX_VK_FRAME_GATE and RX_VK_SPARSE_IDLE are render-thread and sparse-texture switches, not the guest-memory model; HOS_COLLECT_VECTOR and HOS_COLLECT_WIDE are kill switches kept for a test and a benchmark. Only vk_memory.cpp's head comment described code that is gone; gpu/render/rx_nvn.h's head ("replays them with WebGPU") is also stale but that shared header is full of the same notes and is left for its own change.

Why not more. The census of the memory model (a removal ladder A to H) found that most of it cannot go on today's evidence, and measurements since agree: the captures stay (98.8% of mirror-synced pages come from earlier submits' captures, so they cannot be dropped); the game's flush and invalidate calls do nothing on the console, so they cannot replace the write marks; write-back on demand still sees the CPU touch a left-out range every couple of seconds (with a 4 KB limit the count of such ranges never stops growing), so it needs a copy at the first invalidate and is not a removal; the mirrors stay. This change is the one rung that is only deletion. It fits the switches track (#1309, #1390 and #1527 deleted 126 kill switches; attempts were left).

This was written with AI agents under the owner's direction: they read the code, searched the forge, made the commits and ran every check below; the commits carry Co-Authored-By trailers.

Testing

Tested: Linux, RTX 4070 Ti (NVIDIA 595.99), a runtime of main @ 753fb5af6 and one of this branch @ afecf01b5, both made as packs over base 3e4b1faf6e through the queue, default settings, RX_VK_MEM_CHECK=1 on both sides, one game at a time, 90 s in each scene: Link's house, Kokiri Forest, Hyrule Field (gamerun.py, six runs, all reached the scene and stopped cleanly).

  • logdiff.py on each pair (problem and warn levels): no new warning or error kind (0 kinds on either side). All-levels it differs only in info lines whose numbers differ.
  • The memory checker, last summary of each run: seq_mismatch 0, take_open 0, collect_open 0, sync_over_gpu ... 0 replaced on all six runs (main and branch).
  • Screenshots read, same scene and picture on both sides (only Navi and the fireflies differ with the clock).
  • Mirror syncs, per run, the share of dirty pages read from earlier submits' captures: 98.2 / 97.1 / 97.4% on main against 96.7 / 97.9 / 97.1% here (Kokiri house, forest, field); from guest memory 0.02 / 0.9 / 1.3% against 0.04 / 0.5 / 1.4%. Pages per 600 submits 52.7k / 44.6k / 49.5k against 52.6k / 45.9k / 47.9k. Write-back diff per 600 submits 841 / 872 / 785 MB against 953 / 1097 / 774 MB, left out 4.8 / 4.3 / 4.9 GB against 4.9 / 4.5 / 4.7 GB. The runs are 90 s of play after a variable start-up, so they hold 33k to 43k submits each; counts move by about 10% between two runs of one side, which is the spread.
  • vk: mirror syncs line, final field: not touched (the RX_VK_PROTECT_BARE count stays).
  • Checks: suite.py compare (main 753fb5af against this head, no --changed shortcut): 928 passed, 3 failed, 26 skipped on both sides; the same three fail on both (test_dev_packs.py, test_pipeline_state_computes.py, test_thinlto_tls.py: this PC's tools), none fails only here; the skipped sets are the same.
  • Translator stamp (nx2/translator_files.py, as build.py computes it): 0b724caa31e870ae on main and on the branch (252 files); no changed file is stamped, and none of the removed names begins with a prefix translator_stamp hashes (RX_VK_MMA, NATIVE, NAN, TASK_CAP, NETWORK, GP_, FOLLOW, NO_F16, MESH, NO_INVARIANT, MARKERS, ALL_GLOBAL_PROGS, MISS_LOG, BLOCK_PROBE, EDEN_), so no player prepares shaders again.
  • Machine code (objcmp.py, the builder's own flags, main against this head): vk_menu.cpp 853 of 853 functions identical, vk_texture.cpp 534 of 535, vk_memory.cpp 711 of 714. The four that differ, all simpler, each from removed code: texture_touch (2694 to 2672 instructions: the take static's guard), mirror_make (1809 to 1762: the tight_rule guard and the vram_usage call behind it), mirrors_trim (1062 to 1032: the same guard), memory_pool_created (98 instructions to a bare ret). No function appears or disappears.

Still to test:

  • AMD (RADV) and Intel Arc, a short run in Kokiri Forest on each: expect the same picture and no new warning kind (the Test Farm: @Beanstalk run Kokiri Forest for 60 s on an AMD card and an Intel Arc card, compare the log's warning kinds with main).
  • Windows: expect the same; the changes are the same C++ on both platforms (by hand or the Test Farm).

Measurements

Verdict: frame time, 1% low and the memory work of a submit are the same within the runs' spread; the GPU time a frame reads 0.08 ms higher (see below).

Setup: Linux, RTX 4070 Ti, NVIDIA 595.99; Kokiri Forest from the kokiri-start save, 60 s after arrival, the options pinned (preset 6, 2560x1440, V-Sync off, uncapped), RX_VK_FRAME_TRACE=1; timing mode of the queue, each of the four runs alone on the GPU (qoverlap.py: clean), two interleaved rounds main, branch, main, branch; frames of the last 55 s; "worst frames" from the whole run's frame log. Both runtimes made from the same base, same caches.

Before: main @ 753fb5af6 After: this PR @ afecf01b5
fps (round 1 / round 2) 137.2 / 137.3 137.5 / 137.2
median frame time 7.28 ms 7.27 ms
p99 frame time (last 55 s) 8.06 ms 8.05 ms
1% low 124.0 fps 124.2 fps
GPU time a frame 6.10 ms 6.18 ms (6.15 / 6.20)
worst frame of the whole run (round 1 / round 2) 275.7 / 217.6 ms 415.6 / 166.0 ms
frames over 33 ms of ~16,000 (round 1 / round 2) 10 / 14 7 / 8
a submit's memory work, ms (maps / capture taken / writes collected) 0.00 / 0.00 / 0.01 0.00 / 0.00 / 0.01

The worst frames are the load's, and move more between two runs of one side (276 and 218 ms on main) than between the sides. GPU time a frame reads 0.08 ms (1.3%) higher here, both rounds of this branch above both rounds of main; I have no explanation from the code (what was removed does not run at default settings, and the frame time, which includes the GPU's, did not move), so two rounds do not settle it and it is the one number in the table that leans against this change. Log line, last of each run: vk: a submit's memory work (ms): maps 0.00, capture taken 0.00, writes collected 0.01 on all four.

Risks

What could break: nothing at default settings by construction (all four removed paths were off), shown by the machine-code comparison above. A player who still sets one of the three removed names gets the GONE text in the log's switch report, and the same behaviour as before (they were off by default). Open pull requests that append their own GONE row at the end of switches.def (10 do) conflict with the three rows added here; they conflict with each other the same way, and none edits a removed line. A revert is enough to undo it. A player notices nothing; saves, longshot_options.ini and the caches are untouched.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named): mise is not on this PC; suite.py compare runs the same run_all.py on both sides: 928 passed, the same three fail on both (named above).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here. (n/a, ticked so the check passes: this is not a fix.)
  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def. (Three switches removed, each a GONE row; none added or changed.)
  • A check under tests/ that reads changed source is updated, not weakened.
  • MKWVK_API_VERSION bumped (MkwVkHost or MkwVkRenderer in gpu/vk/vk_api.h changed). (n/a, ticked so the check passes: vk_api.h is not touched.)
  • The SPIR-V headers regenerated (a shader changed). (n/a, ticked so the check passes: no shader changed.)
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (n/a, ticked so the check passes: no host code changed; renderer files only, built here with the builder's Linux flags.)
  • Screenshots of the same spot on main and here, for a change that shows on screen. (n/a, ticked so the check passes: nothing shows on screen; the six shots were read and match.)
  • Docs updated. (The switches table is the reference: the rows are GONE; mirror_budget.h and vk_memory.cpp comments say what was dropped.)
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). (RTX only so far; AMD in Still to test.)
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
## Summary The renderer's memory model (`gpu/vk/vk_memory.cpp` and its neighbours) still carries switches that were experiments: off by default, their question answered, never removed. [Standards](docs/dev/standards.md#switches) says to remove a switch once it is settled. This goes through every `attempt` switch whose code is in the memory model and removes the ones that can go today, and nothing else. It is the part of the memory model that can be removed now; the larger parts stay (below). **What goes, 49 lines deleted and 31 added over 6 files (about 16 of the deleted lines are code, the rest comments and test text):** | Commit | What | |---|---| | `docs(vk)` | `vk_memory.cpp`'s head said "no mirrored copies, no write-backs, no upload streams": it describes the model it has now. Comment only. | | `RX_VK_MIRROR_TIGHT` | Refused new mirrors while VRAM was over 90% full. Its finding is in #237: "The 90% rule for mirrors (`RX_VK_MIRROR_TIGHT=1`) costs 5 fps and still ends at 95%." Both reads and the `vram_usage` call behind them go. | | `RX_VK_CPU_OVER_GPU` | Took CPU writes over any GPU-written texture. Its finding is in `texture_touch`'s comment: it took over transient render targets' texels "and the menus' letters stayed missing with it". The check tests `only_cleared` alone, as at default. | | `RX_VK_BG_IMPORT` | Imported every pool the game makes on a background thread. Finding, beside the code: "the thread's page locking stalled the game's threads (3-7 fps)". `memory_pool_created` is an empty function now; `MkwVkRenderer::nvn_pool_created` stays, so no interface change. | Each removed switch becomes a `GONE(...)` row in `gpu/vk/switches.def` (the table is the switches reference; no other page lists them), and each test that read the removed text is updated, none weakened: `test_mirror_trim.py` expects `mirrors_trim`'s line without the clause; `test_drawn_page_map.py` loses the one case that ran the check for a texture that is not only cleared (the only-cleared case beside it stays). **Every `attempt` switch in the memory model, with what was decided** (open pull requests: all 401 listed, the heads of 399 merged with this branch and with `main` in a scratch repository, and their diffs searched for the names and functions; #1143 and #1092 could not be fetched): | Switch | Finding written down | Open pull request | Verdict | |---|---|---|---| | `RX_VK_MIRROR_TIGHT` | #237, numbers above | none | removed | | `RX_VK_CPU_OVER_GPU` | `texture_touch` comment | none | removed | | `RX_VK_BG_IMPORT` | `memory_pool_created` comment, 3-7 fps | none | removed | | `RX_VK_PREFETCH_CHUNKS` | "slowed the replay thread's own [imports] to 80-127 ms on AMD" | #966 (macOS port) adds a call to `prefetch_chunks` | held (I had removed it and put it back) | | `RX_VK_ASYNC_IMPORT` | "opt-in: background imports can slow AMD", no number | #2210 reads it | held | | `RX_VK_SSBO_STRETCH`, `RX_VK_SSBO_WIDE` | none | #2210 reads both | held | | `RX_VK_CAPTURE_NT` | mixed: #1841 no gain and more stutters on an RTX desktop, #1749 "cut its long frames on every run" on an AMD card | #2128, #2129 build on it | held | | `RX_VK_PROTECT_BARE` | "in a first Kokiri run it kept no page (0), so the hook or the trigger needs a closer look": the question is open | #2134 edits `mirror_sync`'s page walk | held | | `RX_VK_READBACK_EXACT`, `RX_VK_READBACK_NO_CATCHUP` | none (#2042 lists the second with the A/B switches whose removal is "for the maintainer to decide") | #2211, #2212 read both | held | | `RX_VK_UB_CUR_ONLY` | same #2042 list | #142, #796 (old) | kept | | `RX_VK_NO_WRITEBACK` | none; used as a diagnostic in #2325 | none | kept: the tool a write-back measurement needs | | `RX_VK_MIRROR_HEAT_EXTRA` | #1141: "measured on one card only": open | none | kept | | `RX_VK_CAP_BLOCKS` | none | #1599 touches its test | kept | | `RX_VK_FOLLOW_STORES` | n/a | #2040 | excluded: it is read inside the shader recompiler and its prefix is hashed into the translator stamp, so removing it would have every player prepare shaders again | `RX_VK_FRAME_GATE` and `RX_VK_SPARSE_IDLE` are render-thread and sparse-texture switches, not the guest-memory model; `HOS_COLLECT_VECTOR` and `HOS_COLLECT_WIDE` are kill switches kept for a test and a benchmark. Only `vk_memory.cpp`'s head comment described code that is gone; `gpu/render/rx_nvn.h`'s head ("replays them with WebGPU") is also stale but that shared header is full of the same notes and is left for its own change. **Why not more.** The census of the memory model (a removal ladder A to H) found that most of it cannot go on today's evidence, and measurements since agree: the captures stay (98.8% of mirror-synced pages come from earlier submits' captures, so they cannot be dropped); the game's flush and invalidate calls do nothing on the console, so they cannot replace the write marks; write-back on demand still sees the CPU touch a left-out range every couple of seconds (with a 4 KB limit the count of such ranges never stops growing), so it needs a copy at the first invalidate and is not a removal; the mirrors stay. This change is the one rung that is only deletion. It fits the switches track (#1309, #1390 and #1527 deleted 126 kill switches; attempts were left). This was written with AI agents under the owner's direction: they read the code, searched the forge, made the commits and ran every check below; the commits carry `Co-Authored-By` trailers. ## Testing **Tested:** Linux, RTX 4070 Ti (NVIDIA 595.99), a runtime of `main` @ 753fb5af6 and one of this branch @ afecf01b5, both made as packs over base 3e4b1faf6ec2 through the queue, default settings, `RX_VK_MEM_CHECK=1` on both sides, one game at a time, 90 s in each scene: Link's house, Kokiri Forest, Hyrule Field (`gamerun.py`, six runs, all reached the scene and stopped cleanly). - `logdiff.py` on each pair (problem and warn levels): no new warning or error kind (0 kinds on either side). All-levels it differs only in info lines whose numbers differ. - The memory checker, last summary of each run: `seq_mismatch 0`, `take_open 0`, `collect_open 0`, `sync_over_gpu ... 0 replaced` on all six runs (main and branch). - Screenshots read, same scene and picture on both sides (only Navi and the fireflies differ with the clock). - Mirror syncs, per run, the share of dirty pages read from earlier submits' captures: 98.2 / 97.1 / 97.4% on main against 96.7 / 97.9 / 97.1% here (Kokiri house, forest, field); from guest memory 0.02 / 0.9 / 1.3% against 0.04 / 0.5 / 1.4%. Pages per 600 submits 52.7k / 44.6k / 49.5k against 52.6k / 45.9k / 47.9k. Write-back diff per 600 submits 841 / 872 / 785 MB against 953 / 1097 / 774 MB, left out 4.8 / 4.3 / 4.9 GB against 4.9 / 4.5 / 4.7 GB. The runs are 90 s of play after a variable start-up, so they hold 33k to 43k submits each; counts move by about 10% between two runs of one side, which is the spread. - `vk: mirror syncs` line, final field: not touched (the `RX_VK_PROTECT_BARE` count stays). - Checks: `suite.py compare` (main 753fb5af against this head, no `--changed` shortcut): 928 passed, 3 failed, 26 skipped on both sides; the same three fail on both (`test_dev_packs.py`, `test_pipeline_state_computes.py`, `test_thinlto_tls.py`: this PC's tools), none fails only here; the skipped sets are the same. - Translator stamp (`nx2/translator_files.py`, as `build.py` computes it): `0b724caa31e870ae` on `main` and on the branch (252 files); no changed file is stamped, and none of the removed names begins with a prefix `translator_stamp` hashes (`RX_VK_MMA`, `NATIVE`, `NAN`, `TASK_CAP`, `NETWORK`, `GP_`, `FOLLOW`, `NO_F16`, `MESH`, `NO_INVARIANT`, `MARKERS`, `ALL_GLOBAL_PROGS`, `MISS_LOG`, `BLOCK_PROBE`, `EDEN_`), so no player prepares shaders again. - Machine code (`objcmp.py`, the builder's own flags, `main` against this head): `vk_menu.cpp` 853 of 853 functions identical, `vk_texture.cpp` 534 of 535, `vk_memory.cpp` 711 of 714. The four that differ, all simpler, each from removed code: `texture_touch` (2694 to 2672 instructions: the `take` static's guard), `mirror_make` (1809 to 1762: the `tight_rule` guard and the `vram_usage` call behind it), `mirrors_trim` (1062 to 1032: the same guard), `memory_pool_created` (98 instructions to a bare `ret`). No function appears or disappears. **Still to test:** - AMD (RADV) and Intel Arc, a short run in Kokiri Forest on each: expect the same picture and no new warning kind (the Test Farm: `@Beanstalk run Kokiri Forest for 60 s on an AMD card and an Intel Arc card, compare the log's warning kinds with main`). - Windows: expect the same; the changes are the same C++ on both platforms (by hand or the Test Farm). ## Measurements **Verdict:** frame time, 1% low and the memory work of a submit are the same within the runs' spread; the GPU time a frame reads 0.08 ms higher (see below). Setup: Linux, RTX 4070 Ti, NVIDIA 595.99; Kokiri Forest from the `kokiri-start` save, 60 s after arrival, the options pinned (preset 6, 2560x1440, V-Sync off, uncapped), `RX_VK_FRAME_TRACE=1`; timing mode of the queue, each of the four runs alone on the GPU (`qoverlap.py`: clean), two interleaved rounds main, branch, main, branch; frames of the last 55 s; "worst frames" from the whole run's frame log. Both runtimes made from the same base, same caches. | | Before: main @ 753fb5af6 | After: this PR @ afecf01b5 | |---|---|---| | fps (round 1 / round 2) | 137.2 / 137.3 | 137.5 / 137.2 | | median frame time | 7.28 ms | 7.27 ms | | p99 frame time (last 55 s) | 8.06 ms | 8.05 ms | | 1% low | 124.0 fps | 124.2 fps | | GPU time a frame | 6.10 ms | 6.18 ms (6.15 / 6.20) | | worst frame of the whole run (round 1 / round 2) | 275.7 / 217.6 ms | 415.6 / 166.0 ms | | frames over 33 ms of ~16,000 (round 1 / round 2) | 10 / 14 | 7 / 8 | | a submit's memory work, ms (maps / capture taken / writes collected) | 0.00 / 0.00 / 0.01 | 0.00 / 0.00 / 0.01 | The worst frames are the load's, and move more between two runs of one side (276 and 218 ms on main) than between the sides. GPU time a frame reads 0.08 ms (1.3%) higher here, both rounds of this branch above both rounds of main; I have no explanation from the code (what was removed does not run at default settings, and the frame time, which includes the GPU's, did not move), so two rounds do not settle it and it is the one number in the table that leans against this change. Log line, last of each run: `vk: a submit's memory work (ms): maps 0.00, capture taken 0.00, writes collected 0.01` on all four. ## Risks What could break: nothing at default settings by construction (all four removed paths were off), shown by the machine-code comparison above. A player who still sets one of the three removed names gets the `GONE` text in the log's switch report, and the same behaviour as before (they were off by default). Open pull requests that append their own `GONE` row at the end of `switches.def` (10 do) conflict with the three rows added here; they conflict with each other the same way, and none edits a removed line. A revert is enough to undo it. A player notices nothing; saves, `longshot_options.ini` and the caches are untouched. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named): `mise` is not on this PC; `suite.py compare` runs the same `run_all.py` on both sides: 928 passed, the same three fail on both (named above). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. (n/a, ticked so the check passes: this is not a fix.) - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. (Three switches removed, each a `GONE` row; none added or changed.) - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] `MKWVK_API_VERSION` bumped (`MkwVkHost` or `MkwVkRenderer` in `gpu/vk/vk_api.h` changed). (n/a, ticked so the check passes: `vk_api.h` is not touched.) - [x] The SPIR-V headers regenerated (a shader changed). (n/a, ticked so the check passes: no shader changed.) - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (n/a, ticked so the check passes: no host code changed; renderer files only, built here with the builder's Linux flags.) - [x] Screenshots of the same spot on `main` and here, for a change that shows on screen. (n/a, ticked so the check passes: nothing shows on screen; the six shots were read and match.) - [x] Docs updated. (The switches table is the reference: the rows are `GONE`; `mirror_budget.h` and `vk_memory.cpp` comments say what was dropped.) - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). (RTX only so far; AMD in Still to test.) - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold.
The head said "no mirrored copies, no write-backs, no upload streams": the file is now mirrors, captures, page
generations and write-backs. Comment only.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
An attempt switch, off by default. Its finding is in #237's description: "The 90% rule for mirrors (RX_VK_MIRROR_TIGHT=1)
costs 5 fps and still ends at 95%". Both reads (mirror_make, mirrors_trim) go, with the vram_usage call that only ran
behind it. The row becomes GONE; test_mirror_trim.py expects mirrors_trim's line without the clause.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
An attempt switch, off by default. The finding is written in texture_touch's comment: taken over any GPU-written texture,
"transient render targets share memory the CPU writes for other things, and took that over their texels, and the menus'
letters stayed missing with it". The check of a GPU-owned texture now tests only_cleared alone, as it did with the switch
off. test_drawn_page_map.py loses the one case that ran the check for a texture that is not only cleared (the only-cleared
case beside it stays); its docstring says so.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
refactor(vk): RX_VK_BG_IMPORT is gone, the eager background import of every pool
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
afecf01b53
An attempt switch, off by default. Its finding is written beside the code it guarded: "imported eagerly, every pool the game
made, most never used by the GPU, the thread's page locking stalled the game's threads (3-7 fps)". memory_pool_created,
which acted only behind it, is an empty function now (MkwVkRenderer::nvn_pool_created stays: no interface change).
The background thread and its list stay: RX_VK_ASYNC_IMPORT (read by open #2210) and RX_VK_PREFETCH_CHUNKS (open #966
calls prefetch_chunks) use them.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Author
Contributor

Tested in game: Linux, RTX 4070 Ti (NVIDIA 595.99.02): Link's house, Kokiri Forest and Hyrule Field, 90 s each on main and on this branch with RX_VK_MEM_CHECK=1: clean stops, no warning or error kinds on either side, the memory checker's counts all zero on both, shots look the same. Kokiri Forest timing, two interleaved rounds: 137.2 / 137.3 fps on main, 137.5 / 137.2 here.

Tested in game: Linux, RTX 4070 Ti (NVIDIA 595.99.02): Link's house, Kokiri Forest and Hyrule Field, 90 s each on main and on this branch with RX_VK_MEM_CHECK=1: clean stops, no warning or error kinds on either side, the memory checker's counts all zero on both, shots look the same. Kokiri Forest timing, two interleaved rounds: 137.2 / 137.3 fps on main, 137.5 / 137.2 here.
Contributor

Small correction: #1841 is the area title-card PR and never touched or measured RX_VK_CAPTURE_NT, so the "no gain and more stutters on an RTX desktop" result in that row must come from a different issue or PR.

Small correction: #1841 is the area title-card PR and never touched or measured RX_VK_CAPTURE_NT, so the "no gain and more stutters on an RTX desktop" result in that row must come from a different issue or PR.
TrashPanda force-pushed refactor/memory-model-dead-attempts from afecf01b53
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
to 5829ba5b9c
Some checks are pending
CI / Website build and checks (pull_request) Blocked by required conditions
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 6s
2026-11-23 15:10:06 +00:00
Compare
Some checks are pending
CI / Website build and checks (pull_request) Blocked by required conditions
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 6s
This pull request is marked as a work in progress.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'refactor/memory-model-dead-attempts:TrashPanda-refactor/memory-model-dead-attempts'
git switch 'TrashPanda-refactor/memory-model-dead-attempts'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 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!2315
No description provided.