test(agc): share the pipeline journal test's replayed compute programs #15730

Merged
dantdmdarealguy merged 1 commit from upstream-pr/15730 into main 2026-11-08 18:08:17 +00:00
dantdmdarealguy commented 2026-11-04 10:07:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by dantdmdarealguy on 2026-11-04T10:07:35Z.


What

On GitHub's hosted Linux runner, agc_driver_pipeline_journal's first run takes about 120 s and the later runs about 8 s. EagleBearerYS measured it on #15423 (runs 41752529697 and 41743726570): 119.7 s then 8.3–8.4 s with #15423, and 135.9 s then about 50 s on main. CI's limit is --timeout 120.

Cause. The difference between the first run and the later ones is Mesa's shader cache, not anything in the test's temporary directory (each run makes a new one).

  • llvmpipe compiles a compute shader the first time it is dispatched. Here that takes about 0.85 s per program (i9-14900K).
  • The test dispatches 48 distinct compute programs:
    • salt 0;
    • salts 16–47 in the replay race case;
    • salts 1–3 in the newest-entries case;
    • salt 7 in the eviction case;
    • salts 1–16 in the held-module case, 11 of them new.
  • With an empty cache, almost all of the run is spent compiling them. A timestamped run on lavapipe shows recorded batch still running on the GPU after 5 s … 25 s while the race case's recording device dispatches its 32 programs. That is 28 s of the 43 s run.
  • The Linux CI job runs on a self-hosted runner that keeps MESA_SHADER_CACHE_DIR=/var/cache/anyps5/mesa, so it usually starts warm. It starts cold on a hosted runner, which is where fork runs go, and after any recompiler change that alters these modules.

Change. The race case and the held-module case now dispatch the same 16 programs (salts 8–23), through ReplayedCodes().

  • Salts 1–3 and 7 stay out of the shared set. The newest-entries and eviction cases need those salts not to be in the journal yet when they record them.
  • The race case goes from 32 programs to 16. The test now dispatches 21 distinct compute programs instead of 48.
  • What each case checks is unchanged:
    • The race case still requires ComputePipelinesCreated() == replayedCompute + replayPresent.
    • The held-module case still records and replays 16 programs, the same count as before.

The race case still catches the bug #12657 fixed. With the computePipelinesBuilding registration that 307f2202e7 added to ReplayComputePipeline removed, it fails every run:

Removed registration Runs Result
lavapipe, Mesa cache warm 5 fail, 25–26 built for 17 replayed
lavapipe, Mesa cache cold 3 fail, 24, 28, 25 built for 17 replayed
RTX 5080 5 fail, 28–31 built for 17 replayed

Tested

Windows 11 Pro, Intel Core i9-14900K, 128 GB RAM, NVIDIA GeForce RTX 5080 (driver 32.0.16.1742), WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON. Linux: Arch Linux WSL2 on the same machine, lavapipe (Mesa 26.1.2, LLVM 22.1.6) with GALLIUM_OVERRIDE_CPU_CAPS=avx and ANYPS5_REQUIRE_VULKAN=1, as CI sets them.

Timings are for the test binary. Cold means a new empty MESA_SHADER_CACHE_DIR, or on NVIDIA a new empty __GL_SHADER_DISK_CACHE_PATH. Warm means the next two runs with the same directory. main is b8efa6292a, and #15423 is its head e9ac2db947 merged onto that main.

lavapipe main this PR #15423 #15423 + this PR
cold 71.9 s 45.9 s 43.4 s 20.9 s
warm 27.1, 27.2 s 26.6, 26.2 s 2.4, 2.5 s 2.0, 1.9 s
cold, pinned to 4 CPUs — — 59.2 s 23.8 s
warm, pinned to 4 CPUs — — 3.1, 3.4 s 2.2, 2.1 s
RTX 5080 (ctest) main this PR #15423 #15423 + this PR
cold 25.8 s 24.1 s 6.9 s 5.3 s
warm 22.6, 22.8 s 22.5, 22.7 s 3.9, 3.8 s 3.9, 3.6 s
  • main's warm time (27 s on lavapipe, 23 s on the RTX 5080) is the undecodable-module allocation that #15423 fixes. This PR removes the cold-cache part, so the two are independent.
  • agc_driver_pipeline_journal_undecodable_module (#15423) passes with this PR on top: 0.68–0.76 s on the RTX 5080.
  • On the hosted runner, the 4-CPU lavapipe cold run (59.2 s) corresponds to EagleBearerYS's 119.7 s. By that ratio, this change should bring the runner's first run to roughly 48 s.
  • Tests and checks:
    • ctest -R "pipeline_journal|pipeline_store|patched_libraries" --parallel 2: 10/10 pass on Windows. patched_libraries passes.
    • cmake --build and --target libs succeed, with no warnings in the changed file.
    • tools/check_test_registration.py and tools/check_conventions.py --base origin/main pass.
  • Validation layer, RTX 5080: ctest -V -R "^agc_driver_pipeline_journal$|^agc_pipeline_journal" on main and on this PR.
    • Settings: VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, and the Khronos layer through VK_ADD_LAYER_PATH.
    • Neither log has was not found but was requested by env var VK_INSTANCE_LAYERS. Each has 20 Insert instance layer "VK_LAYER_KHRONOS_validation" lines and no VUID- line.
    • agc_driver_pipeline_journal took 21.9 s in both runs.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5080, driver 32.0.16.1742, Windows 11 Pro; lavapipe (Mesa 26.1.2, LLVM 22.1.6) in Arch Linux WSL2
  • AI-assisted: yes, some AI assistance was used
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5152515748 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15730). Originally posted by [dantdmdarealguy](https://github.com/dantdmdarealguy) on 2026-11-04T10:07:35Z. --- ### What On GitHub's hosted Linux runner, `agc_driver_pipeline_journal`'s first run takes about 120 s and the later runs about 8 s. EagleBearerYS measured it on #15423 (runs 41752529697 and 41743726570): 119.7 s then 8.3–8.4 s with #15423, and 135.9 s then about 50 s on `main`. CI's limit is `--timeout 120`. **Cause.** The difference between the first run and the later ones is Mesa's shader cache, not anything in the test's temporary directory (each run makes a new one). - llvmpipe compiles a compute shader the first time it is dispatched. Here that takes about 0.85 s per program (i9-14900K). - The test dispatches 48 distinct compute programs: - salt 0; - salts 16–47 in the replay race case; - salts 1–3 in the newest-entries case; - salt 7 in the eviction case; - salts 1–16 in the held-module case, 11 of them new. - With an empty cache, almost all of the run is spent compiling them. A timestamped run on lavapipe shows `recorded batch still running on the GPU after 5 s … 25 s` while the race case's recording device dispatches its 32 programs. That is 28 s of the 43 s run. - The Linux CI job runs on a self-hosted runner that keeps `MESA_SHADER_CACHE_DIR=/var/cache/anyps5/mesa`, so it usually starts warm. It starts cold on a hosted runner, which is where fork runs go, and after any recompiler change that alters these modules. **Change.** The race case and the held-module case now dispatch the same 16 programs (salts 8–23), through `ReplayedCodes()`. - Salts 1–3 and 7 stay out of the shared set. The newest-entries and eviction cases need those salts not to be in the journal yet when they record them. - The race case goes from 32 programs to 16. The test now dispatches 21 distinct compute programs instead of 48. - What each case checks is unchanged: - The race case still requires `ComputePipelinesCreated() == replayedCompute + replayPresent`. - The held-module case still records and replays 16 programs, the same count as before. The race case still catches the bug #12657 fixed. With the `computePipelinesBuilding` registration that 307f2202e7 added to `ReplayComputePipeline` removed, it fails every run: | Removed registration | Runs | Result | |---|---|---| | lavapipe, Mesa cache warm | 5 | fail, `25`–`26 built for 17 replayed` | | lavapipe, Mesa cache cold | 3 | fail, `24`, `28`, `25 built for 17 replayed` | | RTX 5080 | 5 | fail, `28`–`31 built for 17 replayed` | ### Tested Windows 11 Pro, Intel Core i9-14900K, 128 GB RAM, NVIDIA GeForce RTX 5080 (driver 32.0.16.1742), WinLibs GCC 15.2.0, Release, `BUILD_TESTING=ON`. Linux: Arch Linux WSL2 on the same machine, lavapipe (Mesa 26.1.2, LLVM 22.1.6) with `GALLIUM_OVERRIDE_CPU_CAPS=avx` and `ANYPS5_REQUIRE_VULKAN=1`, as CI sets them. Timings are for the test binary. **Cold** means a new empty `MESA_SHADER_CACHE_DIR`, or on NVIDIA a new empty `__GL_SHADER_DISK_CACHE_PATH`. **Warm** means the next two runs with the same directory. `main` is `b8efa6292a`, and #15423 is its head `e9ac2db947` merged onto that `main`. | lavapipe | `main` | this PR | #15423 | #15423 + this PR | |---|---|---|---|---| | cold | 71.9 s | 45.9 s | 43.4 s | 20.9 s | | warm | 27.1, 27.2 s | 26.6, 26.2 s | 2.4, 2.5 s | 2.0, 1.9 s | | cold, pinned to 4 CPUs | — | — | 59.2 s | 23.8 s | | warm, pinned to 4 CPUs | — | — | 3.1, 3.4 s | 2.2, 2.1 s | | RTX 5080 (ctest) | `main` | this PR | #15423 | #15423 + this PR | |---|---|---|---|---| | cold | 25.8 s | 24.1 s | 6.9 s | 5.3 s | | warm | 22.6, 22.8 s | 22.5, 22.7 s | 3.9, 3.8 s | 3.9, 3.6 s | - `main`'s warm time (27 s on lavapipe, 23 s on the RTX 5080) is the undecodable-module allocation that #15423 fixes. This PR removes the cold-cache part, so the two are independent. - `agc_driver_pipeline_journal_undecodable_module` (#15423) passes with this PR on top: 0.68–0.76 s on the RTX 5080. - On the hosted runner, the 4-CPU lavapipe cold run (59.2 s) corresponds to EagleBearerYS's 119.7 s. By that ratio, this change should bring the runner's first run to roughly 48 s. - **Tests and checks:** - `ctest -R "pipeline_journal|pipeline_store|patched_libraries" --parallel 2`: 10/10 pass on Windows. `patched_libraries` passes. - `cmake --build` and `--target libs` succeed, with no warnings in the changed file. - `tools/check_test_registration.py` and `tools/check_conventions.py --base origin/main` pass. - **Validation layer, RTX 5080:** `ctest -V -R "^agc_driver_pipeline_journal$|^agc_pipeline_journal"` on `main` and on this PR. - Settings: `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, and the Khronos layer through `VK_ADD_LAYER_PATH`. - Neither log has `was not found but was requested by env var VK_INSTANCE_LAYERS`. Each has 20 `Insert instance layer "VK_LAYER_KHRONOS_validation"` lines and no `VUID-` line. - `agc_driver_pipeline_journal` took 21.9 s in both runs. ### 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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 5080, driver 32.0.16.1742, Windows 11 Pro; lavapipe (Mesa 26.1.2, LLVM 22.1.6) in Arch Linux WSL2 - [x] AI-assisted: yes, some AI assistance was used
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!15730
No description provided.