feat(agc): store the pipeline journal's modules compressed #8365

Merged
milescoviello merged 1 commit from upstream-pr/8365 into main 2026-11-01 06:45:55 +00:00
milescoviello commented 2026-10-20 11:09:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T11:09:17Z.


What

Pipeline journal module records are SPIR-V, and they take almost all of a journal's bytes. #8309 shows that APS5_PIPELINE_JOURNAL_MAX_MIB (1024 MiB) fills with them during a level load, after which later pipelines are never recorded. A module record now stores the module's identity, its stage and the size of its encoded RecompileResult, then a zstd frame (level 1) of that encoding. Loading expands each module once to check that it decodes, as it decoded the raw payload before. Replay expands a module when the entry that needs it is built, on the replay thread, through #8213's per-module reads. The held-module accounting counts expanded bytes, which is what replay holds in memory. The file format becomes 6 (#5656 took 5 on main for its recipe codec change), so an older journal starts over. Since the journal's source version already changes with every recompiler build, that costs no extra rebuilds.

zstd is the vendored copy (3rdparty/zstd, already built as libzstd_static for ZArchive). libSceAgcDriver links it statically, and on Linux it's kept out of the library's exports with --exclude-libs,libzstd.a, as cmake/ZArchive.cmake does. nm -D --defined-only libSceAgcDriver.prx | grep -i zstd prints nothing.

Why

The same cap then holds about 3.5 times as many modules:

  • MXGP 26 (PPSA30839), cold seed of 200 s: 445 modules recorded, the journal file is 105.75 MB with #8213's uncompressed records and 30.15 MB with this PR (module payloads 100.9 MiB against 28.8 MiB).
  • Warm run of 150 s from each seed: the load goes from 57 to 59 ms up to 105 to 107 ms, since every module is expanded once to be checked, and the replay takes 16.4 s either way (16,351 against 16,430 ms on 12 threads; it holds at most 15.5 and 16.0 MiB of modules).
  • @SleglJan measured 007 First Light's (PPSA11386) 2 GiB journal from #8309 as a whole stream: zstd -1 gives 27.4% (3.7 s on one thread), so everything that seed recorded would fit under the default cap. Records compressed one at a time can come out a little larger than the whole stream.
  • On Ghost of Tsushima's 1023 MiB journal, the first 256 MiB compress to 22% with zstd -1 (0.39 s on one thread).

Tested

Rebased onto main d0e7fe7beb as 9a343887fa after #9348 took journal format 10; that line was the only conflict, and 11 is now main+1 (journal tests 3 of 3 on #8542's rebased head, which carries this commit). Before that, rebased onto main b607bfdc8b, which has #8213, as 3ac931eff9. It is the patch tested as bc08106ac5 on #8213's head 6fc2ea58c0, except that it keeps main's comment above FileFormat instead of rewording it (the conventions check counts a reworded comment as new). main now has #9836, which keeps a full journal's newest pipelines and moved module encoding into EncodeModule, so this commit now compresses inside EncodeModule (an empty payload skips the batch as before), and the size check of an over-cap batch measures the compressed records the file will hold. #9836's OversizedRecordKeepsTheJournal made its record too large with 400,000 zero words, which zstd shrinks under the 1 MiB cap. The test now fills those words with an LCG, so the record stays over the cap compressed. Without that change, agc_driver_pipeline_journal fails 3 of 3 here with the oversized record was not counted as a write failure. On this head, Ubuntu 26.04.1, GCC 15.2, RTX 4070 Ti (615.71.09):

  • agc_driver_pipeline_journal, agc_pipeline_journal and _long_paths pass 3 of 3 on bc08106ac5 (on #8213's head 6fc2ea58c0); they pass 3 of 3 on 6fc2ea58c0 itself and on main d098eca3d6.
  • Khronos validation 1.4.363 over the 16 tests matching pipeline_journal|pipeline_store|pipeline_library|pipeline_optimized_readback, on 6fc2ea58c0 and on bc08106ac5: 16 of 16 pass on each, with no VUID- message and no layer-missing line.
  • Windows 11 VM (GT 1030, 582.78, WinLibs GCC 15.2.0 r7, Release), with #8542 on top (cefe1d002f): the 4 pipeline journal tests pass 3 of 3, on the merge base and on the head.
  • FileFormat is 11, main+1: main is at 10 (8 for #6801's point lists, 9 for #8564's 4_4_4_4 targets, 10 for #9348's colour logic operation).

Earlier results, on the heads named in them:

Ubuntu 24.04 (Linux 6.8), GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02.

  • agc_driver_pipeline_journal: HeldModuleTests now also encodes its 16 compute modules and requires the whole journal file to be smaller than those encodings. With #8213's uncompressed records it fails (the journal is 467,960 bytes with 16 of its modules alone encoding to 430,144 bytes), 3 of 3. With this PR both journal tests pass 3 of 3, the held-module bound among them.

  • Khronos validation layer (LunarG SDK 1.4.363), NVIDIA RTX 4070 Ti (595.99.02), Ubuntu 24.04: VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -R 'pipeline_journal' -V on #8213's head 5778288da7 and on this PR (f5504d2ec4). 2 of 2 pass on each. Neither log reports the layer missing, and neither has a VUID- error.

  • tools/check_conventions.py --base upstream/main passes, apart from the existing debt-length warning on the pipeline journal entry. This PR doesn't change that entry, since nothing in it becomes false.

  • PPSA11386, by @SleglJan (comment), RTX 3080 (NVIDIA 615.78.08), Linux, on a main 68323bae7 integration with the title's open PRs, #8213 and this PR: with the default 1024 MiB cap, the first level's load now records completely, and the cap is reached about 455 s into gameplay. Before this, it was reached during that load. The journal records 628 graphics, 694 compute and 1,292 modules, against 330, 377 and 664. The warm level entry has no gap, against 280 s from Resume to the first gameplay frame: 4,107 draws built in 7.2 s, against 772 in 284.5 s.

  • Windows 10 Pro 22H2, WinLibs GCC 15.2.0, Release, by @TheSovietWaffle on f5504d2ec: agc_driver_pipeline_journal and agc_pipeline_journal pass 3 of 3 on an NVIDIA RTX 3080 (617.42) and on an AMD Radeon RDNA 2 iGPU (1002:164e, 32.0.21045.5002).

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 (the existing comment on FileFormat now names record layouts among what bumps it)
  • 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 (#8213 merged)
  • Fixes: #8309
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 595.99.02, Ubuntu 24.04; NVIDIA RTX 3080 (617.42) and AMD Radeon RDNA 2 iGPU (32.0.21045.5002), Windows 10 (@TheSovietWaffle)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4934854491 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8365). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-20T11:09:17Z. --- ### What Pipeline journal module records are SPIR-V, and they take almost all of a journal's bytes. #8309 shows that `APS5_PIPELINE_JOURNAL_MAX_MIB` (1024 MiB) fills with them during a level load, after which later pipelines are never recorded. A module record now stores the module's identity, its stage and the size of its encoded `RecompileResult`, then a zstd frame (level 1) of that encoding. Loading expands each module once to check that it decodes, as it decoded the raw payload before. Replay expands a module when the entry that needs it is built, on the replay thread, through #8213's per-module reads. The held-module accounting counts expanded bytes, which is what replay holds in memory. The file format becomes 6 (#5656 took 5 on `main` for its recipe codec change), so an older journal starts over. Since the journal's source version already changes with every recompiler build, that costs no extra rebuilds. zstd is the vendored copy (`3rdparty/zstd`, already built as `libzstd_static` for ZArchive). `libSceAgcDriver` links it statically, and on Linux it's kept out of the library's exports with `--exclude-libs,libzstd.a`, as `cmake/ZArchive.cmake` does. `nm -D --defined-only libSceAgcDriver.prx | grep -i zstd` prints nothing. ### Why The same cap then holds about 3.5 times as many modules: - MXGP 26 (PPSA30839), cold seed of 200 s: 445 modules recorded, the journal file is 105.75 MB with #8213's uncompressed records and 30.15 MB with this PR (module payloads 100.9 MiB against 28.8 MiB). - Warm run of 150 s from each seed: the load goes from 57 to 59 ms up to 105 to 107 ms, since every module is expanded once to be checked, and the replay takes 16.4 s either way (16,351 against 16,430 ms on 12 threads; it holds at most 15.5 and 16.0 MiB of modules). - @SleglJan measured 007 First Light's (PPSA11386) 2 GiB journal from #8309 as a whole stream: `zstd -1` gives 27.4% (3.7 s on one thread), so everything that seed recorded would fit under the default cap. Records compressed one at a time can come out a little larger than the whole stream. - On Ghost of Tsushima's 1023 MiB journal, the first 256 MiB compress to 22% with `zstd -1` (0.39 s on one thread). ### Tested **Rebased** onto `main` d0e7fe7beb as `9a343887fa` after #9348 took journal format 10; that line was the only conflict, and 11 is now `main`+1 (journal tests 3 of 3 on #8542's rebased head, which carries this commit). Before that, rebased onto `main` b607bfdc8b, which has #8213, as `3ac931eff9`. It is the patch tested as `bc08106ac5` on #8213's head 6fc2ea58c0, except that it keeps `main`'s comment above `FileFormat` instead of rewording it (the conventions check counts a reworded comment as new). `main` now has #9836, which keeps a full journal's newest pipelines and moved module encoding into `EncodeModule`, so this commit now compresses inside `EncodeModule` (an empty payload skips the batch as before), and the size check of an over-cap batch measures the compressed records the file will hold. #9836's `OversizedRecordKeepsTheJournal` made its record too large with 400,000 zero words, which zstd shrinks under the 1 MiB cap. The test now fills those words with an LCG, so the record stays over the cap compressed. Without that change, `agc_driver_pipeline_journal` fails 3 of 3 here with `the oversized record was not counted as a write failure`. On this head, Ubuntu 26.04.1, GCC 15.2, RTX 4070 Ti (615.71.09): - `agc_driver_pipeline_journal`, `agc_pipeline_journal` and `_long_paths` pass 3 of 3 on `bc08106ac5` (on #8213's head 6fc2ea58c0); they pass 3 of 3 on 6fc2ea58c0 itself and on `main` d098eca3d6. - Khronos validation 1.4.363 over the 16 tests matching `pipeline_journal|pipeline_store|pipeline_library|pipeline_optimized_readback`, on 6fc2ea58c0 and on `bc08106ac5`: 16 of 16 pass on each, with no `VUID-` message and no layer-missing line. - Windows 11 VM (GT 1030, 582.78, WinLibs GCC 15.2.0 r7, Release), with #8542 on top (`cefe1d002f`): the 4 pipeline journal tests pass 3 of 3, on the merge base and on the head. - `FileFormat` is 11, `main`+1: `main` is at 10 (8 for #6801's point lists, 9 for #8564's 4_4_4_4 targets, 10 for #9348's colour logic operation). Earlier results, on the heads named in them: Ubuntu 24.04 (Linux 6.8), GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02. - `agc_driver_pipeline_journal`: `HeldModuleTests` now also encodes its 16 compute modules and requires the whole journal file to be smaller than those encodings. With #8213's uncompressed records it fails (the journal is 467,960 bytes with 16 of its modules alone encoding to 430,144 bytes), 3 of 3. With this PR both journal tests pass 3 of 3, the held-module bound among them. - Khronos validation layer (LunarG SDK 1.4.363), NVIDIA RTX 4070 Ti (595.99.02), Ubuntu 24.04: `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -R 'pipeline_journal' -V` on #8213's head 5778288da7 and on this PR (f5504d2ec4). 2 of 2 pass on each. Neither log reports the layer missing, and neither has a `VUID-` error. - `tools/check_conventions.py --base upstream/main` passes, apart from the existing `debt-length` warning on the pipeline journal entry. This PR doesn't change that entry, since nothing in it becomes false. - PPSA11386, by @SleglJan ([comment](https://github.com/boykopovar/AnyPS5/pull/8365#issuecomment-6294841262)), RTX 3080 (NVIDIA 615.78.08), Linux, on a `main` 68323bae7 integration with the title's open PRs, #8213 and this PR: with the default 1024 MiB cap, the first level's load now records completely, and the cap is reached about 455 s into gameplay. Before this, it was reached during that load. The journal records 628 graphics, 694 compute and 1,292 modules, against 330, 377 and 664. The warm level entry has no gap, against 280 s from Resume to the first gameplay frame: 4,107 draws built in 7.2 s, against 772 in 284.5 s. - Windows 10 Pro 22H2, WinLibs GCC 15.2.0, Release, by @TheSovietWaffle on `f5504d2ec`: `agc_driver_pipeline_journal` and `agc_pipeline_journal` pass 3 of 3 on an NVIDIA RTX 3080 (617.42) and on an AMD Radeon RDNA 2 iGPU (`1002:164e`, 32.0.21045.5002). ### 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) (the existing comment on `FileFormat` now names record layouts among what bumps it) - [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 (#8213 merged) - [x] Fixes: #8309 - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 595.99.02, Ubuntu 24.04; NVIDIA RTX 3080 (617.42) and AMD Radeon RDNA 2 iGPU (32.0.21045.5002), Windows 10 (@TheSovietWaffle) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
TheSovietWaffle commented 2026-10-20 12:04:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheSovietWaffle on 2026-10-20T12:04:12Z.


Windows data point: RTX 3080 (NVIDIA 617.42) and AMD Radeon RDNA 2 iGPU (1002:164e, 32.0.21045.5002), Windows 10 Pro 22H2, WinLibs GCC 15.2.0, Release, head f5504d2ec: agc_driver_pipeline_journal and agc_pipeline_journal pass 3 of 3 on both GPUs.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6290416254 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8365#issuecomment-6290416254). Originally posted by [TheSovietWaffle](https://github.com/TheSovietWaffle) on 2026-10-20T12:04:12Z. --- Windows data point: RTX 3080 (NVIDIA 617.42) and AMD Radeon RDNA 2 iGPU (`1002:164e`, 32.0.21045.5002), Windows 10 Pro 22H2, WinLibs GCC 15.2.0, Release, head `f5504d2ec`: `agc_driver_pipeline_journal` and `agc_pipeline_journal` pass 3 of 3 on both GPUs. AI-assisted: yes (Claude Code).
milescoviello commented 2026-10-20 12:05:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T12:05:59Z.


Thanks @TheSovietWaffle. That covers Windows, which I hadn't run, and adds an AMD GPU. I added both to the Tested section of the description.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6290447296 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8365#issuecomment-6290447296). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-20T12:05:59Z. --- Thanks @TheSovietWaffle. That covers Windows, which I hadn't run, and adds an AMD GPU. I added both to the Tested section of the description. AI-assisted: yes (Claude Code)
SleglJan commented 2026-10-20 15:42:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-20T15:42:35Z.


@milescoviello PPSA11386 (007 First Light) with f5504d2ec4, compared with the runs in #8309:

  • With the default cap, the level's load now records completely. The cap is reached about 455 s into gameplay.
  • The warm level entry has no gap.
  • I didn't rerun the 2 GiB seed. The default-cap seed now holds 1,322 pipelines and 1,292 modules, against that seed's 958 and 924.

Setup:

  • Build: main 68323bae7 with the open PRs this title needs (#5799, #6868, #5372, #6918, #7643, #6679 at an earlier head; it has since merged), plus #8213 (5778288da7) and this PR (f5504d2ec4) as squashes. No conflicts.
  • The title's two feedback-wait limits are widened in its executable as described in #6172 (local only). Scripted input, APS5_PROFILE_DRAW=1.
  • RTX 3080, NVIDIA 615.78.08, Linux 7.2.10, GCC 16.2.1, Release. One run each.
  • The "before" numbers are #8309's runs on the same base, without #8213 and this PR. So boot and replay times are not like-for-like.

Cold seed with the default cap (1024 MiB):

before (#8309) this PR
journal at Resume – 200 MB
journal at the first gameplay frame at the cap 344–428 MB
cap reached during the first level's load about 455 s into gameplay
recorded 330 graphics, 377 compute, 664 modules 628 graphics, 694 compute, 1,292 modules
writes refused after the cap 617 75

Warm run from that seed:

before (#8309, default-cap seed) this PR
boot to Resume 385 s 385 s
journal load – 4.0 s (1,322 pipelines, 1,292 modules)
replay, 16 threads 258 s: 330 graphics, 374 compute 273 s: 481 graphics, 526 compute, 17 already present; 0 skipped, rejected or failed
Resume to the first gameplay frame 280 s no gap: a new frame in every 10 s sample
draws built from scratch during the level entry (the draw profile's "build" count, which #8309 called graphics pipelines built) 772, taking 284.5 s 4,107, taking 7.2 s
first 200 presents 0.67 FPS 0.73 FPS

The 2 GiB seed in #8309 gave 2,505 builds taking 5.4 s and 0.70 FPS, so the default cap now does about what that seed did.

The entry limit now binds before the byte cap. The replay takes the first APS5_PIPELINE_JOURNAL_ENTRIES entries (1024, documented in ARCHITECTURE.md as the pipeline store's bound; PipelineJournal.cpp:915 on main 2ee20b4200):

  • The warm run replayed exactly 1,024 of the 1,322 entries: 481 + 526 + 17. The load line still says 1,322.
  • The 298 not replayed are the journal's tail. Entry 1,024 was recorded 1–1.5 minutes into gameplay, so the level entry is unaffected, and the rest are compiled when first used, as before.
  • The store's bound applies to graphics pipelines (CachedPipeline, APS5_PIPELINE_STORE_ENTRIES), and only 628 of the 1,322 are graphics. So a separate entry bound for compute, or a log line when the replay truncates, might suit a follow-up rather than this PR.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6294841262 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8365#issuecomment-6294841262). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-20T15:42:35Z. --- @milescoviello PPSA11386 (007 First Light) with f5504d2ec4, compared with the runs in #8309: - With the default cap, the level's load now records completely. The cap is reached about 455 s into gameplay. - The warm level entry has no gap. - I didn't rerun the 2 GiB seed. The default-cap seed now holds 1,322 pipelines and 1,292 modules, against that seed's 958 and 924. **Setup:** - Build: `main` 68323bae7 with the open PRs this title needs (#5799, #6868, #5372, #6918, #7643, #6679 at an earlier head; it has since merged), plus #8213 (5778288da7) and this PR (f5504d2ec4) as squashes. No conflicts. - The title's two feedback-wait limits are widened in its executable as described in #6172 (local only). Scripted input, `APS5_PROFILE_DRAW=1`. - RTX 3080, NVIDIA 615.78.08, Linux 7.2.10, GCC 16.2.1, Release. One run each. - The "before" numbers are #8309's runs on the same base, without #8213 and this PR. So boot and replay times are not like-for-like. **Cold seed with the default cap (1024 MiB):** | | before (#8309) | this PR | |---|---|---| | journal at Resume | – | 200 MB | | journal at the first gameplay frame | at the cap | 344–428 MB | | cap reached | during the first level's load | about 455 s into gameplay | | recorded | 330 graphics, 377 compute, 664 modules | 628 graphics, 694 compute, 1,292 modules | | writes refused after the cap | 617 | 75 | **Warm run from that seed:** | | before (#8309, default-cap seed) | this PR | |---|---|---| | boot to Resume | 385 s | 385 s | | journal load | – | 4.0 s (1,322 pipelines, 1,292 modules) | | replay, 16 threads | 258 s: 330 graphics, 374 compute | 273 s: 481 graphics, 526 compute, 17 already present; 0 skipped, rejected or failed | | Resume to the first gameplay frame | 280 s | no gap: a new frame in every 10 s sample | | draws built from scratch during the level entry (the draw profile's "build" count, which #8309 called graphics pipelines built) | 772, taking 284.5 s | 4,107, taking 7.2 s | | first 200 presents | 0.67 FPS | 0.73 FPS | The 2 GiB seed in #8309 gave 2,505 builds taking 5.4 s and 0.70 FPS, so the default cap now does about what that seed did. **The entry limit now binds before the byte cap.** The replay takes the first `APS5_PIPELINE_JOURNAL_ENTRIES` entries (1024, documented in ARCHITECTURE.md as the pipeline store's bound; `PipelineJournal.cpp:915` on `main` 2ee20b4200): - The warm run replayed exactly 1,024 of the 1,322 entries: 481 + 526 + 17. The load line still says 1,322. - The 298 not replayed are the journal's tail. Entry 1,024 was recorded 1–1.5 minutes into gameplay, so the level entry is unaffected, and the rest are compiled when first used, as before. - The store's bound applies to graphics pipelines (`CachedPipeline`, `APS5_PIPELINE_STORE_ENTRIES`), and only 628 of the 1,322 are graphics. So a separate entry bound for compute, or a log line when the replay truncates, might suit a follow-up rather than this PR. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-20 15:44:03 +00:00 (Migrated from github.com)

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


Thanks @SleglJan, that's the result #8309 was after: the default cap now covers the level load that the 2 GiB seed needed.

Good catch on the entry limit. The replay cuts the loaded journal to its first APS5_PIPELINE_JOURNAL_ENTRIES silently, and compute entries count against a bound meant for the graphics pipeline store. I'll take that as a separate small PR: graphics entries bounded as now, compute entries bounded on their own, and a line when the replay leaves entries out. That keeps this one to the module encoding.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6294871624 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8365#issuecomment-6294871624). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-20T15:44:03Z. --- Thanks @SleglJan, that's the result #8309 was after: the default cap now covers the level load that the 2 GiB seed needed. Good catch on the entry limit. The replay cuts the loaded journal to its first `APS5_PIPELINE_JOURNAL_ENTRIES` silently, and compute entries count against a bound meant for the graphics pipeline store. I'll take that as a separate small PR: graphics entries bounded as now, compute entries bounded on their own, and a line when the replay leaves entries out. That keeps this one to the module encoding. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-20 15:53:09 +00:00 (Migrated from github.com)

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


@SleglJan the entry-limit follow-up is #8542, stacked on this PR. Graphics entries keep the current bound, compute entries get APS5_PIPELINE_JOURNAL_COMPUTE_ENTRIES (1024), and a line says how many of each a replay leaves out.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6295065940 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8365#issuecomment-6295065940). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-20T15:53:09Z. --- @SleglJan the entry-limit follow-up is #8542, stacked on this PR. Graphics entries keep the current bound, compute entries get `APS5_PIPELINE_JOURNAL_COMPUTE_ENTRIES` (1024), and a line says how many of each a replay leaves out. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-20 19:40:00 +00:00 (Migrated from github.com)

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


Rebased onto main 2185dbf92e. The stack is #8213's two commits (unchanged) plus this one, now 30c643b8ca. It conflicted in PipelineJournal.cpp with #5656, which also bumped the journal's FileFormat from 4 to 5 for its recipe codec change. This PR's format is now 6, so a journal written by main in format 5 (uncompressed modules) starts over instead of being read as compressed. The commit message and the description say so. On the rebased head, the journal tests (agc_driver_pipeline_journal, agc_driver_graphics, savedata_memory_journal) pass 3 of 3.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6299742208 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8365#issuecomment-6299742208). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-20T19:40:00Z. --- Rebased onto `main` 2185dbf92e. The stack is #8213's two commits (unchanged) plus this one, now 30c643b8ca. It conflicted in `PipelineJournal.cpp` with #5656, which also bumped the journal's `FileFormat` from 4 to 5 for its recipe codec change. This PR's format is now 6, so a journal written by `main` in format 5 (uncompressed modules) starts over instead of being read as compressed. The commit message and the description say so. On the rebased head, the journal tests (`agc_driver_pipeline_journal`, `agc_driver_graphics`, `savedata_memory_journal`) pass 3 of 3. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-21 04:58:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T04:58:59Z.


Windows results for this head (30c643b8ca, which carries #8213), since the description only has Linux. Setup: Windows 11 Enterprise (build 22631), NVIDIA GeForce GT 1030 (driver 582.66), WinLibs GCC 15.2.0 r7 (UCRT), Release, BUILD_TESTING=ON.

  • agc_driver_pipeline_journal and savedata_memory_journal pass 3 of 3 at this head, which writes compressed modules and reads them back through #8213's overlapped ReadFile path.
  • Both pass 3 of 3 at the merge base 2185dbf92e too.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6308427702 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8365#issuecomment-6308427702). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T04:58:59Z. --- Windows results for this head (30c643b8ca, which carries #8213), since the description only has Linux. Setup: Windows 11 Enterprise (build 22631), NVIDIA GeForce GT 1030 (driver 582.66), WinLibs GCC 15.2.0 r7 (UCRT), Release, `BUILD_TESTING=ON`. - `agc_driver_pipeline_journal` and `savedata_memory_journal` pass 3 of 3 at this head, which writes compressed modules and reads them back through #8213's overlapped `ReadFile` path. - Both pass 3 of 3 at the merge base 2185dbf92e too. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-21 11:06:02 +00:00 (Migrated from github.com)

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


Rebased onto main 275e896797. The new head is a2eb629939, same three commits. #7869 (polygon modes) took journal format 6, so this PR's format moves to 7, and the module-record commit's message says so. The one conflict was the comment above FileFormat, where this PR's wording is kept. The 4 journal tests pass 2 of 2.

#8542 is restacked on this head.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6314404310 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8365#issuecomment-6314404310). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T11:06:02Z. --- Rebased onto `main` 275e896797. The new head is `a2eb629939`, same three commits. #7869 (polygon modes) took journal format 6, so this PR's format moves to 7, and the module-record commit's message says so. The one conflict was the comment above `FileFormat`, where this PR's wording is kept. The 4 `journal` tests pass 2 of 2. #8542 is restacked on this head. AI-assisted: yes (Claude Code)
oneandonlydean commented 2026-10-22 01:42:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T01:42:19Z.


@milescoviello the rebase onto FileFormat 7 looks right. Full CI on a2eb629939 fails one Windows test, twice: prx_thread_local_destructors (attempts 1 and 2 of run 39703474248, both ~48.5 s). Linux passes.

The test's message names the cause:

On Windows a thread_local destructor in a module runs after emulated TLS
freed the object; keep such objects in HostThreadLocal:

  libSceAgcDriver.prx: ...JournalFile4Read... registers a thread_local destructor

That's the new static thread_local ReadEvent completion; in JournalFile::Read (PipelineJournal.cpp, the _WIN32 branch). ReadEvent has a destructor (CloseHandle), so the module registers a TLS destructor, which this check forbids on Windows.

Moving it to HostThreadLocal (prx/libc/include/HostThreadLocal.hpp) should fix it, the same way PreciseWait.hpp and Submission.cpp keep their per-thread state. Something like:

struct ReadEventStorage;
auto& completion = HostThreadLocal<ReadEvent, ReadEventStorage>();

With that change, prx_thread_local_destructors should pass on Windows CI.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330635872 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8365#issuecomment-6330635872). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-22T01:42:19Z. --- @milescoviello the rebase onto FileFormat 7 looks right. Full CI on a2eb629939 fails one Windows test, twice: `prx_thread_local_destructors` (attempts 1 and 2 of run 39703474248, both ~48.5 s). Linux passes. The test's message names the cause: ``` On Windows a thread_local destructor in a module runs after emulated TLS freed the object; keep such objects in HostThreadLocal: libSceAgcDriver.prx: ...JournalFile4Read... registers a thread_local destructor ``` That's the new `static thread_local ReadEvent completion;` in `JournalFile::Read` (`PipelineJournal.cpp`, the `_WIN32` branch). `ReadEvent` has a destructor (`CloseHandle`), so the module registers a TLS destructor, which this check forbids on Windows. Moving it to `HostThreadLocal` (`prx/libc/include/HostThreadLocal.hpp`) should fix it, the same way `PreciseWait.hpp` and `Submission.cpp` keep their per-thread state. Something like: ```cpp struct ReadEventStorage; auto& completion = HostThreadLocal<ReadEvent, ReadEventStorage>(); ``` With that change, `prx_thread_local_destructors` should pass on Windows CI.
milescoviello commented 2026-10-22 01:52:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-22T01:52:01Z.


@oneandonlydean thanks for tracking that down. Pushed e867237953: the read event in JournalFile::Read now comes from HostThreadLocal<ReadEvent, ReadEvent>() instead of a static thread_local, as you suggested. That follows PerformanceOverlay.cpp's HostThreadLocal<PacketCounterLease, PacketCounterLease>(), with the event type as its own tag.

#8213 has the same static thread_local ReadEvent (that's where the overlapped read came from), so I pushed the same change there as 0d34f90fab.

My Windows 11 VM (WinLibs GCC 15.2.0) is building all modules for prx_thread_local_destructors on main and on e867237953. I'll post the result here when it finishes.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330761952 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8365#issuecomment-6330761952). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-22T01:52:01Z. --- @oneandonlydean thanks for tracking that down. Pushed `e867237953`: the read event in `JournalFile::Read` now comes from `HostThreadLocal<ReadEvent, ReadEvent>()` instead of a `static thread_local`, as you suggested. That follows `PerformanceOverlay.cpp`'s `HostThreadLocal<PacketCounterLease, PacketCounterLease>()`, with the event type as its own tag. #8213 has the same `static thread_local ReadEvent` (that's where the overlapped read came from), so I pushed the same change there as `0d34f90fab`. My Windows 11 VM (WinLibs GCC 15.2.0) is building all modules for `prx_thread_local_destructors` on `main` and on `e867237953`. I'll post the result here when it finishes. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-22 02:08:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-22T02:08:06Z.


Windows 11 VM, WinLibs GCC 15.2.0, Release, every module built (--target libs): prx_thread_local_destructors passes on e867237953 and on its merge base 275e896797. So the HostThreadLocal change clears the module's thread_local destructor; the red side is your CI run on a2eb629939. #8213 carries the same change as 0d34f90fab.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6330965737 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8365#issuecomment-6330965737). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-22T02:08:06Z. --- Windows 11 VM, WinLibs GCC 15.2.0, Release, every module built (`--target libs`): `prx_thread_local_destructors` passes on `e867237953` and on its merge base `275e896797`. So the `HostThreadLocal` change clears the module's thread_local destructor; the red side is your CI run on `a2eb629939`. #8213 carries the same change as `0d34f90fab`. 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!8365
No description provided.