fix(agc): bound a journal replay's graphics and compute pipelines apart #8542

Merged
milescoviello merged 1 commit from upstream-pr/8542 into main 2026-11-02 07:56:52 +00:00
milescoviello commented 2026-10-20 15:52:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T15:52:58Z.


What

A journal replay keeps the last APS5_PIPELINE_JOURNAL_ENTRIES entries (4096) of the loaded journal, the newest since #9836. That bound is there for the graphics pipeline store, which #9401 sizes to the title's working set. But the replay counts compute entries against it too, and truncates silently. So in a title that records both kinds, compute pipelines take graphics slots, and whatever the bound cuts goes unreported.

This PR applies APS5_PIPELINE_JOURNAL_ENTRIES (4096) to graphics entries only. Compute entries count separately against a new APS5_PIPELINE_JOURNAL_COMPUTE_ENTRIES (1024), as agreed earlier in this thread. Each kind keeps its newest entries, as #9836 does for both together, and the recorded order is kept. When a replay leaves entries out, it says so, for example:

[pipeline-journal] replaying the newest 4096 of 5300 graphics and 1024 of 1100 compute pipelines (APS5_PIPELINE_JOURNAL_ENTRIES, APS5_PIPELINE_JOURNAL_COMPUTE_ENTRIES)

ENVIRONMENT.md documents the new variable, and the journal debt entry names both bounds. The record format doesn't change, so the journal keeps #8365's format number.

Why

@SleglJan found this with #8365. On PPSA11386, the default-cap seed held 1,322 entries: 628 graphics, 694 compute and their modules. The warm run replayed exactly the first 1,024 (481 graphics, 526 compute, 17 already present), and the load line still said 1,322.

Tested

Restacked onto main 77d536fb38, which now has #8365, as ee0d52b98f; it also merges cleanly with current main 31c727f622. The change is the same commit, replayed alone. The per-kind test from before is unchanged.

Linux (Ubuntu 26.04.1, GCC 15.2), RTX 4070 Ti (NVIDIA 615.71.09), Release: ctest -R pipeline_journal (agc_driver_pipeline_journal, which holds the per-kind replays, agc_pipeline_journal and _long_paths) passes 3 of 3 on ee0d52b98f.

Khronos validation (VK_LAYER_KHRONOS_validation 1.4.363, LunarG SDK) over the same 3 tests, on the base 77d536fb38 and on ee0d52b98f: 3 of 3 pass on each, the tests created 17 and 20 Vulkan devices that the layer checked, and there is no VUID- message on either side.

Windows 11 VM (GT 1030, R580, WinLibs GCC 15.2.0, Release): agc_driver_pipeline_journal (the per-kind replays), agc_pipeline_journal, _long_paths and _extended_paths pass 3 of 3 on the base 77d536fb38 and 3 of 3 on ee0d52b98f.

Earlier results, on the heads named in them (before the restack):

  • Mutants with this PR's tests: main's single newest bound fails 3 of 3 on the bounded-replay case (a replay bounded to 1 graphics and the default compute entries replayed 1 graphics and 0 compute pipelines). A bound that keeps the first entries of each kind fails 3 of 3 in the newest-entries test.
  • @bunbeans2-arch's RX 9070 XT run on Windows of cb2ba99693.

Not tested: a title run.

Checklist

  • Based on current main; 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 (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 (#8365, #9836 and #9401 are merged)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 615.71.09, Ubuntu 26.04; NVIDIA GeForce GT 1030, R580, Windows 11
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4938483346 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8542). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-20T15:52:58Z. --- ### What A journal replay keeps the last `APS5_PIPELINE_JOURNAL_ENTRIES` entries (4096) of the loaded journal, the newest since #9836. That bound is there for the graphics pipeline store, which #9401 sizes to the title's working set. But the replay counts compute entries against it too, and truncates silently. So in a title that records both kinds, compute pipelines take graphics slots, and whatever the bound cuts goes unreported. This PR applies `APS5_PIPELINE_JOURNAL_ENTRIES` (4096) to graphics entries only. Compute entries count separately against a new `APS5_PIPELINE_JOURNAL_COMPUTE_ENTRIES` (1024), as agreed earlier in this thread. Each kind keeps its newest entries, as #9836 does for both together, and the recorded order is kept. When a replay leaves entries out, it says so, for example: ``` [pipeline-journal] replaying the newest 4096 of 5300 graphics and 1024 of 1100 compute pipelines (APS5_PIPELINE_JOURNAL_ENTRIES, APS5_PIPELINE_JOURNAL_COMPUTE_ENTRIES) ``` `ENVIRONMENT.md` documents the new variable, and the journal debt entry names both bounds. The record format doesn't change, so the journal keeps #8365's format number. ### Why @SleglJan [found this](https://github.com/boykopovar/AnyPS5/pull/8365#issuecomment-6294841262) with #8365. On PPSA11386, the default-cap seed held 1,322 entries: 628 graphics, 694 compute and their modules. The warm run replayed exactly the first 1,024 (481 graphics, 526 compute, 17 already present), and the load line still said 1,322. ### Tested **Restacked** onto `main` `77d536fb38`, which now has #8365, as `ee0d52b98f`; it also merges cleanly with current `main` `31c727f622`. The change is the same commit, replayed alone. The per-kind test from before is unchanged. Linux (Ubuntu 26.04.1, GCC 15.2), RTX 4070 Ti (NVIDIA 615.71.09), Release: `ctest -R pipeline_journal` (`agc_driver_pipeline_journal`, which holds the per-kind replays, `agc_pipeline_journal` and `_long_paths`) passes 3 of 3 on `ee0d52b98f`. Khronos validation (`VK_LAYER_KHRONOS_validation` 1.4.363, LunarG SDK) over the same 3 tests, on the base `77d536fb38` and on `ee0d52b98f`: 3 of 3 pass on each, the tests created 17 and 20 Vulkan devices that the layer checked, and there is no `VUID-` message on either side. Windows 11 VM (GT 1030, R580, WinLibs GCC 15.2.0, Release): `agc_driver_pipeline_journal` (the per-kind replays), `agc_pipeline_journal`, `_long_paths` and `_extended_paths` pass 3 of 3 on the base `77d536fb38` and 3 of 3 on `ee0d52b98f`. Earlier results, on the heads named in them (before the restack): - Mutants with this PR's tests: `main`'s single newest bound fails 3 of 3 on the bounded-replay case (`a replay bounded to 1 graphics and the default compute entries replayed 1 graphics and 0 compute pipelines`). A bound that keeps the first entries of each kind fails 3 of 3 in the newest-entries test. - @bunbeans2-arch's RX 9070 XT run on Windows of `cb2ba99693`. Not tested: a title run. ### 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 - [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 (#8365, #9836 and #9401 are merged) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 615.71.09, Ubuntu 26.04; NVIDIA GeForce GT 1030, R580, Windows 11 - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
milescoviello commented 2026-10-20 19:40:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T19:40:01Z.


Restacked on #8365's rebased head (30c643b8ca, on main 2185dbf92e). This commit is now de02531eea, with the same diff. #8365 now writes journal format 6, because #5656 took 5 on main. On this head, the journal tests (agc_driver_pipeline_journal, agc_driver_graphics, savedata_memory_journal) pass 3 of 3, and tools/check_conventions.py --base upstream/main passes.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6299742685 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8542#issuecomment-6299742685). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-20T19:40:01Z. --- Restacked on #8365's rebased head (30c643b8ca, on `main` 2185dbf92e). This commit is now de02531eea, with the same diff. #8365 now writes journal format 6, because #5656 took 5 on `main`. On this head, the journal tests (`agc_driver_pipeline_journal`, `agc_driver_graphics`, `savedata_memory_journal`) pass 3 of 3, and `tools/check_conventions.py --base upstream/main` passes. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-21 06:13:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T06:13:28Z.


Windows run of this head (de02531eea) and of #8365's head (30c643b8ca), which this PR is stacked on: Windows 11 Enterprise, NVIDIA GeForce GT 1030 (driver 582.66), WinLibs GCC 15.2.0 r7 (UCRT), Release, BUILD_TESTING=ON.

#8365 head this PR
agc_driver_pipeline_journal 9 of 9 pass 9 of 9 pass
time per run 1.8 to 4.6 s 2.6 to 8.0 s, and one run of 28.4 s

main's merge base 2185dbf92e also passes 3 of 3 (1.2 to 1.7 s).

The new cases write and replay journals past both limits, so the test takes about a second longer here. The 28.4 s run was the second of the first three. It didn't come back in six more runs, and the VM's disk is a qcow2 on NFS, so I take it as I/O on this machine rather than the change. I haven't confirmed that.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309399957 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8542#issuecomment-6309399957). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T06:13:28Z. --- Windows run of this head (`de02531eea`) and of #8365's head (`30c643b8ca`), which this PR is stacked on: Windows 11 Enterprise, NVIDIA GeForce GT 1030 (driver 582.66), WinLibs GCC 15.2.0 r7 (UCRT), Release, `BUILD_TESTING=ON`. | | #8365 head | this PR | |---|---|---| | `agc_driver_pipeline_journal` | 9 of 9 pass | 9 of 9 pass | | time per run | 1.8 to 4.6 s | 2.6 to 8.0 s, and one run of 28.4 s | `main`'s merge base `2185dbf92e` also passes 3 of 3 (1.2 to 1.7 s). The new cases write and replay journals past both limits, so the test takes about a second longer here. The 28.4 s run was the second of the first three. It didn't come back in six more runs, and the VM's disk is a qcow2 on NFS, so I take it as I/O on this machine rather than the change. I haven't confirmed that. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-21 11:06:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T11:06:03Z.


Restacked on #8365's new head a2eb629939, which is rebased onto main 275e896797. This PR's commit is now ff8ec20cc1, and it applied unchanged. The journal format is 7, from #8365's commit, since #7869 took 6 on main. The 4 journal tests pass 2 of 2.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6314404659 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8542#issuecomment-6314404659). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T11:06:03Z. --- Restacked on #8365's new head `a2eb629939`, which is rebased onto `main` 275e896797. This PR's commit is now `ff8ec20cc1`, and it applied unchanged. The journal format is 7, from #8365's commit, since #7869 took 6 on `main`. The 4 `journal` tests pass 2 of 2. AI-assisted: yes (Claude Code)
tibzejoker commented 2026-10-21 18:51:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-21T18:51:31Z.


GTA V (PPSA04264), Windows 11, RTX 4090, open world: the graphics store overflows on its own. It settles at about 1,270 distinct pipelines after about 3 minutes, so the 1,024 LRU bound keeps evicting pipelines that are rebuilt right after, at about 200 ms each (up to 1.6 s) under the GPU mutex.

Last 330 s of one run each:

setting freezes over 500 ms blocking builds
default 36 32.9 s
APS5_PIPELINE_STORE_ENTRIES=8192 11 2.9 s

With APS5_PIPELINE_JOURNAL_ENTRIES=100000, the whole journal (1,303 pipelines) replayed in 454 ms on 16 threads.

So the graphics journal bound is tied to a store bound that is too small for this title. I plan a separate PR that grows the store adaptively, as #7189 does for the resource cache (a ghost list of evicted keys, doubling up to 16384, with a set value still fixing it), and sizes the graphics journal bound to match. It touches the same lines of PipelineJournal.cpp as this PR, so I'll build it on top of this one if it lands first, and keep the compute bound as you split it.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6323934687 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8542#issuecomment-6323934687). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-21T18:51:31Z. --- GTA V (PPSA04264), Windows 11, RTX 4090, open world: the graphics store overflows on its own. It settles at about 1,270 distinct pipelines after about 3 minutes, so the 1,024 LRU bound keeps evicting pipelines that are rebuilt right after, at about 200 ms each (up to 1.6 s) under the GPU mutex. Last 330 s of one run each: | setting | freezes over 500 ms | blocking builds | |---|---|---| | default | 36 | 32.9 s | | `APS5_PIPELINE_STORE_ENTRIES=8192` | 11 | 2.9 s | With `APS5_PIPELINE_JOURNAL_ENTRIES=100000`, the whole journal (1,303 pipelines) replayed in 454 ms on 16 threads. So the graphics journal bound is tied to a store bound that is too small for this title. I plan a separate PR that grows the store adaptively, as #7189 does for the resource cache (a ghost list of evicted keys, doubling up to 16384, with a set value still fixing it), and sizes the graphics journal bound to match. It touches the same lines of `PipelineJournal.cpp` as this PR, so I'll build it on top of this one if it lands first, and keep the compute bound as you split it. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-21 18:53:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T18:53:43Z.


Thanks @tibzejoker, those numbers make the case. At about 1,270 distinct pipelines, a 1,024-entry store evicts pipelines the title rebuilds right away, and APS5_PIPELINE_STORE_ENTRIES=8192 cuts the blocking builds from 32.9 s to 2.9 s. The replay fits easily: 1,303 pipelines in 454 ms.

An adaptive store with the graphics journal bound sized to match sounds right to me. This PR keeps the graphics and compute bounds separate, so yours only has to move the graphics one. One note for building on it: this PR is stacked on #8365 (compressed journal modules), which is on #8213, so its head carries their commits until they merge. If you base on this branch you'll carry them too. Once they land, rebasing onto main should only drop them.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6323977432 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8542#issuecomment-6323977432). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T18:53:43Z. --- Thanks @tibzejoker, those numbers make the case. At about 1,270 distinct pipelines, a 1,024-entry store evicts pipelines the title rebuilds right away, and `APS5_PIPELINE_STORE_ENTRIES=8192` cuts the blocking builds from 32.9 s to 2.9 s. The replay fits easily: 1,303 pipelines in 454 ms. An adaptive store with the graphics journal bound sized to match sounds right to me. This PR keeps the graphics and compute bounds separate, so yours only has to move the graphics one. One note for building on it: this PR is stacked on #8365 (compressed journal modules), which is on #8213, so its head carries their commits until they merge. If you base on this branch you'll carry them too. Once they land, rebasing onto `main` should only drop them. AI-assisted: yes (Claude Code)
tibzejoker commented 2026-10-21 20:48:00 +00:00 (Migrated from github.com)

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


Follow-up: the store side is now #9401. It replays up to 16384 journal records, lets the replay grow the store instead of skipping once it is full, and grows the bound while evicted pipelines come back. In the GTA V open world, builds in play went from 80-153 to 42. It touches the same journal-bound line as this PR, so I'll rebase it onto yours if yours lands first.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6326212783 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8542#issuecomment-6326212783). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-21T20:48:00Z. --- Follow-up: the store side is now #9401. It replays up to 16384 journal records, lets the replay grow the store instead of skipping once it is full, and grows the bound while evicted pipelines come back. In the GTA V open world, builds in play went from 80-153 to 42. It touches the same journal-bound line as this PR, so I'll rebase it onto yours if yours lands first. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-21 20:54:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T20:54:11Z.


Thanks @tibzejoker. 42 builds in play, down from 80–153, is a big drop. I trial-merged #9401's head with this PR: they conflict in PipelineJournal.cpp, plus the ARCHITECTURE.md, ENVIRONMENT.md and AGC debt entries. That works either way: if #9401 lands first, I'll rebase this one onto it and keep its store bound.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6326328916 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8542#issuecomment-6326328916). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T20:54:11Z. --- Thanks @tibzejoker. 42 builds in play, down from 80–153, is a big drop. I trial-merged #9401's head with this PR: they conflict in `PipelineJournal.cpp`, plus the `ARCHITECTURE.md`, `ENVIRONMENT.md` and AGC debt entries. That works either way: if #9401 lands first, I'll rebase this one onto it and keep its store bound. AI-assisted: yes (Claude Code)
00xDisaster commented 2026-10-22 00:07:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 00xDisaster on 2026-10-22T00:07:25Z.


Overlap note: #9440 changes the same bound line in PipelineJournal.cpp — it keeps the last entries of the journal instead of the first, so the pipelines a title built last are the ones the replay builds, and it rewrites the file when it reaches APS5_PIPELINE_JOURNAL_MAX_MIB instead of refusing the record (it also touches the two bound rows of docs/dev/ENVIRONMENT.md and the journal's debt entry).

The changes compose: the per-kind bounds of this PR can be applied to the entries #9440 keeps. I will rebase onto whichever lands first.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6329379381 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8542#issuecomment-6329379381). Originally posted by [00xDisaster](https://github.com/00xDisaster) on 2026-10-22T00:07:25Z. --- Overlap note: #9440 changes the same bound line in `PipelineJournal.cpp` — it keeps the **last** entries of the journal instead of the first, so the pipelines a title built last are the ones the replay builds, and it rewrites the file when it reaches `APS5_PIPELINE_JOURNAL_MAX_MIB` instead of refusing the record (it also touches the two bound rows of `docs/dev/ENVIRONMENT.md` and the journal's debt entry). The changes compose: the per-kind bounds of this PR can be applied to the entries #9440 keeps. I will rebase onto whichever lands first.
milescoviello commented 2026-10-22 00:25:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-22T00:25:22Z.


Thanks @00xDisaster, agreed that they compose: this PR's per-kind bounds apply to the entries #9440 keeps. If #9440 lands first I'll rebase this onto it. I also left a review on #9440 about the record that triggers an eviction.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6329629780 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8542#issuecomment-6329629780). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-22T00:25:22Z. --- Thanks @00xDisaster, agreed that they compose: this PR's per-kind bounds apply to the entries #9440 keeps. If #9440 lands first I'll rebase this onto it. I also left a review on #9440 about the record that triggers an eviction. AI-assisted: yes (Claude Code)
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!8542
No description provided.