fix(shader): bound the bytes the recompiler's result memos hold #9989

Merged
milescoviello merged 1 commit from upstream-pr/9989 into main 2026-10-26 14:23:49 +00:00
milescoviello commented 2026-10-23 02:56:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-23T02:56:38Z.


What

Every shader source keeps up to 256 materialized results of Recompile(request, capture) in its result memo (64 sets of 4), with no limit on their bytes. A result's bindings carry about twenty vectors each, sized by the descriptor counts, so with large image tables one result can hold tens of KiB. In Ghost of Tsushima Director's Cut (PPSA02225), whose opening runs into the 20 GiB memory cap on my host, the memos held 470 to 575 MiB after 5 minutes and kept growing, at a hit rate of about 13 %.

This bounds the bytes all memos hold together.

How

  • Each memo entry records the bytes its result keeps: the result's own vectors and each binding's vectors (bit vectors as bits). The module isn't counted, because the prepared module cache shares it.
  • Both of a source's tables count: the result memo and #10423's masked memo. A masked entry also counts its patch recipe. A result held by both tables counts once in each, so the count errs high.
  • The recency stamps come from one clock for all sources instead of one per source, so entries of different sources compare.
  • After an insert pushes the held bytes over the budget, the least recently used entries of both tables of all sources are dropped until three quarters of the budget is left. Memos register in a list of sources when created, and the trim reads it under its own lock. Trims serialize on one blocking lock, and a trim reads the held bytes again after each pass until they are within the budget, so results that other threads insert while it runs are trimmed too.
  • The budget is 256 MiB unless APS5_RESULT_MEMO_MB sets another; 0 sets none. APS5_RESULT_MEMO_MB is neutral for the disk cache key, since it doesn't change any result.
  • APS5_PROFILE_DRAW's [recompile] result memo line now also reports trimmed results and the results and MiB held.
  • SetResultMemoBudget and ResultMemoBytes let the new tests set a budget and read the bytes held. SetResultMemoTrimHook sets a one-shot function that the trim calls right after it reads the held bytes, so a test can insert from other threads at exactly that point.
  • #9049 changes the same miss path: it takes the set's least recently used entry out to reuse its bindings. The two merge without conflicts, but whichever lands second should subtract the taken entry's bytes where #9049 empties the slot, or the held bytes drift upward.

Tested

  • Current head 8868e09624, rebased onto main 442c43a574. #10423 landed first, so this head counts and trims its masked memo as well (one commit now). Linux (Ubuntu 26.04.1, GCC 15.2, Release, RTX 4070 Ti, 615.71.09):
    • The 37 ^agc_shader_ tests pass 3 of 3, including the three budget tests and #10423's agc_shader_table_snapshot_reuse/_unmasked.
    • The two exact budget tests run with APS5_NO_MASKED_RESULT_MEMO=1. The new agc_shader_result_memo_budget_masked runs with the masked memo on. It checks that a first result counts its masked entry too, and that a trim to one byte empties both tables, so the next result is a full one, not a patched one.
    • Mutant: a trim that skips the masked table fails it with a trim to one byte left 620 bytes.
    • Khronos validation 1.4.363 over the same set: 34 of 34 on main 442c43a574 and 37 of 37 on this head, no layer missing, no VUID- messages on either.
    • Windows 11 VM (GT 1030, driver 582.78, WinLibs GCC 15.2.0 r7): 41 of 41 pass 3 of 3 on main and 44 of 44 pass 3 of 3 on this head.
  • Persona 5 Royal (PPSA05110) on this head (thuanquang, Windows 11, RX 6700 XT, WinLibs GCC 15.2.0 r7, Release, main 73ad397dba plus #10887, #10614, #10913 and #7844 with this PR merged). Three runs, each 780 s into the first gameplay scene, with private bytes sampled from outside the process:
    • No budget (APS5_RESULT_MEMO_MB=0, main's behaviour): 19,408 / 19,416 MiB at 500 / 700 s, peak 18.99 GiB.
    • This PR's default, 256 MiB: 18,652 / 18,680 MiB, peak 18.25 GiB.
    • Memos off (APS5_NO_RESULT_MEMO=1): 18,512 / 18,514 MiB, peak 17.98 GiB.
    • So the memos hold about 900 MiB there without a budget and about 150 MiB with the default one, and the budget saves about 0.74 GiB of private memory. The runs shared the GPU with other work, so frame rates aren't compared.
  • Earlier head dbec127257, rebased onto main 5e6ae6e3d0 (include list conflict in Recompiler.hpp, both kept). Linux (Ubuntu 26.04.1, GCC 15.2, Release, RTX 4070 Ti, 615.71.09): the 44 tests matching ^agc_shader_result_memo_budget|^agc_shader_memory$|^agc_shader_|^request_serializer$|shader_disk_cache|^agc_driver_graphics$|image_table pass 3 of 3. Khronos layer 1.4.363 on that set: main 42 of 42, this head 44 of 44, no VUID on either side. Windows 11 VM (GT 1030, 582.66): main 6 of 6 and this head 8 of 8 of the memo, shader memory, serializer and disk cache tests, 3 of 3.

Ubuntu 26.04.1, GCC 15.2, NVIDIA RTX 4070 Ti (615.71.09).

Rebased onto main 0a0ed72167 as 59700b2200. git range-diff shows both commits unchanged. The tests below marked "this head" ran on it.

Ghost of Tsushima Director's Cut (PPSA02225). Main can't take this title past its first minutes, so these runs use @EagleBearerYS's test/ghost-9742-9717 stack with #8115, #8121, #8213, #8608 and #9318, and this change applied with no budget unless APS5_RESULT_MEMO_MB set one. Each run is 300 s warm, journal replay off, 20 GiB cap. Results and MiB are the memo line at the end of each run; hits are its last 10 s.

run budget results held MiB held hits RssAnon at 290 s
P none 11,407 473 12.7 % 5,103 MB
U2 none 11,516 550 12.7 % 5,240 MB
P2 none 11,513 489 12.7 % 4,756 MB
B 256 MiB 11,339 235 13.1 % 4,364 MB
N memo off (APS5_NO_RESULT_MEMO=1) 4,621 MB

The budget halves the memo's bytes without changing its hit rate. The number of results held barely changes, so the trimmed least recently used results are the large ones. RssAnon varies by a few hundred MB between identical runs here, so the memo's own count is the measure.

The Last of Us Part I (PPSA03396), from @Pacuka (comment): CachyOS, RX 6650 XT, 32 GB. Without this change, the process's anonymous memory grew about 1 GiB every 10 s, until the host ran out of RAM and swap and a dispatch failed with std::bad_alloc after 1.5 to 5 minutes. An allocation tracker put the never-freed bytes under materializePreparedMemoized: 962 MiB of DescriptorBindingBuilder::Populate vector copies and 410 MiB under materializeResult after 2 minutes. APS5_NO_RESULT_MEMO=1 stopped the growth. With this PR's two commits, anonymous memory stayed between 2 and 4 GiB through a 7-minute run with no failure.

Forspoken (PPSA03984), on main 895f47f4ee with this change (an earlier head with the same code), 300 s, 16 GiB cap. Hits are over the whole run:

run budget hits trimmed results held MiB held
cold none (APS5_RESULT_MEMO_MB=0) 10.2 % 0 44,387 223
warm 256 MiB 11.0 % 11,819 43,883 221

Here the memo stays near the budget, and trimming doesn't cost hits.

Two later warm runs of that build, one with the budget off, lost the device at 161 s (VK_ERROR_DEVICE_LOST in vkWaitForFences). With the budget off this change only counts bytes, and the eviction order within a set is the same as main's. In a second set of runs past that point, 4 of this build (1 cold and 3 warm, budget off) and 5 of main at the same base (1 cold and 4 warm) all ran without a device loss. I read it as a fault of that GPU session and mention it in case anyone sees it again.

Tests

  • New agc_shader_result_memo_budget (tests/ShaderMemory.cpp, CPU only): a pixel program that reads its user data, compiled through Recompile(request, capture) with four user data values. With a budget of three results, a fourth is trimmed. The memo stays within the budget after every insert, the two most recently used results still hit, and the oldest misses. Clearing the budget lets the memo grow past it again.
  • New agc_shader_result_memo_budget_threads (CPU only), for the race @MarcZX10 described: with three results in a budget of three, the test inserts a fourth, and the trim hook starts two threads that each insert one more. The hook waits until both insertions are counted, so they land after the running trim has read the held bytes. The test then checks that the memo ends within its budget.
    • With the earlier try_to_lock trim (the threads skip their own trims, and the running trim works from the count it read before them), it fails 10 of 10: "results inserted during a trim left the memo over its budget".
    • With this head's trim it passes 20 of 20, together with agc_shader_result_memo_budget, on 59700b2200 and before the rebase on 2fb7fb6e57.
  • The 42 tests matching ^agc_shader_result_memo_budget|^agc_shader_memory$|^agc_shader_|^request_serializer$|shader_disk_cache|^agc_driver_graphics$|image_table pass 3 of 3 on this head (41 before the rebase, on 2fb7fb6e57).
  • Khronos validation layer 1.4.363, main 0a0ed72167 against this head over ^agc_driver_graphics$|image_table|^agc_driver_prepared (34 tests each): both pass, and both report only main's VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (x14, which #7985 fixes). Nothing is new in this branch.
  • tools/env_reference.py --check finds the new row. Its one remaining error, APS5_NO_WGI, is undocumented on main too.
  • With the trim disabled (an early return in trimResultMemo), agc_shader_result_memo_budget fails 3 of 3: "the memo holds more than its budget".
  • Windows 11 VM (GeForce GT 1030, NVIDIA R580, WinLibs GCC, Release, ANYPS5_REQUIRE_VULKAN=1): the 7 tests matching ^agc_shader_result_memo_budget$|^agc_shader_memory$|^request_serializer$|shader_disk_cache pass 3 of 3 on the first head of this branch. On this head, the 8 tests matching ^agc_shader_result_memo_budget|^agc_shader_memory$|^request_serializer$|shader_disk_cache, agc_shader_result_memo_budget_threads among them, pass 3 of 3. The 6 of them that exist on main pass there too, at main 0a0ed72167.

Checklist

  • Based on current main; no other open PR implements the same functions (#9049 changes the same miss path in materializePreparedMemoized to reuse an evicted result's bindings; see Overlap)
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA RTX 4070 Ti (Linux); the new test runs on the CPU; AMD Radeon RX 6650 XT, RADV, CachyOS (@Pacuka)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4977123888 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9989). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-23T02:56:38Z. --- ### What Every shader source keeps up to 256 materialized results of `Recompile(request, capture)` in its result memo (64 sets of 4), with no limit on their bytes. A result's bindings carry about twenty vectors each, sized by the descriptor counts, so with large image tables one result can hold tens of KiB. In Ghost of Tsushima Director's Cut (PPSA02225), whose opening runs into the 20 GiB memory cap on my host, the memos held 470 to 575 MiB after 5 minutes and kept growing, at a hit rate of about 13 %. This bounds the bytes all memos hold together. ### How - Each memo entry records the bytes its result keeps: the result's own vectors and each binding's vectors (bit vectors as bits). The module isn't counted, because the prepared module cache shares it. - Both of a source's tables count: the result memo and #10423's masked memo. A masked entry also counts its patch recipe. A result held by both tables counts once in each, so the count errs high. - The recency stamps come from one clock for all sources instead of one per source, so entries of different sources compare. - After an insert pushes the held bytes over the budget, the least recently used entries of both tables of all sources are dropped until three quarters of the budget is left. Memos register in a list of sources when created, and the trim reads it under its own lock. Trims serialize on one blocking lock, and a trim reads the held bytes again after each pass until they are within the budget, so results that other threads insert while it runs are trimmed too. - The budget is 256 MiB unless `APS5_RESULT_MEMO_MB` sets another; 0 sets none. `APS5_RESULT_MEMO_MB` is neutral for the disk cache key, since it doesn't change any result. - `APS5_PROFILE_DRAW`'s `[recompile] result memo` line now also reports trimmed results and the results and MiB held. - `SetResultMemoBudget` and `ResultMemoBytes` let the new tests set a budget and read the bytes held. `SetResultMemoTrimHook` sets a one-shot function that the trim calls right after it reads the held bytes, so a test can insert from other threads at exactly that point. - #9049 changes the same miss path: it takes the set's least recently used entry out to reuse its bindings. The two merge without conflicts, but whichever lands second should subtract the taken entry's bytes where #9049 empties the slot, or the held bytes drift upward. ### Tested - **Current head** `8868e09624`, rebased onto `main` 442c43a574. #10423 landed first, so this head counts and trims its masked memo as well (one commit now). Linux (Ubuntu 26.04.1, GCC 15.2, Release, RTX 4070 Ti, 615.71.09): - The 37 `^agc_shader_` tests pass 3 of 3, including the three budget tests and #10423's `agc_shader_table_snapshot_reuse`/`_unmasked`. - The two exact budget tests run with `APS5_NO_MASKED_RESULT_MEMO=1`. The new `agc_shader_result_memo_budget_masked` runs with the masked memo on. It checks that a first result counts its masked entry too, and that a trim to one byte empties both tables, so the next result is a full one, not a patched one. - **Mutant:** a trim that skips the masked table fails it with `a trim to one byte left 620 bytes`. - **Khronos validation** 1.4.363 over the same set: 34 of 34 on `main` 442c43a574 and 37 of 37 on this head, no layer missing, no `VUID-` messages on either. - **Windows 11 VM** (GT 1030, driver 582.78, WinLibs GCC 15.2.0 r7): 41 of 41 pass 3 of 3 on `main` and 44 of 44 pass 3 of 3 on this head. - **Persona 5 Royal (PPSA05110)** on this head ([thuanquang](https://github.com/boykopovar/AnyPS5/pull/9989#issuecomment-6409580567), Windows 11, RX 6700 XT, WinLibs GCC 15.2.0 r7, Release, `main` 73ad397dba plus #10887, #10614, #10913 and #7844 with this PR merged). Three runs, each 780 s into the first gameplay scene, with private bytes sampled from outside the process: - No budget (`APS5_RESULT_MEMO_MB=0`, `main`'s behaviour): 19,408 / 19,416 MiB at 500 / 700 s, peak 18.99 GiB. - This PR's default, 256 MiB: 18,652 / 18,680 MiB, peak 18.25 GiB. - Memos off (`APS5_NO_RESULT_MEMO=1`): 18,512 / 18,514 MiB, peak 17.98 GiB. - So the memos hold about 900 MiB there without a budget and about 150 MiB with the default one, and the budget saves about 0.74 GiB of private memory. The runs shared the GPU with other work, so frame rates aren't compared. - **Earlier head** `dbec127257`, rebased onto `main` 5e6ae6e3d0 (include list conflict in `Recompiler.hpp`, both kept). Linux (Ubuntu 26.04.1, GCC 15.2, Release, RTX 4070 Ti, 615.71.09): the 44 tests matching `^agc_shader_result_memo_budget|^agc_shader_memory$|^agc_shader_|^request_serializer$|shader_disk_cache|^agc_driver_graphics$|image_table` pass 3 of 3. Khronos layer 1.4.363 on that set: `main` 42 of 42, this head 44 of 44, no VUID on either side. Windows 11 VM (GT 1030, 582.66): `main` 6 of 6 and this head 8 of 8 of the memo, shader memory, serializer and disk cache tests, 3 of 3. Ubuntu 26.04.1, GCC 15.2, NVIDIA RTX 4070 Ti (615.71.09). **Rebased** onto `main` 0a0ed72167 as `59700b2200`. `git range-diff` shows both commits unchanged. The tests below marked "this head" ran on it. **Ghost of Tsushima Director's Cut (PPSA02225).** Main can't take this title past its first minutes, so these runs use @EagleBearerYS's `test/ghost-9742-9717` stack with #8115, #8121, #8213, #8608 and #9318, and this change applied with no budget unless `APS5_RESULT_MEMO_MB` set one. Each run is 300 s warm, journal replay off, 20 GiB cap. Results and MiB are the memo line at the end of each run; hits are its last 10 s. | run | budget | results held | MiB held | hits | RssAnon at 290 s | |---|---|---|---|---|---| | P | none | 11,407 | 473 | 12.7 % | 5,103 MB | | U2 | none | 11,516 | 550 | 12.7 % | 5,240 MB | | P2 | none | 11,513 | 489 | 12.7 % | 4,756 MB | | B | 256 MiB | 11,339 | 235 | 13.1 % | 4,364 MB | | N | memo off (`APS5_NO_RESULT_MEMO=1`) | | | | 4,621 MB | The budget halves the memo's bytes without changing its hit rate. The number of results held barely changes, so the trimmed least recently used results are the large ones. RssAnon varies by a few hundred MB between identical runs here, so the memo's own count is the measure. **The Last of Us Part I (PPSA03396)**, from @Pacuka ([comment](https://github.com/boykopovar/AnyPS5/pull/9989#issuecomment-6365625951)): CachyOS, RX 6650 XT, 32 GB. Without this change, the process's anonymous memory grew about 1 GiB every 10 s, until the host ran out of RAM and swap and a dispatch failed with `std::bad_alloc` after 1.5 to 5 minutes. An allocation tracker put the never-freed bytes under `materializePreparedMemoized`: 962 MiB of `DescriptorBindingBuilder::Populate` vector copies and 410 MiB under `materializeResult` after 2 minutes. `APS5_NO_RESULT_MEMO=1` stopped the growth. With this PR's two commits, anonymous memory stayed between 2 and 4 GiB through a 7-minute run with no failure. **Forspoken (PPSA03984)**, on `main` 895f47f4ee with this change (an earlier head with the same code), 300 s, 16 GiB cap. Hits are over the whole run: | run | budget | hits | trimmed | results held | MiB held | |---|---|---|---|---|---| | cold | none (`APS5_RESULT_MEMO_MB=0`) | 10.2 % | 0 | 44,387 | 223 | | warm | 256 MiB | 11.0 % | 11,819 | 43,883 | 221 | Here the memo stays near the budget, and trimming doesn't cost hits. Two later warm runs of that build, one with the budget off, lost the device at 161 s (`VK_ERROR_DEVICE_LOST` in `vkWaitForFences`). With the budget off this change only counts bytes, and the eviction order within a set is the same as `main`'s. In a second set of runs past that point, 4 of this build (1 cold and 3 warm, budget off) and 5 of `main` at the same base (1 cold and 4 warm) all ran without a device loss. I read it as a fault of that GPU session and mention it in case anyone sees it again. **Tests** - New `agc_shader_result_memo_budget` (`tests/ShaderMemory.cpp`, CPU only): a pixel program that reads its user data, compiled through `Recompile(request, capture)` with four user data values. With a budget of three results, a fourth is trimmed. The memo stays within the budget after every insert, the two most recently used results still hit, and the oldest misses. Clearing the budget lets the memo grow past it again. - New `agc_shader_result_memo_budget_threads` (CPU only), for the race @MarcZX10 described: with three results in a budget of three, the test inserts a fourth, and the trim hook starts two threads that each insert one more. The hook waits until both insertions are counted, so they land after the running trim has read the held bytes. The test then checks that the memo ends within its budget. - With the earlier `try_to_lock` trim (the threads skip their own trims, and the running trim works from the count it read before them), it fails 10 of 10: "results inserted during a trim left the memo over its budget". - With this head's trim it passes 20 of 20, together with `agc_shader_result_memo_budget`, on `59700b2200` and before the rebase on `2fb7fb6e57`. - The 42 tests matching `^agc_shader_result_memo_budget|^agc_shader_memory$|^agc_shader_|^request_serializer$|shader_disk_cache|^agc_driver_graphics$|image_table` pass 3 of 3 on this head (41 before the rebase, on `2fb7fb6e57`). - Khronos validation layer 1.4.363, `main` 0a0ed72167 against this head over `^agc_driver_graphics$|image_table|^agc_driver_prepared` (34 tests each): both pass, and both report only `main`'s `VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605` (x14, which #7985 fixes). Nothing is new in this branch. - `tools/env_reference.py --check` finds the new row. Its one remaining error, `APS5_NO_WGI`, is undocumented on `main` too. - With the trim disabled (an early return in `trimResultMemo`), `agc_shader_result_memo_budget` fails 3 of 3: "the memo holds more than its budget". - Windows 11 VM (GeForce GT 1030, NVIDIA R580, WinLibs GCC, Release, `ANYPS5_REQUIRE_VULKAN=1`): the 7 tests matching `^agc_shader_result_memo_budget$|^agc_shader_memory$|^request_serializer$|shader_disk_cache` pass 3 of 3 on the first head of this branch. On this head, the 8 tests matching `^agc_shader_result_memo_budget|^agc_shader_memory$|^request_serializer$|shader_disk_cache`, `agc_shader_result_memo_budget_threads` among them, pass 3 of 3. The 6 of them that exist on `main` pass there too, at `main` 0a0ed72167. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions (#9049 changes the same miss path in `materializePreparedMemoized` to reuse an evicted result's bindings; see Overlap) - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA RTX 4070 Ti (Linux); the new test runs on the CPU; AMD Radeon RX 6650 XT, RADV, CachyOS (@Pacuka) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-23 03:26:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T03:26:58Z.

Review: CHANGES_REQUESTED


The global result memo budget can remain exceeded after concurrent insertions. trimResultMemo uses try_to_lock; when another trim owns the mutex, this call returns without trimming or recording pending work. If the holder sampled heldBytes before the concurrent insertion, it may trim only to 75% of the earlier value and exit, leaving the new bytes over budget indefinitely if no later insertion occurs. Please serialize/retry/schedule the trim and add a focused concurrent regression test. I posted the detailed interleaving in the PR discussion. Existing reported single-threaded tests and GPU measurements are useful but do not exercise this case; I could not rerun locally because the build failed on an unrelated object with / out of space.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5623543589 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9989#pullrequestreview-5623543589). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T03:26:58Z. **Review:** CHANGES_REQUESTED --- The global result memo budget can remain exceeded after concurrent insertions. `trimResultMemo` uses `try_to_lock`; when another trim owns the mutex, this call returns without trimming or recording pending work. If the holder sampled `heldBytes` before the concurrent insertion, it may trim only to 75% of the earlier value and exit, leaving the new bytes over budget indefinitely if no later insertion occurs. Please serialize/retry/schedule the trim and add a focused concurrent regression test. I posted the detailed interleaving in the PR discussion. Existing reported single-threaded tests and GPU measurements are useful but do not exercise this case; I could not rerun locally because the build failed on an unrelated object with `/` out of space.
MarcZX10 commented 2026-10-23 04:12:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T04:12:06Z.

Review: APPROVED


Re-reviewed exact head 95955a6b4561eb70c6acef5cfa199d76c06942aa against current main 9d6adeb550. The concurrency issue from my earlier review is addressed: trimming now serializes on a blocking mutex, reloads the global held-byte count until it is within budget, and includes a separate eight-thread regression test registered with CTest. I also checked that the new test has its own registration and is included in the Windows runtime-path properties.

I reran the convention check against current main, the 172-script registration check, and git diff --check; all pass. I could not run the C++ budget tests locally because this workspace has no configured AnyPS5 build or test executable. The PR reports the focused CPU tests, including the concurrent budget case, passing on Linux and Windows; hosted product build jobs are skipped by repository policy.

The description calls out the remaining integration point with open #9049: if that reuse change lands after this PR, its slot removal must also update the byte/entry counters. The current branch is mergeable and the same-function overlap scan found no duplicate implementation. With that integration detail recorded and the earlier concurrency finding resolved, I found no blocking issue on this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5623791413 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9989#pullrequestreview-5623791413). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T04:12:06Z. **Review:** APPROVED --- Re-reviewed exact head 95955a6b4561eb70c6acef5cfa199d76c06942aa against current main 9d6adeb5500c6b65e6591bc8e0a3c71b38c4b3e9. The concurrency issue from my earlier review is addressed: trimming now serializes on a blocking mutex, reloads the global held-byte count until it is within budget, and includes a separate eight-thread regression test registered with CTest. I also checked that the new test has its own registration and is included in the Windows runtime-path properties. I reran the convention check against current main, the 172-script registration check, and `git diff --check`; all pass. I could not run the C++ budget tests locally because this workspace has no configured AnyPS5 build or test executable. The PR reports the focused CPU tests, including the concurrent budget case, passing on Linux and Windows; hosted product build jobs are skipped by repository policy. The description calls out the remaining integration point with open #9049: if that reuse change lands after this PR, its slot removal must also update the byte/entry counters. The current branch is mergeable and the same-function overlap scan found no duplicate implementation. With that integration detail recorded and the earlier concurrency finding resolved, I found no blocking issue on this head.
MarcZX10 commented 2026-10-23 05:57:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T05:57:11Z.

Review: CHANGES_REQUESTED


The author’s follow-up establishes that the current eight-thread test passes with both the new and old trim implementation, so it does not detect the reported race. The proposed deterministic race test on fix/result-memo-budget-race-test is described as 10/10 failures with the old trim and 20/20 passes with the new one, which directly covers the missing regression case. Please add that test (or an equivalent committed red/green test) to this PR and rerun the focused 41-test suite. The current head is still clean against main and policy checks pass, but I’m withdrawing my earlier approval until the committed test distinguishes the fix from the old behavior.

AI-assisted review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5624483852 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9989#pullrequestreview-5624483852). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T05:57:11Z. **Review:** CHANGES_REQUESTED --- The author’s follow-up establishes that the current eight-thread test passes with both the new and old trim implementation, so it does not detect the reported race. The proposed deterministic race test on `fix/result-memo-budget-race-test` is described as 10/10 failures with the old trim and 20/20 passes with the new one, which directly covers the missing regression case. Please add that test (or an equivalent committed red/green test) to this PR and rerun the focused 41-test suite. The current head is still clean against main and policy checks pass, but I’m withdrawing my earlier approval until the committed test distinguishes the fix from the old behavior. AI-assisted review.
MarcZX10 commented 2026-10-23 06:29:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T06:29:49Z.

Review: DISMISSED


Re-reviewed exact head 2fb7fb6e57db6751f3815732022a8f2ce08dcaac. The prior race concern is addressed in the committed test: the trim hook starts two inserts after the active trim sampled heldBytes, waits for their accounting, then the test asserts the completed trim is within budget. The description reports the old implementation failing 10/10 and this implementation passing 20/20, plus the focused 41-test Linux suite and Windows focused tests. The implementation holds a blocking trim mutex and reloads the byte count after each eviction pass, matching the tested race.

I also ran the exact-head convention check and git diff --check; both pass. check_main_sync.py reports a clean merge, but this head is 2 commits ahead and 138 behind current upstream/main (bd4906d7), with both branches changing Recompiler.cpp, Recompiler.hpp, ShaderDiskCache.cpp, the AGC CMake registrations and ENVIRONMENT.md. The intervening main changes include recompiler fixes and new tests in those shared files. Please rebase this branch onto current main, resolve the shared-file changes, and rerun the focused result-memo tests and the matched Vulkan validation checks on the resulting main/head pair. Until those checks cover the current base, I can’t approve this stale snapshot. This is a current-base and validation request; the previously reported race itself is resolved.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5624730433 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9989#pullrequestreview-5624730433). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T06:29:49Z. **Review:** DISMISSED --- Re-reviewed exact head `2fb7fb6e57db6751f3815732022a8f2ce08dcaac`. The prior race concern is addressed in the committed test: the trim hook starts two inserts after the active trim sampled `heldBytes`, waits for their accounting, then the test asserts the completed trim is within budget. The description reports the old implementation failing 10/10 and this implementation passing 20/20, plus the focused 41-test Linux suite and Windows focused tests. The implementation holds a blocking trim mutex and reloads the byte count after each eviction pass, matching the tested race. I also ran the exact-head convention check and `git diff --check`; both pass. `check_main_sync.py` reports a clean merge, but this head is 2 commits ahead and 138 behind current `upstream/main` (`bd4906d7`), with both branches changing `Recompiler.cpp`, `Recompiler.hpp`, `ShaderDiskCache.cpp`, the AGC CMake registrations and `ENVIRONMENT.md`. The intervening main changes include recompiler fixes and new tests in those shared files. Please rebase this branch onto current main, resolve the shared-file changes, and rerun the focused result-memo tests and the matched Vulkan validation checks on the resulting main/head pair. Until those checks cover the current base, I can’t approve this stale snapshot. This is a current-base and validation request; the previously reported race itself is resolved.
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!9989
No description provided.