perf(shader): replay an image table column's decoded records when its content recurs #12051

Closed
SleglJan wants to merge 6 commits from upstream-pr/12051 into main
SleglJan commented 2026-10-27 17:38:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-27T17:38:40Z.


What

When the result memo misses and the table resolution reuse misses too, an image table column is resolved from its records: each record's decode is looked up in the decode memo (one global mutex per record), null descriptors are checked, each element is hashed and placed, and the map is written. On a scene with large tables the same column content comes back on most of these misses, read through image resources that agree in every field but the descriptor source, the first use and the table index. This PR keeps a column's decoded records and replays them when the same content recurs:

  • The memo key is the column's content (its codes and words, hashed once per snapshot block by SharedValues::Hash), its key count and its records-outside-the-snapshot state, plus the usage: the image resource without its descriptor source, first use and table index, its runtime mode list and the reducing-sampler state. Columns of at least 64 keys, in the runtime resolution; the registration-time Populate path does not use the memo.
  • A hit replays the column's records and elements into the resolution: the elements are placed through the same dedup as a fresh decode, and the poison records and the direct-sampler mask are recomputed from the current resource. A miss decodes as before and records the column.
  • The memo holds one entry per content and usage and references the snapshot block it missed on, so a content's codes and words are not copied per entry; entries evict by least recent use under a word budget (APS5_TABLE_COLUMN_MEMO_WORDS, default 33,554,432 words of estimated host memory) and an entry count of 4,096.
  • The column memo report of APS5_PROFILE_DRAW counts hits, misses never seen and misses whose content changed; the last two keep one slot per usage (up to 131,072) under a mutex, only while APS5_PROFILE_DRAW is set.
  • APS5_NO_TABLE_COLUMN_MEMO=1 resolves every column from its records as before.
  • APS5_VERIFY_TABLE_COLUMN_MEMO=1 also resolves every replayed snapshot from its records and compares the map, elements, samplers, poison records and faults; the first twenty differences are printed and the count goes into the report line.
  • APS5_TABLE_COLUMN_MEMO_DIAG=1 extends that line with the distinct contents and usages of the window and, for the changed-content misses whose previous column is still pinned, the keys whose descriptor differs and the 1,024-key chunks holding them; it takes effect only with APS5_PROFILE_DRAW.
  • The four switches change memo behaviour only, never the recompiled output, so they are listed as neutral to the shader disk cache key (NeutralSwitches).
  • Tests: agc_shader_table_column_memo (a replayed resolution equals a fresh one across a second variant, another first use and another descriptor source; a changed mode list or decode input misses; the hit and miss counters), with the verified, off, reported, diagnosed and diagnosed-unreported variants. dc1e7e5695 adds agc_shader_table_column_memo_placement, _placement_before and _placement_off (thirty selected single-record tables and one merged column in one resolution, the merged column resolved after or before them; its narrowed domain binds its 65 keyed records and record 0, thirty of its records equal the selected tables' records and land on the same elements, 66 elements in all, equal to the plain resolution), _evicted_by_count (4,096 distinct contents, then the least recently used entry leaves first, read through hits and misses), _evicted_by_budget (APS5_TABLE_COLUMN_MEMO_WORDS=65536, 200 contents with the first replayed after every insertion: the newest and the first kept, the least recently used evicted) and _oversize_entry (APS5_TABLE_COLUMN_MEMO_WORDS=0x1: nothing kept), and nine _words* registrations (the same column resolved twice per value: kept on the second resolution under unset, 1048576 and 0x100000; the first resolution fails with the variable's message for 0, -1, empty, abc, 12x and a 20-digit overflow).

Related open PRs: #6340, #10193, #7642 and #10256 work on the driver's image table entries and device tables. #7223 (nested image tables through runtime pointers) changes the same resolution loop and adds child tables and the pointers that key them, which this memo does not cover: whichever lands second has to extend the key and the replay to them, or exclude nested columns from the memo. What the second to land changes is proposed on #7223 (https://github.com/boykopovar/AnyPS5/pull/7223#issuecomment-6475451084): keep the pointer-keyed parent column out of the memo (its child tables still go through the resolution as ordinary columns and stay eligible), or key the memo on the child content; the order itself is open with #7223's author.

Tested

CachyOS Linux (kernel 7.2.10), NVIDIA GeForce RTX 3080, driver 615.78.08, AMD Ryzen 9 7950X3D, 64 GB; GCC 16.2.1, CMake 4.4.4.

  • ctest -R "^agc" on this PR at dc1e7e5695: 1,073 passed, 10 skipped, 1 failed of 1,084. The one failure, agc_driver_mesh_barycentric_emulation, fails the same way on plain main c547deaacb on this machine ("AGC graphics: the pixel shader did not emulate barycentrics", NVIDIA 615.78.08).
  • ctest --test-dir build -R "^agc_shader_" -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: 37/37 on main c547deaacb, 58/58 on this PR at dc1e7e5695 (the 21 extra are the column memo tests). Neither log has was not found but was requested by env var VK_INSTANCE_LAYERS, and neither has a VUID- line.

What this change claims now: the [recompile] Populate time is down on main (171 / 169 / 172 ms per frame against 67 / 69 / 72 in the A/B below); no frame-rate gain on main within the run spread (walk presents per second 0.369 / 0.369 / 0.341 against 0.358 / 0.326 / 0.371); the +11.5 % walk gain below was measured only on the local base and does not reproduce on main.

Capture pair, 007 First Light (PPSA11386), the walk after the resume of the first level: main at the PR's base c547deaacb (2026-10-28, 12:04 to 12:47 CET) and this PR at its head dc1e7e5695 (12:51 to 13:34 CET), same machine and boot, a build and a test run in between, APS5_TRACE_FRAMES=1085:150 on both sides. Not as the form asks: APS5_TRACE_EVENTS=4194304 on both sides, because queue worker 0x0 records about 10,700 events per present here and the default buffer of 262,144 events (docs/dev/BUILD.md) holds about 25 presents; APS5_TRACE_DIR for the output directory; APS5_TIME_SCALE=0.1 and scripted input through APS5_PAD_INPUT_FILE, both visible in the lines' env; and, not visible there, the log written to a file, the NVIDIA shader disk cache on and pointed at a per-run directory copied from a seed run (a 16 GiB size cap, its cleanup skipped), the shader disk cache and the journal warm from that seed run rather than from a restart, and the title in a scope with swap turned off. No other APS5_TRACE_* switch and no APS5_PROFILE_* switch is set. Both sides the same way: main from its own seed; this PR from a copy of the PR's seed with main's journal records (the journal header's source version set to the PR's), so the journal records and the NVIDIA cache are identical on both sides while the shader disk cache is each side's own, the shader cache source versions being 41abaa3b8f8b9199 on main and 75f9ad0bc594cabf on this PR. The title executable is unedited.

{"commit":"c547deaacb62","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TIME_SCALE":"0.1","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"1085:150"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"frames 1085:150","first_present":1085,"ms":418164.785},"presents":150,"frame_ms":{"p50":2711.721,"p90":3216.898,"p99":3992.038,"max":4422.742},"gpu_busy_ms_per_present":477.688,"worker_busy_pct":{"queue worker 0x0":99.931,"queue worker 0x20":99.869,"queue worker 0x28":99.746,"queue worker 0x30":99.799,"queue worker 0x38":82.472},"top_phases_ms_per_frame":{"Driver.Packet":13395.303,"Driver.Packet.memory_wait":9050.250,"Driver.Packet.dispatch":2341.595,"GpuMutex.wait.hook":2314.830,"Driver.Dispatch":2091.833,"Resources.Complete":1952.857,"Driver.Packet.draw":1763.494,"Driver.Draw":1762.767},"trace_dropped":false,"trace":"aps5-trace-c547deaacb62-2.json.gz"}
{"commit":"dc1e7e5695ab","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TIME_SCALE":"0.1","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"1085:150"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"frames 1085:150","first_present":1085,"ms":436633.103},"presents":150,"frame_ms":{"p50":2882.072,"p90":3378.460,"p99":4499.485,"max":7033.048},"gpu_busy_ms_per_present":497.524,"worker_busy_pct":{"queue worker 0x0":99.946,"queue worker 0x20":99.900,"queue worker 0x28":99.815,"queue worker 0x38":82.658,"queue worker 0x30":99.844},"top_phases_ms_per_frame":{"Driver.Packet":13992.217,"Driver.Packet.memory_wait":9511.346,"GpuMutex.wait.hook":2578.339,"Driver.Packet.dispatch":2452.564,"Driver.Dispatch":2167.295,"Resources.Complete":2116.024,"Graphics.Draw":1816.352,"Driver.Packet.draw":1792.957},"trace_dropped":false,"trace":"aps5-trace-dc1e7e5695ab-2.json.gz"}
  • Digests (tools/trace_digest.py output) and the two traces: pre-release https://github.com/SleglJan/AnyPS5/releases/tag/perf-traces-shader-column-memo on my fork, both files over the 25 MB attachment limit (31.7 and 32.4 MB), sha256 e44ae16fa69649761e15a3f5cd9a394f8089e4a51db7e34c59d2590ff518e6e5 (main) and 22b1ef75f9c6c30a4c75a5552866af2d790655ae1ede305a18e25a1f5e5d1fd7 (this PR).
  • tools/performance_compare.py on the lines: no configuration difference; this PR minus main: frame p50 +170 ms (+6.3 %), p90 +162 (+5.0 %), p99 +507 (+12.7 %), max +2,610 (+59 %), mean frame +123 (+4.4 %), GPU busy per present +20 (+4.2 %); one pair, one run per side. Highest VmHWM 24,371 against 25,134 MiB, both including the trace buffers (seven threads at 160 MiB each, 1,120 MiB, on both sides).
  • Harness validity, under both readings defined in the next bullet: both runs on route with no device faults; collapse cannot be judged on this switch set. Second reading: main's run passes every check readable here (collapse is not readable; peak device memory used 9,550 MiB over the run, 9,042 MiB at the level load, every other figure under its limit), this change's run invalid: it peaks at 9,883 MiB at frame 1,036 (the level load, before the walk and outside the trace window), over our 9,850 MiB limit; its next-highest 1 s sample is 9,782 MiB at frame 1,248. First reading: both invalid, because the staging-shadow refusal lines count as unrecovered refusals there (main 2, its full count; this change 4, a lower bound, four prints per run at most).
  • The A/B on main c547deaacb with APS5_PROFILE_DRAW=1 and APS5_TRACE_SUMMARY_EVERY=60 (three alternated pairs, 2026-10-27 22:41 to 2026-10-28 03:00 CET, this change at f5cf0db16c, main at the PR's base c547deaacb while main itself was 32 merges past it, journals unequal, the cache and swap settings as above): walk presents per second under the first reading, declared before the series (any unrecovered allocation refusal invalid), n = 1 / 1, main 0.341 against this change 0.326; under the later reading, which counts staging-shadow refusal lines as handled and was declared after pair 1's results, which made both its runs invalid only through these lines, while pair 2's first run was running, n = 3 / 3, main 0.369 / 0.369 / 0.341 (mean 0.360) against this change 0.358 / 0.326 / 0.371 (mean 0.352); four of the six runs differ between the two readings, all on that line. [recompile] Populate 171 / 169 / 172 against 67 / 69 / 72 ms per frame. Highest VmHWM per run main 23,651 / 24,614 / 24,036 MiB, this change 24,460 / 25,557 / 23,802 MiB.

The earlier alternated A/B, the same title and walk, measured before this rebase on a local base, not on main: upstream main 5357acd697 plus #5372 (squashed, with its 662a50bf7e change reverted) and #10423, plus local logging and scripted input, and the title's two feedback-wait limits widened in its executable as described in #6172 (local only). Both sides run with APS5_WRITTEN_SHADOW_MAX_KIB=2048 APS5_NO_WRITTEN_SHADOW=1 APS5_PROFILE_DRAW=1 and a warm shader disk cache from a seed run per side; 2026-10-27, six pairs alternated base / this change, 20 minutes each, the same machine and session.

  • Our run validity rule of that day (a texture-cache admission streak taken as a storage-budget collapse) left this change with 1 valid run of 6 against 5 of 6 for the base, so that rule gives no verdict. No run of the series reached the 512 MiB storage floor, and the lowest storage budgets are equal (base 2,788-3,125 MiB, this change 2,858-3,127 MiB). One synchronous-present pair (APS5_FLIP_INFLIGHT=0) cut the held-entry difference between the sides from 2.09x to 1.29x and showed no streaks, an observation from one pair, with no cause read from it.
  • Second reading, declared after the first four runs, once the first flagged run had shown no slowdown in its streak window, and fixed before the other eight: a run invalid only through the streak counts as valid unless its storage budget reached 512 MiB or its longest streak window ran below 0.90 of its own walk rate; runs with host placements (the exhaustion rule) stay invalid. Base n = 5, this change n = 3.
base this change
walk, presents per second, second reading (base n = 5, this change n = 3) 0.962 (0.933-0.989) 1.073 (1.034-1.106)
walk, presents per second, all six runs per side 0.965 (0.933-0.989) 1.087 (1.034-1.112)
Populate ms per frame, all six 157 (148-170) 50 (48-51)
GPU busy ms per frame, all six 315 (311-317) 313 (309-318)
main menu, presents per second, all six 3.37 (3.31-3.43) 3.40 (3.37-3.49)
title screen reached, s after start, all six 117-118 117-118
  • Walk +11.5 % by the second reading's means and +12.6 % over all six runs per side; every run of this change is above every run of the base. The menus and the boot do not change: the memo's hits are in gameplay, where the big tables recur.
  • Column memo in gameplay: 93.1-93.2 % hits over the six runs of this change (125-132 hits per frame); in the verify run with APS5_VERIFY_TABLE_COLUMN_MEMO=1, 106,481 hits and 7,958 misses over 92 ten-second lines (93.0 %), 29,618 replayed resolutions re-resolved from their records, 0 mismatches. Every miss was a column whose content changed; the memo held 323-402 entries.
  • Level load, two quantities: the 1 s peak of device memory outside the texture caches (the local-base figures) and, for the main series, the 1 s peak of nvidia-smi memory used by all processes between the resume and frame 1,055, with the memory outside the texture caches read at the [gpu] budget line nearest that peak and the title's own device memory as the highest nvidia-smi pmon sample in that window. Local-base series: base 1,033-1,257 MiB against this change 1,206-2,528 MiB outside the caches, with first host placements in 3 of 6 runs against 1 of 6 (Fisher, one-sided, 0.27); the series had one seed per side (its own shader disk cache, frozen NVIDIA cache and journal) and the PR side loaded the smaller journal, so the cause there is not established. On main c547deaacb, each series in one session, main always from one seed, this change minus main:
series journals commit 1 s peak of memory used, per pair (MiB) outside the caches at the nearest budget line (MiB) title's own device memory, pmon (MiB)
the A/B above, three pairs unequal (this change 215 pipelines, main 175) f5cf0db16c +809 / +403 / +373 not read not read
three pairs to frame 1,720, 2026-10-28 07:35-11:13 CET shared (175 / 185 / 884.5 MiB) f5cf0db16c +83 / −434 / +118 −147 / +89 / +1,888 (pair 3's main line 26 s from the peak) −173 / −123 / −14
five pairs stopped at frame 1,100, 13:41-16:30 CET shared dc1e7e5695 −214 / +445 / −77 / −541 / +133 +109 / −187 / −511 / +257 / −62 (pair 5's main line 37 s from the peak) +226 / +577 / +184 / +101 / +23
the capture pair above, trace switches, one run per side shared dc1e7e5695 +841 (9,883 against 9,042) −574 −9

Over the eight shared-journal pairs the means are main 9,321 against this change 9,260 MiB; without the three-pair series' pair 3 (its main run had six shader disk cache misses) 7 / 7, 9,384 against 9,298. Both groupings, 8 / 8 and 7 / 7, were declared before the five-pair series ran; both include that series' four runs which the same declaration's disk-cache rule makes invalid, and the declaration did not say how to treat them. The sign is not consistent across pairs; the one series with every pair higher on this change is the one with unequal journals. Four of the eight pairs have a run with 4 to 6 misses in the boot, none later (cause not chased); grouped after seeing the data, the four pairs without one give +445 / −541 / +83 / −434 MiB. Host placements by frame 1,055: main in 2 of its 8 shared-journal runs ([bufferpool] at least 3 in one, at least 1 in the other), this change in 3 of 8 ([gpu] at least 3 with [bufferpool] at least 1 in one, [bufferpool] at least 1 in each of the other two); the capture pair: this change [gpu] at least 8, main none.

Checklist

  • Based on current main (main f8f5b24b77 merged in at c5dcde982e, after the results above were posted); no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are listed in their library's technical debt file
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none; related: #7223 (what the second to land changes, proposed there)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3080, driver 615.78.08, CachyOS Linux 7.2.10
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5038450194 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12051). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-27T17:38:40Z. --- ### What When the result memo misses and the table resolution reuse misses too, an image table column is resolved from its records: each record's decode is looked up in the decode memo (one global mutex per record), null descriptors are checked, each element is hashed and placed, and the map is written. On a scene with large tables the same column content comes back on most of these misses, read through image resources that agree in every field but the descriptor source, the first use and the table index. This PR keeps a column's decoded records and replays them when the same content recurs: - The memo key is the column's content (its codes and words, hashed once per snapshot block by `SharedValues::Hash`), its key count and its records-outside-the-snapshot state, plus the usage: the image resource without its descriptor source, first use and table index, its runtime mode list and the reducing-sampler state. Columns of at least 64 keys, in the runtime resolution; the registration-time `Populate` path does not use the memo. - A hit replays the column's records and elements into the resolution: the elements are placed through the same dedup as a fresh decode, and the poison records and the direct-sampler mask are recomputed from the current resource. A miss decodes as before and records the column. - The memo holds one entry per content and usage and references the snapshot block it missed on, so a content's codes and words are not copied per entry; entries evict by least recent use under a word budget (`APS5_TABLE_COLUMN_MEMO_WORDS`, default 33,554,432 words of estimated host memory) and an entry count of 4,096. - The column memo report of `APS5_PROFILE_DRAW` counts hits, misses never seen and misses whose content changed; the last two keep one slot per usage (up to 131,072) under a mutex, only while `APS5_PROFILE_DRAW` is set. - `APS5_NO_TABLE_COLUMN_MEMO=1` resolves every column from its records as before. - `APS5_VERIFY_TABLE_COLUMN_MEMO=1` also resolves every replayed snapshot from its records and compares the map, elements, samplers, poison records and faults; the first twenty differences are printed and the count goes into the report line. - `APS5_TABLE_COLUMN_MEMO_DIAG=1` extends that line with the distinct contents and usages of the window and, for the changed-content misses whose previous column is still pinned, the keys whose descriptor differs and the 1,024-key chunks holding them; it takes effect only with `APS5_PROFILE_DRAW`. - The four switches change memo behaviour only, never the recompiled output, so they are listed as neutral to the shader disk cache key (`NeutralSwitches`). - Tests: `agc_shader_table_column_memo` (a replayed resolution equals a fresh one across a second variant, another first use and another descriptor source; a changed mode list or decode input misses; the hit and miss counters), with the verified, off, reported, diagnosed and diagnosed-unreported variants. dc1e7e5695 adds `agc_shader_table_column_memo_placement`, `_placement_before` and `_placement_off` (thirty selected single-record tables and one merged column in one resolution, the merged column resolved after or before them; its narrowed domain binds its 65 keyed records and record 0, thirty of its records equal the selected tables' records and land on the same elements, 66 elements in all, equal to the plain resolution), `_evicted_by_count` (4,096 distinct contents, then the least recently used entry leaves first, read through hits and misses), `_evicted_by_budget` (`APS5_TABLE_COLUMN_MEMO_WORDS=65536`, 200 contents with the first replayed after every insertion: the newest and the first kept, the least recently used evicted) and `_oversize_entry` (`APS5_TABLE_COLUMN_MEMO_WORDS=0x1`: nothing kept), and nine `_words*` registrations (the same column resolved twice per value: kept on the second resolution under unset, `1048576` and `0x100000`; the first resolution fails with the variable's message for `0`, `-1`, empty, `abc`, `12x` and a 20-digit overflow). Related open PRs: #6340, #10193, #7642 and #10256 work on the driver's image table entries and device tables. #7223 (nested image tables through runtime pointers) changes the same resolution loop and adds child tables and the pointers that key them, which this memo does not cover: whichever lands second has to extend the key and the replay to them, or exclude nested columns from the memo. What the second to land changes is proposed on #7223 (https://github.com/boykopovar/AnyPS5/pull/7223#issuecomment-6475451084): keep the pointer-keyed parent column out of the memo (its child tables still go through the resolution as ordinary columns and stay eligible), or key the memo on the child content; the order itself is open with #7223's author. ### Tested CachyOS Linux (kernel 7.2.10), NVIDIA GeForce RTX 3080, driver 615.78.08, AMD Ryzen 9 7950X3D, 64 GB; GCC 16.2.1, CMake 4.4.4. - `ctest -R "^agc"` on this PR at dc1e7e5695: 1,073 passed, 10 skipped, 1 failed of 1,084. The one failure, `agc_driver_mesh_barycentric_emulation`, fails the same way on plain `main` c547deaacb on this machine ("AGC graphics: the pixel shader did not emulate barycentrics", NVIDIA 615.78.08). - `ctest --test-dir build -R "^agc_shader_" -V` with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: 37/37 on `main` c547deaacb, 58/58 on this PR at dc1e7e5695 (the 21 extra are the column memo tests). Neither log has `was not found but was requested by env var VK_INSTANCE_LAYERS`, and neither has a `VUID-` line. What this change claims now: the `[recompile]` Populate time is down on `main` (171 / 169 / 172 ms per frame against 67 / 69 / 72 in the A/B below); no frame-rate gain on `main` within the run spread (walk presents per second 0.369 / 0.369 / 0.341 against 0.358 / 0.326 / 0.371); the +11.5 % walk gain below was measured only on the local base and does not reproduce on `main`. Capture pair, 007 First Light (PPSA11386), the walk after the resume of the first level: `main` at the PR's base c547deaacb (2026-10-28, 12:04 to 12:47 CET) and this PR at its head dc1e7e5695 (12:51 to 13:34 CET), same machine and boot, a build and a test run in between, `APS5_TRACE_FRAMES=1085:150` on both sides. Not as the form asks: `APS5_TRACE_EVENTS=4194304` on both sides, because queue worker 0x0 records about 10,700 events per present here and the default buffer of 262,144 events (`docs/dev/BUILD.md`) holds about 25 presents; `APS5_TRACE_DIR` for the output directory; `APS5_TIME_SCALE=0.1` and scripted input through `APS5_PAD_INPUT_FILE`, both visible in the lines' `env`; and, not visible there, the log written to a file, the NVIDIA shader disk cache on and pointed at a per-run directory copied from a seed run (a 16 GiB size cap, its cleanup skipped), the shader disk cache and the journal warm from that seed run rather than from a restart, and the title in a scope with swap turned off. No other `APS5_TRACE_*` switch and no `APS5_PROFILE_*` switch is set. Both sides the same way: `main` from its own seed; this PR from a copy of the PR's seed with `main`'s journal records (the journal header's source version set to the PR's), so the journal records and the NVIDIA cache are identical on both sides while the shader disk cache is each side's own, the shader cache source versions being 41abaa3b8f8b9199 on `main` and 75f9ad0bc594cabf on this PR. The title executable is unedited. ```json {"commit":"c547deaacb62","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TIME_SCALE":"0.1","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"1085:150"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"frames 1085:150","first_present":1085,"ms":418164.785},"presents":150,"frame_ms":{"p50":2711.721,"p90":3216.898,"p99":3992.038,"max":4422.742},"gpu_busy_ms_per_present":477.688,"worker_busy_pct":{"queue worker 0x0":99.931,"queue worker 0x20":99.869,"queue worker 0x28":99.746,"queue worker 0x30":99.799,"queue worker 0x38":82.472},"top_phases_ms_per_frame":{"Driver.Packet":13395.303,"Driver.Packet.memory_wait":9050.250,"Driver.Packet.dispatch":2341.595,"GpuMutex.wait.hook":2314.830,"Driver.Dispatch":2091.833,"Resources.Complete":1952.857,"Driver.Packet.draw":1763.494,"Driver.Draw":1762.767},"trace_dropped":false,"trace":"aps5-trace-c547deaacb62-2.json.gz"} ``` ```json {"commit":"dc1e7e5695ab","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TIME_SCALE":"0.1","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"1085:150"},"gpu":"NVIDIA GeForce RTX 3080","driver":"NVIDIA 615.78.08","os":"Linux 7.2.10-1-cachyos","cpu":"AMD Ryzen 9 7950X3D 16-Core Processor","cpu_threads":32,"memory_mib":63428,"title_id":"PPSA11386","title":"007 First Light","content_version":"01.018.000","resolution":"3840x2160","window":{"spec":"frames 1085:150","first_present":1085,"ms":436633.103},"presents":150,"frame_ms":{"p50":2882.072,"p90":3378.460,"p99":4499.485,"max":7033.048},"gpu_busy_ms_per_present":497.524,"worker_busy_pct":{"queue worker 0x0":99.946,"queue worker 0x20":99.900,"queue worker 0x28":99.815,"queue worker 0x38":82.658,"queue worker 0x30":99.844},"top_phases_ms_per_frame":{"Driver.Packet":13992.217,"Driver.Packet.memory_wait":9511.346,"GpuMutex.wait.hook":2578.339,"Driver.Packet.dispatch":2452.564,"Driver.Dispatch":2167.295,"Resources.Complete":2116.024,"Graphics.Draw":1816.352,"Driver.Packet.draw":1792.957},"trace_dropped":false,"trace":"aps5-trace-dc1e7e5695ab-2.json.gz"} ``` - Digests (`tools/trace_digest.py` output) and the two traces: pre-release https://github.com/SleglJan/AnyPS5/releases/tag/perf-traces-shader-column-memo on my fork, both files over the 25 MB attachment limit (31.7 and 32.4 MB), sha256 e44ae16fa69649761e15a3f5cd9a394f8089e4a51db7e34c59d2590ff518e6e5 (`main`) and 22b1ef75f9c6c30a4c75a5552866af2d790655ae1ede305a18e25a1f5e5d1fd7 (this PR). - `tools/performance_compare.py` on the lines: no configuration difference; this PR minus `main`: frame p50 +170 ms (+6.3 %), p90 +162 (+5.0 %), p99 +507 (+12.7 %), max +2,610 (+59 %), mean frame +123 (+4.4 %), GPU busy per present +20 (+4.2 %); one pair, one run per side. Highest `VmHWM` 24,371 against 25,134 MiB, both including the trace buffers (seven threads at 160 MiB each, 1,120 MiB, on both sides). - Harness validity, under both readings defined in the next bullet: both runs on route with no device faults; collapse cannot be judged on this switch set. Second reading: `main`'s run passes every check readable here (collapse is not readable; peak device memory used 9,550 MiB over the run, 9,042 MiB at the level load, every other figure under its limit), this change's run invalid: it peaks at 9,883 MiB at frame 1,036 (the level load, before the walk and outside the trace window), over our 9,850 MiB limit; its next-highest 1 s sample is 9,782 MiB at frame 1,248. First reading: both invalid, because the staging-shadow refusal lines count as unrecovered refusals there (`main` 2, its full count; this change 4, a lower bound, four prints per run at most). - The A/B on `main` c547deaacb with `APS5_PROFILE_DRAW=1` and `APS5_TRACE_SUMMARY_EVERY=60` (three alternated pairs, 2026-10-27 22:41 to 2026-10-28 03:00 CET, this change at f5cf0db16c, `main` at the PR's base c547deaacb while `main` itself was 32 merges past it, journals unequal, the cache and swap settings as above): walk presents per second under the first reading, declared before the series (any unrecovered allocation refusal invalid), n = 1 / 1, `main` 0.341 against this change 0.326; under the later reading, which counts staging-shadow refusal lines as handled and was declared after pair 1's results, which made both its runs invalid only through these lines, while pair 2's first run was running, n = 3 / 3, `main` 0.369 / 0.369 / 0.341 (mean 0.360) against this change 0.358 / 0.326 / 0.371 (mean 0.352); four of the six runs differ between the two readings, all on that line. `[recompile]` Populate 171 / 169 / 172 against 67 / 69 / 72 ms per frame. Highest `VmHWM` per run `main` 23,651 / 24,614 / 24,036 MiB, this change 24,460 / 25,557 / 23,802 MiB. The earlier alternated A/B, the same title and walk, measured before this rebase on a local base, not on `main`: upstream `main` 5357acd697 plus #5372 (squashed, with its 662a50bf7e change reverted) and #10423, plus local logging and scripted input, and the title's two feedback-wait limits widened in its executable as described in #6172 (local only). Both sides run with `APS5_WRITTEN_SHADOW_MAX_KIB=2048 APS5_NO_WRITTEN_SHADOW=1 APS5_PROFILE_DRAW=1` and a warm shader disk cache from a seed run per side; 2026-10-27, six pairs alternated base / this change, 20 minutes each, the same machine and session. - Our run validity rule of that day (a texture-cache admission streak taken as a storage-budget collapse) left this change with 1 valid run of 6 against 5 of 6 for the base, so that rule gives no verdict. No run of the series reached the 512 MiB storage floor, and the lowest storage budgets are equal (base 2,788-3,125 MiB, this change 2,858-3,127 MiB). One synchronous-present pair (`APS5_FLIP_INFLIGHT=0`) cut the held-entry difference between the sides from 2.09x to 1.29x and showed no streaks, an observation from one pair, with no cause read from it. - Second reading, declared after the first four runs, once the first flagged run had shown no slowdown in its streak window, and fixed before the other eight: a run invalid only through the streak counts as valid unless its storage budget reached 512 MiB or its longest streak window ran below 0.90 of its own walk rate; runs with host placements (the exhaustion rule) stay invalid. Base n = 5, this change n = 3. | | base | this change | |---|---|---| | walk, presents per second, second reading (base n = 5, this change n = 3) | 0.962 (0.933-0.989) | 1.073 (1.034-1.106) | | walk, presents per second, all six runs per side | 0.965 (0.933-0.989) | 1.087 (1.034-1.112) | | `Populate` ms per frame, all six | 157 (148-170) | 50 (48-51) | | GPU busy ms per frame, all six | 315 (311-317) | 313 (309-318) | | main menu, presents per second, all six | 3.37 (3.31-3.43) | 3.40 (3.37-3.49) | | title screen reached, s after start, all six | 117-118 | 117-118 | - Walk +11.5 % by the second reading's means and +12.6 % over all six runs per side; every run of this change is above every run of the base. The menus and the boot do not change: the memo's hits are in gameplay, where the big tables recur. - Column memo in gameplay: 93.1-93.2 % hits over the six runs of this change (125-132 hits per frame); in the verify run with `APS5_VERIFY_TABLE_COLUMN_MEMO=1`, 106,481 hits and 7,958 misses over 92 ten-second lines (93.0 %), 29,618 replayed resolutions re-resolved from their records, 0 mismatches. Every miss was a column whose content changed; the memo held 323-402 entries. - Level load, two quantities: the 1 s peak of device memory outside the texture caches (the local-base figures) and, for the `main` series, the 1 s peak of `nvidia-smi` memory used by all processes between the resume and frame 1,055, with the memory outside the texture caches read at the `[gpu]` budget line nearest that peak and the title's own device memory as the highest `nvidia-smi pmon` sample in that window. Local-base series: base 1,033-1,257 MiB against this change 1,206-2,528 MiB outside the caches, with first host placements in 3 of 6 runs against 1 of 6 (Fisher, one-sided, 0.27); the series had one seed per side (its own shader disk cache, frozen NVIDIA cache and journal) and the PR side loaded the smaller journal, so the cause there is not established. On `main` c547deaacb, each series in one session, `main` always from one seed, this change minus `main`: | series | journals | commit | 1 s peak of memory used, per pair (MiB) | outside the caches at the nearest budget line (MiB) | title's own device memory, pmon (MiB) | |---|---|---|---|---|---| | the A/B above, three pairs | unequal (this change 215 pipelines, `main` 175) | f5cf0db16c | +809 / +403 / +373 | not read | not read | | three pairs to frame 1,720, 2026-10-28 07:35-11:13 CET | shared (175 / 185 / 884.5 MiB) | f5cf0db16c | +83 / −434 / +118 | −147 / +89 / +1,888 (pair 3's `main` line 26 s from the peak) | −173 / −123 / −14 | | five pairs stopped at frame 1,100, 13:41-16:30 CET | shared | dc1e7e5695 | −214 / +445 / −77 / −541 / +133 | +109 / −187 / −511 / +257 / −62 (pair 5's `main` line 37 s from the peak) | +226 / +577 / +184 / +101 / +23 | | the capture pair above, trace switches, one run per side | shared | dc1e7e5695 | +841 (9,883 against 9,042) | −574 | −9 | Over the eight shared-journal pairs the means are `main` 9,321 against this change 9,260 MiB; without the three-pair series' pair 3 (its `main` run had six shader disk cache misses) 7 / 7, 9,384 against 9,298. Both groupings, 8 / 8 and 7 / 7, were declared before the five-pair series ran; both include that series' four runs which the same declaration's disk-cache rule makes invalid, and the declaration did not say how to treat them. The sign is not consistent across pairs; the one series with every pair higher on this change is the one with unequal journals. Four of the eight pairs have a run with 4 to 6 misses in the boot, none later (cause not chased); grouped after seeing the data, the four pairs without one give +445 / −541 / +83 / −434 MiB. Host placements by frame 1,055: `main` in 2 of its 8 shared-journal runs ([bufferpool] at least 3 in one, at least 1 in the other), this change in 3 of 8 ([gpu] at least 3 with [bufferpool] at least 1 in one, [bufferpool] at least 1 in each of the other two); the capture pair: this change [gpu] at least 8, `main` none. ### Checklist - [x] Based on current `main` (`main` f8f5b24b77 merged in at c5dcde982e, after the results above were posted); no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; silent stubs are listed in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none; related: #7223 (what the second to land changes, proposed there) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 3080, driver 615.78.08, CachyOS Linux 7.2.10 - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-27 18:37:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T18:37:55Z.

Review: CHANGES_REQUESTED


Reviewed exact head f5cf0db16c28ee4a7575c7cd1dda342fd01a9fe6 and the updated PR discussion. The implementation has a focused verify mode and reports zero mismatches in the supplied run, but the remaining validation and overlap questions are material for this shader-driver change.

The required performance report is still missing: the submitted A/B uses a local base with other PRs, local logging, and a modified title executable, and no aps5-summary.jsonl lines or trace pair/digest are attached. CONTRIBUTING.md requires captures from current main and this PR using the same title, scene, and machine, with the traces; the perf label workflow also requests both summary lines and tools/trace_digest.py output. The maintainer's request for a current-main A/B and max RSS is still unanswered with a compliant comparison. Please provide that evidence or remove the performance claim/label and resolve the maintainer's request explicitly.

There is also an exact merge conflict with open #7223 in ResourceMaterializer.cpp (git merge-tree --write-tree reports a content conflict). The description recognizes that nested-table support must be extended or excluded depending on order, but the checklist says Depends on: none. Please agree the order with #7223’s author, record the dependency/plan, and validate the combined behavior before merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5672446321 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12051#pullrequestreview-5672446321). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T18:37:55Z. **Review:** CHANGES_REQUESTED --- Reviewed exact head `f5cf0db16c28ee4a7575c7cd1dda342fd01a9fe6` and the updated PR discussion. The implementation has a focused verify mode and reports zero mismatches in the supplied run, but the remaining validation and overlap questions are material for this shader-driver change. The required performance report is still missing: the submitted A/B uses a local base with other PRs, local logging, and a modified title executable, and no `aps5-summary.jsonl` lines or trace pair/digest are attached. `CONTRIBUTING.md` requires captures from current `main` and this PR using the same title, scene, and machine, with the traces; the `perf` label workflow also requests both summary lines and `tools/trace_digest.py` output. The maintainer's request for a current-main A/B and max RSS is still unanswered with a compliant comparison. Please provide that evidence or remove the performance claim/label and resolve the maintainer's request explicitly. There is also an exact merge conflict with open #7223 in `ResourceMaterializer.cpp` (`git merge-tree --write-tree` reports a content conflict). The description recognizes that nested-table support must be extended or excluded depending on order, but the checklist says `Depends on: none`. Please agree the order with #7223’s author, record the dependency/plan, and validate the combined behavior before merge.
adriadam10 commented 2026-10-28 10:16:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-28T10:16:40Z.

Review: CHANGES_REQUESTED


Thanks for the verify mode and the exact content/usage comparison before a replay. Still open on this head:

  • Performance report (labeled perf, CONTRIBUTING): paste the aps5-summary.jsonl lines of a capture on current main and one with this change, same title, scene and machine, plus the tools/trace_digest.py output. The 007 A/B is on a local base (other PRs, local logging, a patched title executable), and its run-validity rule was changed after the first runs (1 valid run of 6 for this change), so it doesn't give a verdict.
  • Max RSS for both sides (the default budget allows 128 MiB of estimated host memory; docs/dev/ memory rules ask for the bound and peak RSS before/after on a big workload).
  • Device memory at the level load: memory outside the texture caches went from 1,033-1,257 MiB to 1,206-2,528 MiB, with host placements in 3 of 6 runs against 1 of 6. Please find the cause or show it is noise with more runs before this lands; a perf change that raises peak memory needs that settled.
  • The tests don't cover placement against earlier columns of the same resolution, eviction by budget/entry count, or the APS5_TABLE_COLUMN_MEMO_WORDS parsing; please add them.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5681024125 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12051#pullrequestreview-5681024125). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-28T10:16:40Z. **Review:** CHANGES_REQUESTED --- Thanks for the verify mode and the exact content/usage comparison before a replay. Still open on this head: - **Performance report** (labeled `perf`, CONTRIBUTING): paste the `aps5-summary.jsonl` lines of a capture on current `main` and one with this change, same title, scene and machine, plus the `tools/trace_digest.py` output. The 007 A/B is on a local base (other PRs, local logging, a patched title executable), and its run-validity rule was changed after the first runs (1 valid run of 6 for this change), so it doesn't give a verdict. - **Max RSS** for both sides (the default budget allows 128 MiB of estimated host memory; `docs/dev/` memory rules ask for the bound and peak RSS before/after on a big workload). - **Device memory at the level load**: memory outside the texture caches went from 1,033-1,257 MiB to 1,206-2,528 MiB, with host placements in 3 of 6 runs against 1 of 6. Please find the cause or show it is noise with more runs before this lands; a perf change that raises peak memory needs that settled. - The tests don't cover placement against earlier columns of the same resolution, eviction by budget/entry count, or the `APS5_TABLE_COLUMN_MEMO_WORDS` parsing; please add them.
adriadam10 commented 2026-10-28 17:50:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-28T17:50:52Z.

Review: CHANGES_REQUESTED


Thanks for the tests and the full report. The tests cover what was asked and the hash fix is right. What is still open is the case for the change itself:

  • No measured gain on main. Your own numbers: Populate drops 171 → 68 ms per frame, but frames are ~2.8 s and the A/B walk rate is 0.360 vs 0.352 presents/s (within spread). The only capture pair on main has this PR slower (p50 +6.3 %, p99 +12.7 %, max +59 %, GPU busy +4.2 %), one run per side. The +11.5 % figure was only on a local base. A perf PR needs a gain that reproduces on main: more capture pairs (or a scene where Populate is on the critical path) showing it beats the spread, not one pair against three.
  • Device memory at the level load is still unexplained. The capture pair peaks at 9,883 MiB against 9,042 MiB (+841 MiB, above your own 9,850 MiB limit) with host placements only on this side; the shared-journal series is mixed in sign. Please show with more pairs that it is noise, or find the cause.
  • Cost vs benefit. The change adds a ~570-line memo in ResourceMaterializer.cpp, a 128 MiB host budget, 4 env switches (APS5_NO_TABLE_COLUMN_MEMO, APS5_VERIFY_TABLE_COLUMN_MEMO, APS5_TABLE_COLUMN_MEMO_DIAG, APS5_TABLE_COLUMN_MEMO_WORDS) and 22 ctest entries. Without a frame-time gain that is not justified; if you can't show one, please close this or reduce it to what pays for itself.
  • Retitling without perf doesn't change this: the memory and complexity cost needs a benefit that is measured.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5687236458 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12051#pullrequestreview-5687236458). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-28T17:50:52Z. **Review:** CHANGES_REQUESTED --- Thanks for the tests and the full report. The tests cover what was asked and the hash fix is right. What is still open is the case for the change itself: - **No measured gain on `main`.** Your own numbers: Populate drops 171 → 68 ms per frame, but frames are ~2.8 s and the A/B walk rate is 0.360 vs 0.352 presents/s (within spread). The only capture pair on `main` has this PR slower (p50 +6.3 %, p99 +12.7 %, max +59 %, GPU busy +4.2 %), one run per side. The +11.5 % figure was only on a local base. A `perf` PR needs a gain that reproduces on `main`: more capture pairs (or a scene where Populate is on the critical path) showing it beats the spread, not one pair against three. - **Device memory at the level load is still unexplained.** The capture pair peaks at 9,883 MiB against 9,042 MiB (+841 MiB, above your own 9,850 MiB limit) with host placements only on this side; the shared-journal series is mixed in sign. Please show with more pairs that it is noise, or find the cause. - **Cost vs benefit.** The change adds a ~570-line memo in `ResourceMaterializer.cpp`, a 128 MiB host budget, 4 env switches (`APS5_NO_TABLE_COLUMN_MEMO`, `APS5_VERIFY_TABLE_COLUMN_MEMO`, `APS5_TABLE_COLUMN_MEMO_DIAG`, `APS5_TABLE_COLUMN_MEMO_WORDS`) and 22 ctest entries. Without a frame-time gain that is not justified; if you can't show one, please close this or reduce it to what pays for itself. - Retitling without `perf` doesn't change this: the memory and complexity cost needs a benefit that is measured.

Pull request closed

Sign in to join this conversation.
No reviewers
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!12051
No description provided.