AGC: one draw resolves a 21,489-entry image table into 14.6 GiB of textures and runs the device out of memory #6890

Open
opened 2026-10-16 16:45:28 +00:00 by fma-rc · 10 comments
fma-rc commented 2026-10-16 16:45:28 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-16T16:45:28Z.


One draw's bindless image table is resolved into 21,489 sampled textures (14.6 GiB), and the device runs out of memory while that draw's resources are still being built.

Setup: Linux, RTX 5080 (NVIDIA 615.78.08), 16 GiB. Death Stranding 2 (PPSA02015) on its loading screen. The title does not get this far on main alone: the run is main 5d9dcc42d plus open PRs 6437, 6297, 6277, 6196, 6530, 6300, 6727, 6492, 6174, 6794 and local changes for EQAA targets. resolveImageTables on current main 66e290f1c makes a texture for every element of the table the same way.

A counter at the end of the draw's image phase (APS5_PROFILE_DRAW=1), one run each:

Run Set Textures in the set Held by that set only Texture cache at that moment Stop
A one BDA draw 21,489 (21,450 from image tables) 21,301, 14,603 MiB 99 entries, 5 MiB device OOM at 483 s
B one BDA draw 22,531, images phase 119 s not counted 6,020 entries, 6,579 MiB device OOM at 636 s

Smaller draws in the same runs bind about 1,600 table textures each (about 460 MiB), all of them also in the texture cache.

While the big set is built, the sampled cache evicts entries that set still holds (21,338 of its textures were marked released), so evictions free nothing, and the recorder's kept-bytes budget counts only CopiedBytes(), not textures. The out-of-memory release from #6174 does not help either, since the cache is locked by the build. The stop:

[videoout] presentation failed: AGC graphics: vkAllocateMemory device buffer: allocation=33554432 memoryType=1 reclaimed=0 released=0 initialResult=-2 attempts=1: Vulkan result -2

#6481 checks each entry against the device's limits; nothing bounds what one table may hold in total. Is resolving only the elements a draw can reach, or a byte limit per table that throws, the direction you want here?

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5887860870 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6890). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-16T16:45:28Z. --- One draw's bindless image table is resolved into 21,489 sampled textures (14.6 GiB), and the device runs out of memory while that draw's resources are still being built. Setup: Linux, RTX 5080 (NVIDIA 615.78.08), 16 GiB. Death Stranding 2 (PPSA02015) on its loading screen. The title does not get this far on `main` alone: the run is `main` 5d9dcc42d plus open PRs 6437, 6297, 6277, 6196, 6530, 6300, 6727, 6492, 6174, 6794 and local changes for EQAA targets. `resolveImageTables` on current `main` 66e290f1c makes a texture for every element of the table the same way. A counter at the end of the draw's image phase (`APS5_PROFILE_DRAW=1`), one run each: | Run | Set | Textures in the set | Held by that set only | Texture cache at that moment | Stop | |---|---|---|---|---|---| | A | one BDA draw | 21,489 (21,450 from image tables) | 21,301, 14,603 MiB | 99 entries, 5 MiB | device OOM at 483 s | | B | one BDA draw | 22,531, images phase 119 s | not counted | 6,020 entries, 6,579 MiB | device OOM at 636 s | Smaller draws in the same runs bind about 1,600 table textures each (about 460 MiB), all of them also in the texture cache. While the big set is built, the sampled cache evicts entries that set still holds (21,338 of its textures were marked released), so evictions free nothing, and the recorder's kept-bytes budget counts only `CopiedBytes()`, not textures. The out-of-memory release from #6174 does not help either, since the cache is locked by the build. The stop: ``` [videoout] presentation failed: AGC graphics: vkAllocateMemory device buffer: allocation=33554432 memoryType=1 reclaimed=0 released=0 initialResult=-2 attempts=1: Vulkan result -2 ``` #6481 checks each entry against the device's limits; nothing bounds what one table may hold in total. Is resolving only the elements a draw can reach, or a byte limit per table that throws, the direction you want here?
MarcZX10 commented 2026-10-16 18:24:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T18:24:23Z.


I traced the current resolveImageTables() path. It iterates every binding.count entry and resolves each texture before dispatch; I do not see an existing per-draw set of the descriptor indices the shader will actually sample. imageTableReadRanges is guest-memory address ranges used later by finishImageTables() for write-overlap/fault handling, not a list of sampled image indices, so it cannot directly prune this loop. That makes a per-table resource budget with explicit failure the immediately supportable guard; resolving only reachable entries would need new index-usage tracking through recompiler/runtime execution. This is a source-path observation, not a recommendation to silently skip entries.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6222033301 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6890#issuecomment-6222033301). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T18:24:23Z. --- I traced the current `resolveImageTables()` path. It iterates every `binding.count` entry and resolves each texture before dispatch; I do not see an existing per-draw set of the descriptor indices the shader will actually sample. `imageTableReadRanges` is guest-memory address ranges used later by `finishImageTables()` for write-overlap/fault handling, not a list of sampled image indices, so it cannot directly prune this loop. That makes a per-table resource budget with explicit failure the immediately supportable guard; resolving only reachable entries would need new index-usage tracking through recompiler/runtime execution. This is a source-path observation, not a recommendation to silently skip entries.
MarcZX10 commented 2026-10-16 20:55:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T20:55:56Z.


One integration point from a current-main check: #6481 is still open and modifies ShaderResources::resolveImageTables() to validate individual image-table entries. That is distinct from the aggregate resource growth in this report, but any table-wide budget would touch the same resolver and should be composed with #6481 rather than duplicating its per-entry checks. The existing cache policy uses a 2 GiB floor / one-quarter of the largest device-local heap as a cache budget; I have not treated that as an approved per-draw limit, since applying it to a live table could reject valid workloads.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6224533582 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6890#issuecomment-6224533582). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T20:55:56Z. --- One integration point from a current-main check: #6481 is still open and modifies `ShaderResources::resolveImageTables()` to validate individual image-table entries. That is distinct from the aggregate resource growth in this report, but any table-wide budget would touch the same resolver and should be composed with #6481 rather than duplicating its per-entry checks. The existing cache policy uses a 2 GiB floor / one-quarter of the largest device-local heap as a cache budget; I have not treated that as an approved per-draw limit, since applying it to a live table could reject valid workloads.
MarcZX10 commented 2026-10-17 02:51:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T02:51:10Z.


I checked the resolver and the existing #6481 work. There is no list of descriptor indices the shader may sample, so pruning to reachable entries would need new recompiler/runtime tracking. A table-wide cap is a distinct option, but I don't see an existing threshold or defined failure behavior: for example, whether to reject the draw or make entries fault only if selected, and whether the limit is fixed or derived from available device memory. Choosing those semantics arbitrarily could reject valid workloads. If a maintainer has a preferred limit and failure contract, I can evaluate a focused follow-up against it; otherwise I don't think an aggregate cap is ready to submit.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6228710580 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6890#issuecomment-6228710580). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T02:51:10Z. --- I checked the resolver and the existing #6481 work. There is no list of descriptor indices the shader may sample, so pruning to reachable entries would need new recompiler/runtime tracking. A table-wide cap is a distinct option, but I don't see an existing threshold or defined failure behavior: for example, whether to reject the draw or make entries fault only if selected, and whether the limit is fixed or derived from available device memory. Choosing those semantics arbitrarily could reject valid workloads. If a maintainer has a preferred limit and failure contract, I can evaluate a focused follow-up against it; otherwise I don't think an aggregate cap is ready to submit.
fma-rc commented 2026-10-17 19:11:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-17T19:11:18Z.


I measured how the entries of that table overlap in guest memory, on the same stack as the report (two runs, one big table each, logged before any texture is made):

run 1 run 2
entries 12,115 12,319
sum of their guest sizes 11,121 MiB 11,198 MiB
union of their ranges 3,004 MiB 3,082 MiB
committed in the union all all
entries inside another entry's range 5,665 5,705
host bytes of the textures built 8,193 MiB 8,066 MiB

Almost every entry has its own base (12,285 distinct bases of 12,319), and only 18 bases hold more than one entry. So the overlap is not the same surface viewed in several formats. It is different resources over shared memory, many of them 3840x2160 single-mip targets of 32 MiB, with each guest byte covered about 3.6 times. One host copy per entry is what turns 3 GiB of guest memory into more than the device holds. Sharing images by view would cover only the 18 shared bases.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6239285021 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6890#issuecomment-6239285021). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-17T19:11:18Z. --- I measured how the entries of that table overlap in guest memory, on the same stack as the report (two runs, one big table each, logged before any texture is made): | | run 1 | run 2 | |---|---|---| | entries | 12,115 | 12,319 | | sum of their guest sizes | 11,121 MiB | 11,198 MiB | | union of their ranges | 3,004 MiB | 3,082 MiB | | committed in the union | all | all | | entries inside another entry's range | 5,665 | 5,705 | | host bytes of the textures built | 8,193 MiB | 8,066 MiB | Almost every entry has its own base (12,285 distinct bases of 12,319), and only 18 bases hold more than one entry. So the overlap is not the same surface viewed in several formats. It is different resources over shared memory, many of them 3840x2160 single-mip targets of 32 MiB, with each guest byte covered about 3.6 times. One host copy per entry is what turns 3 GiB of guest memory into more than the device holds. Sharing images by view would cover only the 18 shared bases.
MarcZX10 commented 2026-10-17 20:21:00 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T20:21:00Z.


Thanks for measuring the range overlap. The 12,285 distinct bases and roughly 3.6x coverage confirm that ordinary same-base view reuse would address only a small part of this growth; the dominant cost is separate textures over overlapping guest bytes. I still do not see a defined per-table budget or guest-visible failure contract, so I am not proposing an arbitrary cap. The measurements narrow the likely fix space and are useful evidence for deciding whether the resolver should share overlapping backing or reject/limit a table.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6240405663 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6890#issuecomment-6240405663). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T20:21:00Z. --- Thanks for measuring the range overlap. The 12,285 distinct bases and roughly 3.6x coverage confirm that ordinary same-base view reuse would address only a small part of this growth; the dominant cost is separate textures over overlapping guest bytes. I still do not see a defined per-table budget or guest-visible failure contract, so I am not proposing an arbitrary cap. The measurements narrow the likely fix space and are useful evidence for deciding whether the resolver should share overlapping backing or reject/limit a table.
fma-rc commented 2026-10-17 20:23:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-17T20:23:29Z.


I agree a cap is the wrong contract, and sharing backing doesn't cover it either. With every element that lies inside another element's range rejected, DS2 still samples them (42 sampled faults in one run), and different formats over the same bytes need different decoded data.

What I'm working on instead is sampling table elements in the shader straight from guest memory, so an element gets no host image at all and the footprint stays at the 3.0 GiB already mapped. Anything not implemented throws through the existing fault path.

A standalone kernel for RGBA8 UNORM 2D (linear and SW_64KB_S, point and bilinear, clamp and wrap) matches a Radeon 610M bit for bit: 0 mismatches in 98,304 values on each of an RTX 5080, RADV and lavapipe. The filter rules were measured on that gfx1036 part, so gfx1013 matching is an assumption. BC7 with mips and trilinear come next, since those are the entries DS2 samples.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6240451250 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6890#issuecomment-6240451250). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-17T20:23:29Z. --- I agree a cap is the wrong contract, and sharing backing doesn't cover it either. With every element that lies inside another element's range rejected, DS2 still samples them (42 sampled faults in one run), and different formats over the same bytes need different decoded data. What I'm working on instead is sampling table elements in the shader straight from guest memory, so an element gets no host image at all and the footprint stays at the 3.0 GiB already mapped. Anything not implemented throws through the existing fault path. A standalone kernel for RGBA8 UNORM 2D (linear and SW_64KB_S, point and bilinear, clamp and wrap) matches a Radeon 610M bit for bit: 0 mismatches in 98,304 values on each of an RTX 5080, RADV and lavapipe. The filter rules were measured on that gfx1036 part, so gfx1013 matching is an assumption. BC7 with mips and trilinear come next, since those are the entries DS2 samples.
MarcZX10 commented 2026-10-17 21:08:00 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T21:08:00Z.


Thanks for checking both rejected-entry filtering and same-backing reuse against the title workload. The new RGBA8 kernel results are useful for the sampled values/layouts you measured, while the reported DS2 demand for BC7, mips and multiple formats remains outside that validation. Since you are actively developing the guest-memory sampling path, I won’t start a parallel implementation; this looks like a substantive feature that should be reviewed as one coherent path when ready.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6241104582 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6890#issuecomment-6241104582). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T21:08:00Z. --- Thanks for checking both rejected-entry filtering and same-backing reuse against the title workload. The new RGBA8 kernel results are useful for the sampled values/layouts you measured, while the reported DS2 demand for BC7, mips and multiple formats remains outside that validation. Since you are actively developing the guest-memory sampling path, I won’t start a parallel implementation; this looks like a substantive feature that should be reviewed as one coherent path when ready.
mrfelek commented 2026-10-20 16:07:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-20T16:07:56Z.


Same stop on a 12 GB card, with a split of where the image phase goes

Setup: Linux, Ryzen 9 5950X, RTX 3080 Ti 12 GB (NVIDIA 615.71.09). Death Stranding 2 (PPSA02015) 01.015.000, no input, default settings.
Build: main b50976750 + #5426, #7978, #8015, #8115 (with #7985), a 3D gather fix (fix/volume-gather-lz on my fork) and local, env-gated changes to get past EQAA and aliased multisample depth stops. Not a clean-main result.

Two runs (497 s and 200 s), one big table draw each time:

Textures in the draw's set 24,107 / 24,374
Images phase of that draw 117 s / 129 s (a second one in the long run: 141 s)
allocate+image in the [texture] totals, cumulative over the run until then 60 s (26,000 textures)
vkAllocateMemory for those images (local timing probe, same span) 24 s, 0.93 ms per image
Image allocations by then, freed ones included (same probe) 23.6 GiB
Stop device OOM (vkAllocateMemory buffer slab ... -2) at 497 s and before 200 s
  • Each sampled image gets its own vkAllocateMemory (AllocateImageMemory → BufferPool::AllocateMemory). Image creation and allocation together are at most about half of the 129 s, the allocation calls alone under a fifth; the rest is per-entry work in resolveImageTables.
  • Presents stop once these draws begin: the committer spends 18.5 s per draw and the draw cache misses each time, so the title looks frozen long before it runs out of memory.
  • Pooling the image allocations would shorten each draw, but not the memory one set holds at once (your 14.6 GiB), which is what ends the run. So this agrees that the fix is not building a host image per entry, as in the guest-memory sampling you describe.

AI-assisted; the runs are from my machine(s).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6295388614 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6890#issuecomment-6295388614). Originally posted by [mrfelek](https://github.com/mrfelek) on 2026-10-20T16:07:56Z. --- **Same stop on a 12 GB card, with a split of where the image phase goes** **Setup:** Linux, Ryzen 9 5950X, RTX 3080 Ti 12 GB (NVIDIA 615.71.09). Death Stranding 2 (PPSA02015) 01.015.000, no input, default settings. **Build:** `main` b50976750 + #5426, #7978, #8015, #8115 (with #7985), a 3D gather fix (`fix/volume-gather-lz` on my fork) and local, env-gated changes to get past EQAA and aliased multisample depth stops. Not a clean-`main` result. Two runs (497 s and 200 s), one big table draw each time: | | | |---|---| | Textures in the draw's set | 24,107 / 24,374 | | Images phase of that draw | 117 s / 129 s (a second one in the long run: 141 s) | | `allocate+image` in the `[texture]` totals, cumulative over the run until then | 60 s (26,000 textures) | | `vkAllocateMemory` for those images (local timing probe, same span) | 24 s, 0.93 ms per image | | Image allocations by then, freed ones included (same probe) | 23.6 GiB | | Stop | device OOM (`vkAllocateMemory buffer slab ... -2`) at 497 s and before 200 s | - Each sampled image gets its own `vkAllocateMemory` (`AllocateImageMemory` → `BufferPool::AllocateMemory`). Image creation and allocation together are at most about half of the 129 s, the allocation calls alone under a fifth; the rest is per-entry work in `resolveImageTables`. - Presents stop once these draws begin: the committer spends 18.5 s per draw and the draw cache misses each time, so the title looks frozen long before it runs out of memory. - Pooling the image allocations would shorten each draw, but not the memory one set holds at once (your 14.6 GiB), which is what ends the run. So this agrees that the fix is not building a host image per entry, as in the guest-memory sampling you describe. AI-assisted; the runs are from my machine(s).
Dextroid17 commented 2026-10-21 20:00:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-21T20:00:41Z.


Second title on the same resolver: Ghost of Yōtei (PPSA26344) rebuilds a 33,677-entry table on every plan after the first OOM

Setup: Linux (kernel 7.2.11), RTX 3080 Ti 12 GB (NVIDIA 615.78.08), 32 GB RAM. Ghost of Yōtei (PPSA26344), first ~70 minutes from launch, APS5_PROFILE_DRAW=1 APS5_SKIP_REFUSED_DRAWS=1 APS5_NO_PIPELINE_JOURNAL=1.
Build: main 80565c594 plus local GoY carry commits (an RG32F filter-minmax channel copy, touching TextureKey, cachedTexture and the resolveImageBinding call site, and an undo of #7726). resolveImageTables, FindReusedTable and CachedTableTextures are as on main (same body on 7202f120d today). Not a clean-main result. Two runs: A with the default budget, B with APS5_TEXTURE_CACHE_MIB=2048 (which forces both the sampled and the storage budget).

One draw's bindless image table has 33,677 elements (bda 1; a second shape with 33,659 elements, bda 0, also appears):

[resources] images took 44034 ms (33677 textures, 0 storage images, 35 buffers, bda 1)
[mem-probe] t=350s frame=832 ... vkmem live=24508MB peak=24508MB n=44184 ... buckets<1M/16M/64M/big=2708/13540/3963/4296MB

The first full resolve (frame 832 in B, 834 in A) takes vkmem live to 24.5 GB on a 12 GB device, and the first vkAllocateMemory ... initialResult=-2 is in that same frame, as in the report. From there frames take 50–190 s each (before it they advance faster than the 10 s probe), which is the "looks frozen" phase mrfelek described. The OOM itself is the first resolve; the crawl after it is the same resolve repeated:

run A (default budget) run B (APS5_TEXTURE_CACHE_MIB=2048)
builds of this table, whole run 46 (37 × 33,677, 9 × 33,659) 52 (43 × 33,677, 9 × 33,659)
builds of it after frame 847 29, mean 47.6 s, max 54.8 s 34, mean 42.3 s, max 81.9 s
time in them after frame 847 1,380 s 1,438 s
whole images phase after frame 847 2,316 s (442 builds) 1,950 s (516 builds)
frame 847 → 859 1,275 s 1,275 s
image tables N reused, M resolved at the end 796 / 8,398 735 / 9,454
most sampled-cache entries at any 10 s reading 21,655 7,734
used uncached share of texture uses after 847 42.6 % 82.0 %
initialResult=-2 ... recovered lines 1,288 1,660

So 60 % / 74 % of the image phase in the crawl is this one table being rebuilt; the rest is the smaller tables of the other draws, which by the used uncached share also miss the cache once the big resolve has evicted them (not checked per table).

Why the remembered table is not taken: resolveImageTables reuses a table only when FindReusedTable && TableCurrent && CachedTableTextures all hold. CachedTableTextures walks every non-rejected element and returns false as soon as one element's texture is not in the sampled cache (or is a different object than the one remembered). The sampled cache never held 33,677 entries in either run at a 10 s reading (21,655 and 7,734 at most), so for a table this size the check fails and the build goes to the resolved path. The resolve fills the cache and then evicts it (run A's [texture-cache] readings swing 0 ↔ 5.6 GB between consecutive 10 s windows; run B's budget stays at 2,048 MiB and the cache sits at it in about two-thirds of the readings). That is also why the smaller forced budget did not shorten the crawl: the frame 847 → 859 span is 1,275 s in both runs, and run B hits the cache less. The profile lines do not name the owning shader, so "every build of this table is resolved, never reused" is inferred from the build counts, not read from a per-table counter.

What this adds: fma-rc's measurement is of one resolve holding more than the device has; this title shows the resolve is then repeated for the rest of the run, because reuse needs every element resident and the table is larger than the sampled cache ever is. A path that makes no host image per element (the guest-memory sampling above) would cover both, since there is then nothing to keep resident. Short of that, the two places this run hits are the reuse check (every element resident) and the budget (smaller than one table's working set); I am not proposing which one changes. If the rebuild-on-every-plan part is better tracked separately I can open it as its own issue and link it here.

Logs are 13.1 M / 13.8 M lines; I can attach the [resources], [texture-cache] and [mem-probe] extracts if useful.

AI-assisted; the runs are from my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6325296847 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6890#issuecomment-6325296847). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-21T20:00:41Z. --- **Second title on the same resolver: Ghost of Yōtei (PPSA26344) rebuilds a 33,677-entry table on every plan after the first OOM** **Setup:** Linux (kernel 7.2.11), RTX 3080 Ti 12 GB (NVIDIA 615.78.08), 32 GB RAM. Ghost of Yōtei (PPSA26344), first ~70 minutes from launch, `APS5_PROFILE_DRAW=1 APS5_SKIP_REFUSED_DRAWS=1 APS5_NO_PIPELINE_JOURNAL=1`. **Build:** `main` 80565c594 plus local GoY carry commits (an RG32F filter-minmax channel copy, touching `TextureKey`, `cachedTexture` and the `resolveImageBinding` call site, and an undo of #7726). `resolveImageTables`, `FindReusedTable` and `CachedTableTextures` are as on `main` (same body on 7202f120d today). Not a clean-`main` result. Two runs: A with the default budget, B with `APS5_TEXTURE_CACHE_MIB=2048` (which forces both the sampled and the storage budget). One draw's bindless image table has 33,677 elements (`bda 1`; a second shape with 33,659 elements, `bda 0`, also appears): ``` [resources] images took 44034 ms (33677 textures, 0 storage images, 35 buffers, bda 1) [mem-probe] t=350s frame=832 ... vkmem live=24508MB peak=24508MB n=44184 ... buckets<1M/16M/64M/big=2708/13540/3963/4296MB ``` The first full resolve (frame 832 in B, 834 in A) takes `vkmem live` to 24.5 GB on a 12 GB device, and the first `vkAllocateMemory ... initialResult=-2` is in that same frame, as in the report. From there frames take 50–190 s each (before it they advance faster than the 10 s probe), which is the "looks frozen" phase mrfelek described. The OOM itself is the first resolve; the crawl after it is the same resolve repeated: | | run A (default budget) | run B (`APS5_TEXTURE_CACHE_MIB=2048`) | |---|---|---| | builds of this table, whole run | 46 (37 × 33,677, 9 × 33,659) | 52 (43 × 33,677, 9 × 33,659) | | builds of it after frame 847 | 29, mean 47.6 s, max 54.8 s | 34, mean 42.3 s, max 81.9 s | | time in them after frame 847 | 1,380 s | 1,438 s | | whole images phase after frame 847 | 2,316 s (442 builds) | 1,950 s (516 builds) | | frame 847 → 859 | 1,275 s | 1,275 s | | `image tables N reused, M resolved` at the end | 796 / 8,398 | 735 / 9,454 | | most sampled-cache entries at any 10 s reading | 21,655 | 7,734 | | `used uncached` share of texture uses after 847 | 42.6 % | 82.0 % | | `initialResult=-2 ... recovered` lines | 1,288 | 1,660 | So 60 % / 74 % of the image phase in the crawl is this one table being rebuilt; the rest is the smaller tables of the other draws, which by the `used uncached` share also miss the cache once the big resolve has evicted them (not checked per table). Why the remembered table is not taken: `resolveImageTables` reuses a table only when `FindReusedTable && TableCurrent && CachedTableTextures` all hold. `CachedTableTextures` walks every non-rejected element and returns `false` as soon as one element's texture is not in the sampled cache (or is a different object than the one remembered). The sampled cache never held 33,677 entries in either run at a 10 s reading (21,655 and 7,734 at most), so for a table this size the check fails and the build goes to the resolved path. The resolve fills the cache and then evicts it (run A's `[texture-cache]` readings swing 0 ↔ 5.6 GB between consecutive 10 s windows; run B's budget stays at 2,048 MiB and the cache sits at it in about two-thirds of the readings). That is also why the smaller forced budget did not shorten the crawl: the frame 847 → 859 span is 1,275 s in both runs, and run B hits the cache less. The profile lines do not name the owning shader, so "every build of this table is resolved, never reused" is inferred from the build counts, not read from a per-table counter. What this adds: fma-rc's measurement is of one resolve holding more than the device has; this title shows the resolve is then repeated for the rest of the run, because reuse needs every element resident and the table is larger than the sampled cache ever is. A path that makes no host image per element (the guest-memory sampling above) would cover both, since there is then nothing to keep resident. Short of that, the two places this run hits are the reuse check (every element resident) and the budget (smaller than one table's working set); I am not proposing which one changes. If the rebuild-on-every-plan part is better tracked separately I can open it as its own issue and link it here. Logs are 13.1 M / 13.8 M lines; I can attach the `[resources]`, `[texture-cache]` and `[mem-probe]` extracts if useful. AI-assisted; the runs are from my machine.
Dextroid17 commented 2026-10-21 21:03:51 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-21T21:03:51Z.


Correction to my comment above: the table is never remembered; the resident-cache check is never reached

I added an env-gated log line to resolveImageTables (same main 80565c594 + carry build as above; diff on request) that prints, for every table of ≥30,000 elements that is not reused, which reuse gate refused it and whether the fresh build was eligible to be remembered. One run on the same machine, ~1,330 s, frames 831–841:

[table-stats] shader 0x800034f300 stage 5 set 1: 33657 elements built (not-remembered), 0 rejected, 33657 distinct bases, 8658 MiB summed over 8658 MiB covered (x1.00), 0 dcc, remembered 1, state epoch 37647 unwatch 0 alloc 32350 depth 12, rememberable no:snapshot-source

15 such lines from two fragment shaders (imageTableShader 0x800034f300, 11 builds, one in every frame of the window; 0x80003bdb00, 4 builds). They are the 33677 textures / 33659 textures [resources] lines of the earlier comment (33,657 table elements plus the shader's other textures). All 15 say the same thing:

  • refused at FindReusedTable (not-remembered); TableCurrent and CachedTableTextures are never reached;
  • the fresh build is not stored either: the per-element reusable chain goes false at looked->source == nullptr, i.e. at least one element's texture was created from a StorageTexture (a GPU-written image, no snapshot). The line records the first element that fails, so later elements may fail for other reasons too.

So what I wrote above — reuse fails because the sampled cache never holds all entries, and the "reuse needs every element resident" reasoning in the paragraph after it — is not what happens on this title. The table is rebuilt on every bind because it is never eligible to be remembered; cache residency is never tested. I withdraw those two parts; the build counts and timings stand.

Shape, since fma-rc gave DS2's: 33,657 distinct base addresses over 33,657 elements (×1.00, nothing shared), 8,658–8,665 MiB of guest range per table, 0 DCC, 0 rejected before texture lookup. Each build took 32.5–62.1 s (the [resources] images took line that follows each [table-stats] line). DS2's 12,285 bases over 21,489 entries (×3.6) is a different shape; here there is nothing to deduplicate.

The source != nullptr exclusion is what keeps this table out of reuse; I have not measured which element(s) carry a storage source or whether it is the same one(s) every frame, and I have not read why the exclusion is there, so I am not proposing it change.

Extract of the 15 lines and the diff on request. AI-assisted; the run is from my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6326508566 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6890#issuecomment-6326508566). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-21T21:03:51Z. --- **Correction to my comment above: the table is never remembered; the resident-cache check is never reached** I added an env-gated log line to `resolveImageTables` (same `main` 80565c594 + carry build as above; diff on request) that prints, for every table of ≥30,000 elements that is not reused, which reuse gate refused it and whether the fresh build was eligible to be remembered. One run on the same machine, ~1,330 s, frames 831–841: ``` [table-stats] shader 0x800034f300 stage 5 set 1: 33657 elements built (not-remembered), 0 rejected, 33657 distinct bases, 8658 MiB summed over 8658 MiB covered (x1.00), 0 dcc, remembered 1, state epoch 37647 unwatch 0 alloc 32350 depth 12, rememberable no:snapshot-source ``` 15 such lines from two fragment shaders (`imageTableShader` 0x800034f300, 11 builds, one in every frame of the window; 0x80003bdb00, 4 builds). They are the `33677 textures` / `33659 textures` `[resources]` lines of the earlier comment (33,657 table elements plus the shader's other textures). All 15 say the same thing: - refused at `FindReusedTable` (`not-remembered`); `TableCurrent` and `CachedTableTextures` are never reached; - the fresh build is not stored either: the per-element `reusable` chain goes false at `looked->source == nullptr`, i.e. at least one element's texture was created from a `StorageTexture` (a GPU-written image, no snapshot). The line records the first element that fails, so later elements may fail for other reasons too. So what I wrote above — reuse fails because the sampled cache never holds all entries, and the "reuse needs every element resident" reasoning in the paragraph after it — is not what happens on this title. The table is rebuilt on every bind because it is never eligible to be remembered; cache residency is never tested. I withdraw those two parts; the build counts and timings stand. Shape, since fma-rc gave DS2's: 33,657 distinct base addresses over 33,657 elements (×1.00, nothing shared), 8,658–8,665 MiB of guest range per table, 0 DCC, 0 rejected before texture lookup. Each build took 32.5–62.1 s (the `[resources] images took` line that follows each `[table-stats]` line). DS2's 12,285 bases over 21,489 entries (×3.6) is a different shape; here there is nothing to deduplicate. The `source != nullptr` exclusion is what keeps this table out of reuse; I have not measured which element(s) carry a storage source or whether it is the same one(s) every frame, and I have not read why the exclusion is there, so I am not proposing it change. Extract of the 15 lines and the diff on request. AI-assisted; the run is from my machine.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#6890
No description provided.