Memory issue: Every area load decodes ~1 GB of ASTC again, revisits included: textures come back at new addresses and the address-keyed cache misses them #1069

Open
opened 2026-11-16 05:54:42 +00:00 by gooots · 2 comments

Longshot version

v3.0.0-rc.4 (source 53f96d7805)

Channel

Release candidate

What kind of problem

Low fps or stutter

What happened

Each area change has 200 to 700 ms frames, and going back to an area you just left is no smoother than the first visit.
Measured with a scripted teleport tour through the control bridge (longshot_ctl.py launch --profile test, a copied
save, headless), Kokiri Forest, Hyrule Field, Kakariko, Hyrule Field, Kokiri Forest, twice, 10 s between hops.

What the log shows:

  • Every load decodes 0.8 to 1.2 GB of ASTC (vk: textures: decoded ASTC before and after each teleport), the same on
    a revisit as on the first visit, including loads where nothing had been evicted (textures retired ... budget 0).
  • The number of textures held keeps growing over three areas: 2,383, 3,937, 5,662, 7,347, 8,394, 9,518, 10,893
    (vk: VRAM: ... N textures), so the same textures are being held more than once.
  • Once the budget is full, every load evicts 900 to 1,800 textures (textures retired ... budget N).
  • 0 programs were created in play (program census (play): created 0), so this is not shader compilation. The slow
    frames' own breakdowns (vk: slow submit) are in queue submit, dispatch, draw and descriptors.

Checked with RX_VK_LOG_UPLOADS around a Hyrule Field revisit (Kakariko to Hyrule Field, second visit, nothing
evicted for the budget on that load): every upload logged from the teleport on was (new) (a cache entry made at that
load), none a re-upload of an existing entry; over the whole 200-line window, 192 (new), 7 written, 1 whole.
The texture count went from 5,968 to 7,189 across that one revisit. So a revisit does not reuse or refresh the first
visit's entries: it makes new ones and the old ones stay.

Addresses checked with RX_VK_WATCH_DIM=683x683 over three Hyrule Field visits (with Kakariko between them, no
evictions in the whole run): each visit made a new set of 683x683 textures, 54, 46 and 43 of them, every one at a
new address. Not one address is shared between any two visits. The sets have the same fingerprints each time (NVN
format, levels, layout, class and guest size: e.g. 26, 23 and 22 of 0x8c/0x30005/278016 B; 15, 14 and 13 of
0x8b/0x30004/308224 B), and the earlier visits' copies were still alive when the later ones were made.

Cause: in gpu/vk/vk_texture.cpp, struct Key (around line 207) identifies a texture by its guest GPU address plus
target, size, levels, samples, layout and class, with no content hash. The game's reload puts the area's textures at
new addresses, so every revisit misses the cache, decodes and uploads them again, and the old copies stay until the
budget evicts them. (The texels themselves were not compared; the identical fingerprint sets per visit are the
evidence that they are the same textures.) On an AMD card (no ASTC sampling) that is about 1 GB of decode and BC3
re-encode per load.

Idea: a content hash (or a hash of the first block and the size) as a second lookup for decoded ASTC, or a disk cache of
the BC3 re-encodes, so a revisit reuses the decode.

Numbers from five runs (same route, 13 GB budget):

Run Textures evicted Frames over 40 ms Worst frame after a load (mean)
Defaults (finer ASTC as RGBA8) 7,836 147 433 ms
RX_VK_ASTC_BC_ALL=1 3,059 149 340 ms
RX_VK_ASTC_BC_ALL=1, repeated 3,146 146 361 ms
+ RX_VK_UPLOAD_BUDGET_MS=16 4,876 142 362 ms
+ RX_VK_PREFETCH_CHUNKS=2 3,012 134 353 ms

RX_VK_ASTC_BC_ALL=1 helps on a 24 GB card too (61% fewer evictions, worst frames down by about a fifth), but it only
slows the growth; the re-decode on every load stays.

Related: #388 (memory grows with every area change), #939 (6 GB card over the allowance after a few area changes),
#1040 (APU budget thrashing, 100-450 ms re-decode stalls).

Where in the game

Any area change; measured between Kokiri Forest, Hyrule Field and Kakariko (child).

How often

Every time

Graphics card and driver version

AMD Radeon RX 7900 XTX (24 GB), AMD Software 26.10.1

CPU, RAM and operating system

Ryzen 7 5800X3D, 32 GB, Windows 11

Changes from the defaults

For the measurements: RX_VK_VRAM_MB=13312, and RX_VK_ASTC_BC_ALL=1 where the table
says so. The build also has a co-op mod's patches applied (OoT Co-op v0.11.2, Longshot module); the tour ran solo, with
no session.

longshot_log.txt

Every area load decodes ~1 GB of ASTC again, revisits included: textures come back at new addresses and the address-keyed cache misses them

Longshot version: v3.0.0-rc.4 (source 53f96d7805), release candidate
Problem: low fps / stutter, every time, on any area change (measured between Kokiri Forest, Hyrule Field and Kakariko, child)
GPU: AMD Radeon RX 7900 XTX (24 GB), AMD Software 26.10.1
System: Ryzen 7 5800X3D, 32 GB, Windows 11
Changes from defaults: for the measurements RX_VK_VRAM_MB=13312, and RX_VK_ASTC_BC_ALL=1 where the table says so. The build also has a co-op mod's patches applied (OoT Co-op v0.11.2, Longshot module); the tour ran solo, with no session.

Each area change has 200 to 700 ms frames, and going back to an area you just left is no smoother than the first visit. Measured with a scripted teleport tour through the control bridge (longshot_ctl.py launch --profile test, a copied save, headless), Kokiri Forest, Hyrule Field, Kakariko, Hyrule Field, Kokiri Forest, twice, 10 s between hops.

What the log shows:

  • Every load decodes 0.8 to 1.2 GB of ASTC (vk: textures: decoded ASTC before and after each teleport), the same on a revisit as on the first visit, including loads where nothing had been evicted (textures retired ... budget 0).
  • The number of textures held keeps growing over three areas: 2,383, 3,937, 5,662, 7,347, 8,394, 9,518, 10,893 (vk: VRAM: ... N textures), so the same textures are being held more than once.
  • Once the budget is full, every load evicts 900 to 1,800 textures (textures retired ... budget N).
  • 0 programs were created in play (program census (play): created 0), so this is not shader compilation. The slow frames' own breakdowns (vk: slow submit) are in queue submit, dispatch, draw and descriptors.

Checked with RX_VK_LOG_UPLOADS around a Hyrule Field revisit (Kakariko to Hyrule Field, second visit, nothing evicted for the budget on that load): every upload logged from the teleport on was (new) (a cache entry made at that load), none a re-upload of an existing entry; over the whole 200-line window, 192 (new), 7 written, 1 whole. The texture count went from 5,968 to 7,189 across that one revisit. So a revisit does not reuse or refresh the first visit's entries: it makes new ones and the old ones stay.

Addresses checked with RX_VK_WATCH_DIM=683x683 over three Hyrule Field visits (with Kakariko between them, no evictions in the whole run): each visit made a new set of 683x683 textures, 54, 46 and 43 of them, every one at a new address. Not one address is shared between any two visits. The sets have the same fingerprints each time (NVN format, levels, layout, class and guest size: e.g. 26, 23 and 22 of 0x8c/0x30005/278016 B; 15, 14 and 13 of 0x8b/0x30004/308224 B), and the earlier visits' copies were still alive when the later ones were made.

Cause: in gpu/vk/vk_texture.cpp, struct Key (around line 207) identifies a texture by its guest GPU address plus target, size, levels, samples, layout and class, with no content hash. The game's reload puts the area's textures at new addresses, so every revisit misses the cache, decodes and uploads them again, and the old copies stay until the budget evicts them. (The texels themselves were not compared; the identical fingerprint sets per visit are the evidence that they are the same textures.) On an AMD card (no ASTC sampling) that is about 1 GB of decode and BC3 re-encode per load.

Idea: a content hash (or a hash of the first block and the size) as a second lookup for decoded ASTC, or a disk cache of the BC3 re-encodes, so a revisit reuses the decode.

Numbers from five runs (same route, 13 GB budget):

Run Textures evicted Frames over 40 ms Worst frame after a load (mean)
Defaults (finer ASTC as RGBA8) 7,836 147 433 ms
RX_VK_ASTC_BC_ALL=1 3,059 149 340 ms
RX_VK_ASTC_BC_ALL=1, repeated 3,146 146 361 ms
+ RX_VK_UPLOAD_BUDGET_MS=16 4,876 142 362 ms
+ RX_VK_PREFETCH_CHUNKS=2 3,012 134 353 ms

RX_VK_ASTC_BC_ALL=1 helps on a 24 GB card too (61% fewer evictions, worst frames down by about a fifth), but it only slows the growth; the re-decode on every load stays.

Related: #388 (memory grows with every area change), #939 (6 GB card over the allowance after a few area changes), #1040 (APU budget thrashing, 100-450 ms re-decode stalls).

Screenshots or video

No response

Before you send it

  • The problem is still there on the newest release or nightly.
  • I searched the open issues for it.
  • I'm not attaching game files, keys, the game's executable, its .bin caches or saves.
### Longshot version v3.0.0-rc.4 (source 53f96d780588) ### Channel Release candidate ### What kind of problem Low fps or stutter ### What happened Each area change has 200 to 700 ms frames, and going back to an area you just left is no smoother than the first visit. Measured with a scripted teleport tour through the control bridge (`longshot_ctl.py launch --profile test`, a copied save, headless), Kokiri Forest, Hyrule Field, Kakariko, Hyrule Field, Kokiri Forest, twice, 10 s between hops. What the log shows: - Every load decodes 0.8 to 1.2 GB of ASTC (`vk: textures: decoded ASTC` before and after each teleport), the same on a revisit as on the first visit, including loads where nothing had been evicted (`textures retired ... budget 0`). - The number of textures held keeps growing over three areas: 2,383, 3,937, 5,662, 7,347, 8,394, 9,518, 10,893 (`vk: VRAM: ... N textures`), so the same textures are being held more than once. - Once the budget is full, every load evicts 900 to 1,800 textures (`textures retired ... budget N`). - 0 programs were created in play (`program census (play): created 0`), so this is not shader compilation. The slow frames' own breakdowns (`vk: slow submit`) are in queue submit, dispatch, draw and descriptors. Checked with `RX_VK_LOG_UPLOADS` around a Hyrule Field revisit (Kakariko to Hyrule Field, second visit, nothing evicted for the budget on that load): every upload logged from the teleport on was `(new)` (a cache entry made at that load), none a re-upload of an existing entry; over the whole 200-line window, 192 `(new)`, 7 `written`, 1 `whole`. The texture count went from 5,968 to 7,189 across that one revisit. So a revisit does not reuse or refresh the first visit's entries: it makes new ones and the old ones stay. Addresses checked with `RX_VK_WATCH_DIM=683x683` over three Hyrule Field visits (with Kakariko between them, no evictions in the whole run): each visit made a new set of 683x683 textures, 54, 46 and 43 of them, every one at a new address. Not one address is shared between any two visits. The sets have the same fingerprints each time (NVN format, levels, layout, class and guest size: e.g. 26, 23 and 22 of `0x8c`/`0x30005`/278016 B; 15, 14 and 13 of `0x8b`/`0x30004`/308224 B), and the earlier visits' copies were still alive when the later ones were made. Cause: in `gpu/vk/vk_texture.cpp`, `struct Key` (around line 207) identifies a texture by its guest GPU address plus target, size, levels, samples, layout and class, with no content hash. The game's reload puts the area's textures at new addresses, so every revisit misses the cache, decodes and uploads them again, and the old copies stay until the budget evicts them. (The texels themselves were not compared; the identical fingerprint sets per visit are the evidence that they are the same textures.) On an AMD card (no ASTC sampling) that is about 1 GB of decode and BC3 re-encode per load. Idea: a content hash (or a hash of the first block and the size) as a second lookup for decoded ASTC, or a disk cache of the BC3 re-encodes, so a revisit reuses the decode. Numbers from five runs (same route, 13 GB budget): | Run | Textures evicted | Frames over 40 ms | Worst frame after a load (mean) | |---|---|---|---| | Defaults (finer ASTC as RGBA8) | 7,836 | 147 | 433 ms | | `RX_VK_ASTC_BC_ALL=1` | 3,059 | 149 | 340 ms | | `RX_VK_ASTC_BC_ALL=1`, repeated | 3,146 | 146 | 361 ms | | + `RX_VK_UPLOAD_BUDGET_MS=16` | 4,876 | 142 | 362 ms | | + `RX_VK_PREFETCH_CHUNKS=2` | 3,012 | 134 | 353 ms | `RX_VK_ASTC_BC_ALL=1` helps on a 24 GB card too (61% fewer evictions, worst frames down by about a fifth), but it only slows the growth; the re-decode on every load stays. Related: #388 (memory grows with every area change), #939 (6 GB card over the allowance after a few area changes), #1040 (APU budget thrashing, 100-450 ms re-decode stalls). ### Where in the game Any area change; measured between Kokiri Forest, Hyrule Field and Kakariko (child). ### How often Every time ### Graphics card and driver version AMD Radeon RX 7900 XTX (24 GB), AMD Software 26.10.1 ### CPU, RAM and operating system Ryzen 7 5800X3D, 32 GB, Windows 11 ### Changes from the defaults For the measurements: `RX_VK_VRAM_MB=13312`, and `RX_VK_ASTC_BC_ALL=1` where the table says so. The build also has a co-op mod's patches applied (OoT Co-op v0.11.2, Longshot module); the tour ran solo, with no session. ### longshot_log.txt Every area load decodes ~1 GB of ASTC again, revisits included: textures come back at new addresses and the address-keyed cache misses them Longshot version: v3.0.0-rc.4 (source 53f96d780588), release candidate Problem: low fps / stutter, every time, on any area change (measured between Kokiri Forest, Hyrule Field and Kakariko, child) GPU: AMD Radeon RX 7900 XTX (24 GB), AMD Software 26.10.1 System: Ryzen 7 5800X3D, 32 GB, Windows 11 Changes from defaults: for the measurements RX_VK_VRAM_MB=13312, and RX_VK_ASTC_BC_ALL=1 where the table says so. The build also has a co-op mod's patches applied (OoT Co-op v0.11.2, Longshot module); the tour ran solo, with no session. Each area change has 200 to 700 ms frames, and going back to an area you just left is no smoother than the first visit. Measured with a scripted teleport tour through the control bridge (`longshot_ctl.py launch --profile test`, a copied save, headless), Kokiri Forest, Hyrule Field, Kakariko, Hyrule Field, Kokiri Forest, twice, 10 s between hops. What the log shows: - Every load decodes 0.8 to 1.2 GB of ASTC (`vk: textures: decoded ASTC` before and after each teleport), the same on a revisit as on the first visit, including loads where nothing had been evicted (`textures retired ... budget 0`). - The number of textures held keeps growing over three areas: 2,383, 3,937, 5,662, 7,347, 8,394, 9,518, 10,893 (`vk: VRAM: ... N textures`), so the same textures are being held more than once. - Once the budget is full, every load evicts 900 to 1,800 textures (`textures retired ... budget N`). - 0 programs were created in play (`program census (play): created 0`), so this is not shader compilation. The slow frames' own breakdowns (`vk: slow submit`) are in queue submit, dispatch, draw and descriptors. Checked with `RX_VK_LOG_UPLOADS` around a Hyrule Field revisit (Kakariko to Hyrule Field, second visit, nothing evicted for the budget on that load): every upload logged from the teleport on was `(new)` (a cache entry made at that load), none a re-upload of an existing entry; over the whole 200-line window, 192 `(new)`, 7 `written`, 1 `whole`. The texture count went from 5,968 to 7,189 across that one revisit. So a revisit does not reuse or refresh the first visit's entries: it makes new ones and the old ones stay. Addresses checked with `RX_VK_WATCH_DIM=683x683` over three Hyrule Field visits (with Kakariko between them, no evictions in the whole run): each visit made a new set of 683x683 textures, 54, 46 and 43 of them, every one at a new address. Not one address is shared between any two visits. The sets have the same fingerprints each time (NVN format, levels, layout, class and guest size: e.g. 26, 23 and 22 of `0x8c`/`0x30005`/278016 B; 15, 14 and 13 of `0x8b`/`0x30004`/308224 B), and the earlier visits' copies were still alive when the later ones were made. Cause: in `gpu/vk/vk_texture.cpp`, `struct Key` (around line 207) identifies a texture by its guest GPU address plus target, size, levels, samples, layout and class, with no content hash. The game's reload puts the area's textures at new addresses, so every revisit misses the cache, decodes and uploads them again, and the old copies stay until the budget evicts them. (The texels themselves were not compared; the identical fingerprint sets per visit are the evidence that they are the same textures.) On an AMD card (no ASTC sampling) that is about 1 GB of decode and BC3 re-encode per load. Idea: a content hash (or a hash of the first block and the size) as a second lookup for decoded ASTC, or a disk cache of the BC3 re-encodes, so a revisit reuses the decode. Numbers from five runs (same route, 13 GB budget): | Run | Textures evicted | Frames over 40 ms | Worst frame after a load (mean) | |---|---|---|---| | Defaults (finer ASTC as RGBA8) | 7,836 | 147 | 433 ms | | `RX_VK_ASTC_BC_ALL=1` | 3,059 | 149 | 340 ms | | `RX_VK_ASTC_BC_ALL=1`, repeated | 3,146 | 146 | 361 ms | | + `RX_VK_UPLOAD_BUDGET_MS=16` | 4,876 | 142 | 362 ms | | + `RX_VK_PREFETCH_CHUNKS=2` | 3,012 | 134 | 353 ms | `RX_VK_ASTC_BC_ALL=1` helps on a 24 GB card too (61% fewer evictions, worst frames down by about a fifth), but it only slows the growth; the re-decode on every load stays. Related: #388 (memory grows with every area change), #939 (6 GB card over the allowance after a few area changes), #1040 (APU budget thrashing, 100-450 ms re-decode stalls). ### Screenshots or video _No response_ ### Before you send it - [x] The problem is still there on the newest release or nightly. - [x] I searched the open issues for it. - [x] I'm not attaching game files, keys, the game's executable, its .bin caches or saves.
Collaborator

Possibly related, for context:

  • #1040 AMD Radeon 860M (APU): Kokiri Forest VK_ERROR_DEVICE_LOST without RX_VK_ASTC_CPU=1 & 4096 MB budget thrashing with it — Related ASTC decode/upload stalls and texture-budget pressure on AMD.
  • #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) — Related texture/VRAM growth and performance loss across area changes, though different GPU and mechanism.
Possibly related, for context: - #1040 AMD Radeon 860M (APU): Kokiri Forest VK_ERROR_DEVICE_LOST without RX_VK_ASTC_CPU=1 & 4096 MB budget thrashing with it — Related ASTC decode/upload stalls and texture-budget pressure on AMD. - #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) — Related texture/VRAM growth and performance loss across area changes, though different GPU and mechanism.
gooots changed title from Game: OOTR to Game: OOT remake 2026-11-16 05:56:18 +00:00
gooots changed title from Game: OOT remake to Memory issue: Every area load decodes ~1 GB of ASTC again, revisits included: textures come back at new addresses and the address-keyed cache misses them 2026-11-16 07:43:21 +00:00
Contributor

Measurements from a Steam Deck OLED (RADV, 16 GB shared with the system, RX_VK_VRAM_MB=2400) that show a second cause for the same symptom, in case it helps whoever picks this up.

Route. A copied save in Kokiri Forest, then four teleports through the control bridge: Hyrule Field, Kokiri Forest, Hyrule Field, Kokiri Forest, about 145 s in each. Build: main c167ec67 with local changes on top, and for one tour a counter on nvn_texture_created / nvn_texture_released and on each cache entry's first upload, so read the numbers as one machine's.

What the counters say on a return (two areas only):

  • The game does not make the area's textures again. It made 98, 148 and 94 block-compressed textures on the three returns (573 on the first visit to Hyrule Field) and released 110 to 140 at each change.
  • Every first upload a draw asked for on a return (623, 824 and 627 new cache entries) was of a texture at an address the game had announced more than 90 s before and had not released: the same address, still the game's.
  • What had removed their images is the budget: textures retired ... budget N at each area change read 921, 639, 595 + 316 and 783, with the cache at 1.9 to 2.1 GB of its 2,400 MB (Kokiri Forest is about 1.95 GB of images here, Hyrule Field about 1.3 GB).

Effect, frames over 150 ms after each return:

Texture budget Kokiri Hyrule Field Kokiri again Uploads at draws on a return
2,400 MB (three tours) 1.05 to 1.24 s 1.42 to 1.95 s 0.92 to 1.25 s 740 to 1,040
4,000 MB (one tour) 0.22 s 0.64 s 0.23 s 193 to 347

The first visit to Hyrule Field is the same either way (1.5 to 2.0 s). At 4,000 MB the cache held 2.8 to 3.2 GB and still retired 572 textures for the budget over the tour: the two areas only just fit.

So there are two cases. With a budget smaller than two areas, a return decodes again because the renderer let go of the area just left while the game still holds its textures at the same addresses: a content hash would find nothing to reuse there, the images are gone. The case described above (the same textures back at new addresses, the old copies still alive) did not show on this two-area route; your route has a third area between the visits, which may be what makes the game free the first one's. I did not look at which textures the 100 to 150 made on each return are.

Possibly related for the small-budget case: #521 (opaque ASTC kept as BC1) would let more of two areas fit in the same budget; not tried here.

Measurements from a Steam Deck OLED (RADV, 16 GB shared with the system, `RX_VK_VRAM_MB=2400`) that show a second cause for the same symptom, in case it helps whoever picks this up. **Route.** A copied save in Kokiri Forest, then four teleports through the control bridge: Hyrule Field, Kokiri Forest, Hyrule Field, Kokiri Forest, about 145 s in each. Build: main c167ec67 with local changes on top, and for one tour a counter on `nvn_texture_created` / `nvn_texture_released` and on each cache entry's first upload, so read the numbers as one machine's. **What the counters say on a return (two areas only):** - The game does not make the area's textures again. It made 98, 148 and 94 block-compressed textures on the three returns (573 on the first visit to Hyrule Field) and released 110 to 140 at each change. - Every first upload a draw asked for on a return (623, 824 and 627 new cache entries) was of a texture at an address the game had announced more than 90 s before and had not released: the same address, still the game's. - What had removed their images is the budget: `textures retired ... budget N` at each area change read 921, 639, 595 + 316 and 783, with the cache at 1.9 to 2.1 GB of its 2,400 MB (Kokiri Forest is about 1.95 GB of images here, Hyrule Field about 1.3 GB). **Effect, frames over 150 ms after each return:** | Texture budget | Kokiri | Hyrule Field | Kokiri again | Uploads at draws on a return | |---|---|---|---|---| | 2,400 MB (three tours) | 1.05 to 1.24 s | 1.42 to 1.95 s | 0.92 to 1.25 s | 740 to 1,040 | | 4,000 MB (one tour) | 0.22 s | 0.64 s | 0.23 s | 193 to 347 | The first visit to Hyrule Field is the same either way (1.5 to 2.0 s). At 4,000 MB the cache held 2.8 to 3.2 GB and still retired 572 textures for the budget over the tour: the two areas only just fit. **So there are two cases.** With a budget smaller than two areas, a return decodes again because the renderer let go of the area just left while the game still holds its textures at the same addresses: a content hash would find nothing to reuse there, the images are gone. The case described above (the same textures back at new addresses, the old copies still alive) did not show on this two-area route; your route has a third area between the visits, which may be what makes the game free the first one's. I did not look at which textures the 100 to 150 made on each return are. Possibly related for the small-budget case: #521 (opaque ASTC kept as BC1) would let more of two areas fit in the same budget; not tried here.
Sign in to join this conversation.
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#1069
No description provided.