fix(agc): serialize builds of identical graphics pipelines #11914

Open
Bram910 wants to merge 4 commits from upstream-pr/11914 into main
Bram910 commented 2026-10-27 12:26:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Bram910 on 2026-10-27T12:26:47Z.


What

Concurrent misses for an identical graphics-pipeline key can currently compile the same pipeline or library part multiple times before discarding the raced result. Serialize builds for the same full key, recheck the resident entry after waiting, and release the build marker on Vulkan failures and C++ exceptions. Different keys and resident hits can continue independently. Retain the current LTO key and cache admission policies. A cache hit after waiting also returns its store hash, so the caller can memoize the pipeline for that draw shape.

Tested

Windows 11 Pro 10.0.26200, MinGW GCC 15.2, Release, same NVIDIA GeForce RTX 3080 and driver 610.47 (Windows 32.0.16.1047).

Built libSceAgcDriver, recorder/graphics/disk-cache/queue-failure test targets and this PR's added fixture target(s). Focused baseline at ca0e9557aab1d1496c2c317077dd258f2d16fbf8: 100% tests passed, 0 tests failed out of 22. This branch at da3ca94b1e64663ecbc799f7ddbeba072fbfaafd: 100% tests passed, 0 tests failed out of 32.

Both runs used ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_GPU=NVIDIA, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, and VK_LAYER_PATH=C:\VulkanSDK\1.4.363.0\Bin:

ctest --test-dir build-win -R '^agc_pipeline_(cache|library|journal|store|queue_failure)|^agc_shader_disk_cache($|_long_paths$|_host_stderr$|_pack_ownership$)' -V

Neither verbose log reports a missing validation layer, skipped/unrun selected tests, or VUID- errors. Ten deterministic concurrency/failure/teardown fixture modes, repeated 20 times each (200 executions). Existing real-Vulkan library reuse, LTO, cache, teardown, store and journal tests also run.

python tools/check_conventions.py --base origin/main and git diff --check origin/main...HEAD pass. The project's pr_overlap.py comparison logic was run against open PRs using a public REST transport adapter because local gh is unauthenticated. Its report warns about older PRs that conflict with main; their shared-file diffs were inspected separately. No equivalent fix was found. Related overlapping files may still need integration rebases as those older branches are refreshed.

No full-project suite, Linux/macOS run or new title benchmark is claimed. This submission does not establish a GTA FPS or RAM reduction.

Related stale branches #5925, #7642, #9508 and #10193 change pipeline scheduling or descriptor handling; they do not provide the same per-key build ownership. CMake-only neighbors add different test targets.

Review follow-up (2026-11-03)

Integrated current main 4f41f4c375. Addressed the waited-hit storeHash issue reported by chitters2004 and oneandonlydean: the successful lookup after acquiring the per-key build mutex now sets *storeHash = hash, matching the other successful shared-cache return paths.

The existing concurrent store fixture now captures both threads' returned hashes and requires the waited hit's hash to be nonzero and equal to the builder's. With the new assertions and the previous implementation, agc_pipeline_store_builds_shared fails with a completed lookup did not return its store hash; with the fix it passes, including 10 repeated runs.

Windows 10.0.26200.9457, WinLibs GCC 15.2 Release, NVIDIA GeForce RTX 3080 / 610.47:

  • Main production implementation: 8/8 optimized-pipeline readback cases pass. Both Pipeline.cpp and PipelineLibrary.cpp were restored from main 4f41f4c375 for this baseline; the PR's test registration remained in the build tree.
  • Change: 18/18 pass: the same eight real-Vulkan readback cases and all ten store/library build-coordination fixture modes.
  • Both verbose runs used ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_GPU=NVIDIA, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and VK_LAYER_PATH=C:\VulkanSDK\1.4.363.0\Bin. Neither log contains a missing-requested-layer warning or a VUID- error.
  • check_conventions.py --base origin/main and git diff --check pass.
cmake --build build-win --target agc_driver_pipeline_optimized_readback_tests agc_pipeline_store_builds_tests agc_pipeline_library_builds_tests -j4
ctest --test-dir build-win -R '^agc_driver_pipeline_optimized_readback_|^agc_pipeline_(store|library)_builds_' -V
ctest --test-dir build-win -R '^agc_pipeline_store_builds_shared
<!-- 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 <!-- #PR, or none -->
- [x] Fixes: none <!-- issue it closes as Fixes #N, or none -->
- [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none -->
- [x] GPUs tested: NVIDIA GeForce RTX 3080; NVIDIA driver 610.47 (32.0.16.1047); Windows 11 Pro 10.0.26200. <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a -->
- [x] AI-assisted: yes <!-- yes / no -->
 --repeat until-fail:10 --output-on-failure

No new full-suite, Linux, macOS or title-performance result is claimed for this push. The older validation below remains pinned to its original revisions.

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 3080; NVIDIA driver 610.47 (32.0.16.1047); Windows 11 Pro 10.0.26200.
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5033873851 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11914). Originally posted by [Bram910](https://github.com/Bram910) on 2026-10-27T12:26:47Z. --- ### What Concurrent misses for an identical graphics-pipeline key can currently compile the same pipeline or library part multiple times before discarding the raced result. Serialize builds for the same full key, recheck the resident entry after waiting, and release the build marker on Vulkan failures and C++ exceptions. Different keys and resident hits can continue independently. Retain the current LTO key and cache admission policies. A cache hit after waiting also returns its store hash, so the caller can memoize the pipeline for that draw shape. ### Tested Windows 11 Pro 10.0.26200, MinGW GCC 15.2, Release, same NVIDIA GeForce RTX 3080 and driver 610.47 (Windows 32.0.16.1047). Built `libSceAgcDriver`, recorder/graphics/disk-cache/queue-failure test targets and this PR's added fixture target(s). Focused baseline at `ca0e9557aab1d1496c2c317077dd258f2d16fbf8`: **100% tests passed, 0 tests failed out of 22**. This branch at `da3ca94b1e64663ecbc799f7ddbeba072fbfaafd`: **100% tests passed, 0 tests failed out of 32**. Both runs used `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_GPU=NVIDIA`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, and `VK_LAYER_PATH=C:\VulkanSDK\1.4.363.0\Bin`: ```text ctest --test-dir build-win -R '^agc_pipeline_(cache|library|journal|store|queue_failure)|^agc_shader_disk_cache($|_long_paths$|_host_stderr$|_pack_ownership$)' -V ``` Neither verbose log reports a missing validation layer, skipped/unrun selected tests, or `VUID-` errors. Ten deterministic concurrency/failure/teardown fixture modes, repeated 20 times each (200 executions). Existing real-Vulkan library reuse, LTO, cache, teardown, store and journal tests also run. `python tools/check_conventions.py --base origin/main` and `git diff --check origin/main...HEAD` pass. The project's `pr_overlap.py` comparison logic was run against open PRs using a public REST transport adapter because local gh is unauthenticated. Its report warns about older PRs that conflict with main; their shared-file diffs were inspected separately. No equivalent fix was found. Related overlapping files may still need integration rebases as those older branches are refreshed. No full-project suite, Linux/macOS run or new title benchmark is claimed. This submission does not establish a GTA FPS or RAM reduction. Related stale branches #5925, #7642, #9508 and #10193 change pipeline scheduling or descriptor handling; they do not provide the same per-key build ownership. CMake-only neighbors add different test targets. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### Review follow-up (2026-11-03) Integrated current main `4f41f4c375`. Addressed the waited-hit `storeHash` issue reported by chitters2004 and oneandonlydean: the successful lookup after acquiring the per-key build mutex now sets `*storeHash = hash`, matching the other successful shared-cache return paths. The existing concurrent store fixture now captures both threads' returned hashes and requires the waited hit's hash to be nonzero and equal to the builder's. With the new assertions and the previous implementation, `agc_pipeline_store_builds_shared` fails with `a completed lookup did not return its store hash`; with the fix it passes, including 10 repeated runs. Windows 10.0.26200.9457, WinLibs GCC 15.2 Release, NVIDIA GeForce RTX 3080 / 610.47: - Main production implementation: **8/8** optimized-pipeline readback cases pass. Both `Pipeline.cpp` and `PipelineLibrary.cpp` were restored from main `4f41f4c375` for this baseline; the PR's test registration remained in the build tree. - Change: **18/18** pass: the same eight real-Vulkan readback cases and all ten store/library build-coordination fixture modes. - Both verbose runs used `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_GPU=NVIDIA`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` and `VK_LAYER_PATH=C:\VulkanSDK\1.4.363.0\Bin`. Neither log contains a missing-requested-layer warning or a `VUID-` error. - `check_conventions.py --base origin/main` and `git diff --check` pass. ```text cmake --build build-win --target agc_driver_pipeline_optimized_readback_tests agc_pipeline_store_builds_tests agc_pipeline_library_builds_tests -j4 ctest --test-dir build-win -R '^agc_driver_pipeline_optimized_readback_|^agc_pipeline_(store|library)_builds_' -V ctest --test-dir build-win -R '^agc_pipeline_store_builds_shared <!-- 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 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: NVIDIA GeForce RTX 3080; NVIDIA driver 610.47 (32.0.16.1047); Windows 11 Pro 10.0.26200. <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no --> --repeat until-fail:10 --output-on-failure ``` No new full-suite, Linux, macOS or title-performance result is claimed for this push. The older validation below remains pinned to its original revisions. ### 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 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: NVIDIA GeForce RTX 3080; NVIDIA driver 610.47 (32.0.16.1047); Windows 11 Pro 10.0.26200. <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
MarcZX10 commented 2026-10-27 12:48:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T12:48:18Z.

Review: APPROVED


Reviewed the per-key build coordination in both CachedPipeline and LinkPipelineFromLibraries. The key-specific mutex/set is acquired outside the global cache mutex; after waiting, each path rechecks the resident cache, and RAII clears its in-flight marker on Vulkan failures or exceptions. The library store tracks active builds so clear waits for them. The added synthetic tests cover shared keys, distinct keys, cache hits, failure/exception cleanup and clear-time waiting; the PR reports 32/32 focused Windows tests with validation enabled, and its Windows CI plus conventions/intake/labels/report checks pass. Linux product jobs were skipped by path policy; I did not run the GPU suite locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5667264925 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11914#pullrequestreview-5667264925). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T12:48:18Z. **Review:** APPROVED --- Reviewed the per-key build coordination in both `CachedPipeline` and `LinkPipelineFromLibraries`. The key-specific mutex/set is acquired outside the global cache mutex; after waiting, each path rechecks the resident cache, and RAII clears its in-flight marker on Vulkan failures or exceptions. The library store tracks active builds so clear waits for them. The added synthetic tests cover shared keys, distinct keys, cache hits, failure/exception cleanup and clear-time waiting; the PR reports 32/32 focused Windows tests with validation enabled, and its Windows CI plus conventions/intake/labels/report checks pass. Linux product jobs were skipped by path policy; I did not run the GPU suite locally.
XairRrR commented 2026-11-03 11:20:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T11:20:47Z.

Review: APPROVED


Reviewed — approved

The per-key serialization of identical graphics-pipeline and library-part builds is correct. The new fixtures pass on the merged tree and fail with main's production files. The two automated flags (agc_map_gate_disjoint, one VUID) also reproduce with main's production files.

What I ran

Head 951b79acc77505d59e4c1c976312b3fff58e5bf7, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree 1acd9902125e6099293588bd55055d974c5960f6 (Debian 13 VM, GCC 14.2.0, Release, lavapipe / Mesa 26.1.6, LLVM 19).

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...951b79acc77505d59e4c1c976312b3fff58e5bf7
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build -j8 --test-load 32 -R "^agc_pipeline_(store|library)_builds_|^agc_map_gate_disjoint$" --output-on-failure
ctest --test-dir build -R "^agc_map_gate_disjoint$" --repeat until-fail:20 --output-on-failure
ctest --test-dir build -j8 --test-load 32 -R "^agc_pipeline_(store|library)_builds_" --repeat until-fail:20
# negative control: Pipeline.cpp and PipelineLibrary.cpp restored from main
ninja -C build -j32 -l32 agc_driver_recorder_tests agc_pipeline_store_builds_tests agc_pipeline_library_builds_tests agc_driver_native_multisample_depth_tests
ctest --test-dir build -j8 --test-load 32 -R "^agc_pipeline_(store|library)_builds_" --output-on-failure
ctest --test-dir build -R "^agc_map_gate_disjoint$" --repeat until-fail:30
env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -V -R "^agc_driver_native_depth_uniform_planes$"   # merged and main production files

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Configure / build / libs (script) passed
New tests agc_pipeline_store_builds_* (5), agc_pipeline_library_builds_* (5) 10/10 pass; 20 repeats each under -j8 pass; each run ≤ 0.35 s
agc_map_gate_disjoint (script's only new failure) flaky: failed on the 2nd of 20 repeats on the merged tree, and on the 8th of 30 repeats with main's Pipeline.cpp/PipelineLibrary.cpp. It comes from main, not this PR
Validation: agc_driver_native_depth_uniform_planes new VUID-vkCmdDispatch-groupCountX-00386 (script, "test not run on main") 8 occurrences on the merged tree and the same 8 with main's production files; the layer loaded in both runs. It comes from main, not this PR
Other selected tests (script) 2117 passed; the 7 known failures also fail on main; 114 expected skips
agc_map_gate_disjoint failure (same output on the merged tree and with main's production files)
[libc] unhandled exception 'St13runtime_error' thrown from 0x564020783afe
Vulkan device: llvmpipe (LLVM 19.1.7, 256 bits)
host imports are compared
AGC graphics: (d) no watched block on other stripes

Negative control

I restored core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp and PipelineLibrary.cpp from main, kept the PR's tests and rebuilt. 7 of the 10 new tests failed:

Output
agc_pipeline_store_builds_shared / failure / exception: FAIL: lookup did not wait only for its own in-flight pipeline
agc_pipeline_library_builds_shared / failure / exception: FAIL: the same library part was compiled concurrently more than once
agc_pipeline_library_builds_clear: FAIL: clearing allowed duplicate part builds
30% tests passed, 7 tests failed out of 10

The 3 modes that still pass (store_builds_cached, store_builds_independent, library_builds_independent) check that unrelated work is not blocked, so they should pass on main too. I then restored the merged files and rebuilt; git status --porcelain is empty.

Findings

Blocking

None.

Non-blocking

  • The per-key build mutex is held across the journal append. build (see Pipeline.cpp#L1309-L1319) is destroyed only at function return. So threads waiting on the same key also wait for RecordGraphicsPipeline at Pipeline.cpp#L1382, even though the entry is already resident after the store insert. Rendering is still correct; this only adds latency for the waiter. Releasing build.lock once the insert block has finished would let waiters hit straight away.
  • The description is garbled. In the "Review follow-up" section, a copy of the checklist is pasted inside the text code block, which splits the --repeat until-fail:10 command line. The real checklist further down is complete (Depends on, Fixes, Unblocks, GPUs tested and AI-assisted are all filled in). Cosmetic only.

Code reading, for the record:

  • Lock order is always per-key mutex, then store.mutex. Waiters release store.mutex before taking the per-key mutex, and ~PipelineBuild takes store.mutex while the per-key lock is still held. There is no inversion.
  • use_count() == 1 is evaluated under store.mutex, the same mutex under which waiters get their shared_ptr. An expired weak_ptr is replaced through insert_or_assign.
  • In LinkPipelineFromLibraries, a thread holds a part marker only while it builds that part, and drops it before the next part. A waiting thread holds no marker, so cross-part waits cannot deadlock. PartBuild re-locks before erasing on both the Check throw and the exception path.
  • The waited-hit storeHash fix reported by chitters2004 and oneandonlydean is in Pipeline.cpp#L1320-L1328, and store_builds_shared checks it. I confirm that their finding is resolved.

Not verified

  • I had no hardware GPU, only lavapipe. The NVIDIA RTX 3080 results in the description and the NVIDIA CI comments are the author's and TechLevelZero's; I did not reproduce them. The new fixtures use stub Vulkan entry points, so they do not depend on the driver.
  • I did not run the full suite or any title. I did not measure throughput when several draw threads miss on the same key.
  • The VUID-vkCmdCopyBuffer-commonparent reported on agc_driver_depth_clear_hle in the first NVIDIA CI run, at the older head da3ca94, did not reappear in the later run at d64f238. I did not investigate it on lavapipe.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5751244414 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11914#pullrequestreview-5751244414). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T11:20:47Z. **Review:** APPROVED --- # Reviewed — approved The per-key serialization of identical graphics-pipeline and library-part builds is correct. The new fixtures pass on the merged tree and fail with `main`'s production files. The two automated flags (`agc_map_gate_disjoint`, one VUID) also reproduce with `main`'s production files. ## What I ran Head `951b79acc77505d59e4c1c976312b3fff58e5bf7`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged tree `1acd9902125e6099293588bd55055d974c5960f6` (Debian 13 VM, GCC 14.2.0, Release, lavapipe / Mesa 26.1.6, LLVM 19). ``` git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...951b79acc77505d59e4c1c976312b3fff58e5bf7 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build -j8 --test-load 32 -R "^agc_pipeline_(store|library)_builds_|^agc_map_gate_disjoint$" --output-on-failure ctest --test-dir build -R "^agc_map_gate_disjoint$" --repeat until-fail:20 --output-on-failure ctest --test-dir build -j8 --test-load 32 -R "^agc_pipeline_(store|library)_builds_" --repeat until-fail:20 # negative control: Pipeline.cpp and PipelineLibrary.cpp restored from main ninja -C build -j32 -l32 agc_driver_recorder_tests agc_pipeline_store_builds_tests agc_pipeline_library_builds_tests agc_driver_native_multisample_depth_tests ctest --test-dir build -j8 --test-load 32 -R "^agc_pipeline_(store|library)_builds_" --output-on-failure ctest --test-dir build -R "^agc_map_gate_disjoint$" --repeat until-fail:30 env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -V -R "^agc_driver_native_depth_uniform_planes$" # merged and main production files ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Configure / build / `libs` (script) | passed | | New tests `agc_pipeline_store_builds_*` (5), `agc_pipeline_library_builds_*` (5) | 10/10 pass; 20 repeats each under `-j8` pass; each run ≤ 0.35 s | | `agc_map_gate_disjoint` (script's only new failure) | flaky: failed on the 2nd of 20 repeats on the merged tree, and on the 8th of 30 repeats with `main`'s `Pipeline.cpp`/`PipelineLibrary.cpp`. It comes from `main`, not this PR | | Validation: `agc_driver_native_depth_uniform_planes` new `VUID-vkCmdDispatch-groupCountX-00386` (script, "test not run on main") | 8 occurrences on the merged tree and the same 8 with `main`'s production files; the layer loaded in both runs. It comes from `main`, not this PR | | Other selected tests (script) | 2117 passed; the 7 known failures also fail on `main`; 114 expected skips | <details><summary><code>agc_map_gate_disjoint</code> failure (same output on the merged tree and with main's production files)</summary> ``` [libc] unhandled exception 'St13runtime_error' thrown from 0x564020783afe Vulkan device: llvmpipe (LLVM 19.1.7, 256 bits) host imports are compared AGC graphics: (d) no watched block on other stripes ``` </details> ## Negative control I restored `core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp` and `PipelineLibrary.cpp` from `main`, kept the PR's tests and rebuilt. 7 of the 10 new tests failed: <details><summary>Output</summary> ``` agc_pipeline_store_builds_shared / failure / exception: FAIL: lookup did not wait only for its own in-flight pipeline agc_pipeline_library_builds_shared / failure / exception: FAIL: the same library part was compiled concurrently more than once agc_pipeline_library_builds_clear: FAIL: clearing allowed duplicate part builds 30% tests passed, 7 tests failed out of 10 ``` </details> The 3 modes that still pass (`store_builds_cached`, `store_builds_independent`, `library_builds_independent`) check that unrelated work is not blocked, so they should pass on `main` too. I then restored the merged files and rebuilt; `git status --porcelain` is empty. ## Findings ### Blocking None. ### Non-blocking - **The per-key build mutex is held across the journal append.** `build` (see [Pipeline.cpp#L1309-L1319](https://github.com/boykopovar/AnyPS5/blob/951b79acc77505d59e4c1c976312b3fff58e5bf7/core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp#L1309-L1319)) is destroyed only at function return. So threads waiting on the same key also wait for `RecordGraphicsPipeline` at [Pipeline.cpp#L1382](https://github.com/boykopovar/AnyPS5/blob/951b79acc77505d59e4c1c976312b3fff58e5bf7/core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp#L1382), even though the entry is already resident after the store insert. Rendering is still correct; this only adds latency for the waiter. Releasing `build.lock` once the insert block has finished would let waiters hit straight away. - **The description is garbled.** In the "Review follow-up" section, a copy of the checklist is pasted inside the `text` code block, which splits the `--repeat until-fail:10` command line. The real checklist further down is complete (Depends on, Fixes, Unblocks, GPUs tested and AI-assisted are all filled in). Cosmetic only. Code reading, for the record: - Lock order is always per-key mutex, then `store.mutex`. Waiters release `store.mutex` before taking the per-key mutex, and `~PipelineBuild` takes `store.mutex` while the per-key lock is still held. There is no inversion. - `use_count() == 1` is evaluated under `store.mutex`, the same mutex under which waiters get their `shared_ptr`. An expired `weak_ptr` is replaced through `insert_or_assign`. - In `LinkPipelineFromLibraries`, a thread holds a part marker only while it builds that part, and drops it before the next part. A waiting thread holds no marker, so cross-part waits cannot deadlock. `PartBuild` re-locks before erasing on both the `Check` throw and the exception path. - The waited-hit `storeHash` fix reported by chitters2004 and oneandonlydean is in [Pipeline.cpp#L1320-L1328](https://github.com/boykopovar/AnyPS5/blob/951b79acc77505d59e4c1c976312b3fff58e5bf7/core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp#L1320-L1328), and `store_builds_shared` checks it. I confirm that their finding is resolved. ## Not verified - I had no hardware GPU, only lavapipe. The NVIDIA RTX 3080 results in the description and the NVIDIA CI comments are the author's and TechLevelZero's; I did not reproduce them. The new fixtures use stub Vulkan entry points, so they do not depend on the driver. - I did not run the full suite or any title. I did not measure throughput when several draw threads miss on the same key. - The `VUID-vkCmdCopyBuffer-commonparent` reported on `agc_driver_depth_clear_hle` in the first NVIDIA CI run, at the older head `da3ca94`, did not reappear in the later run at `d64f238`. I did not investigate it on lavapipe. <!-- anyps5-bots job=2062 head=951b79acc77505d59e4c1c976312b3fff58e5bf7 -->
MarcZX10 commented 2026-11-20 09:52:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T09:52:44Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this change; the review points below are optional.

What I ran

Reviewed head 951b79acc77505d59e4c1c976312b3fff58e5bf7 using repo_read.py reader tools. I inspected the prepared description, commits, manifest and diff, and read all six changed repository files. No executable checks were run; test results in the PR description are author-reported.

Results

Check Result Note
Changed code review passed All six changed files read
Tests in this review not run No execution environment available
Author-reported tests not run Not independently verified

Findings

Blocking

None.

Non-blocking

None.

Not verified

The PR's reported test runs, build, conventions check, and diff check were not independently verified. review/files.json was not available through the reader; the manifest and file listing show six changed files, all included and read. No changed files were excluded in the manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5990746044 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11914#pullrequestreview-5990746044). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T09:52:44Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this change; the review points below are optional. ## What I ran Reviewed head `951b79acc77505d59e4c1c976312b3fff58e5bf7` using `repo_read.py` reader tools. I inspected the prepared description, commits, manifest and diff, and read all six changed repository files. No executable checks were run; test results in the PR description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | All six changed files read | | Tests in this review | not run | No execution environment available | | Author-reported tests | not run | Not independently verified | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The PR's reported test runs, build, conventions check, and diff check were not independently verified. `review/files.json` was not available through the reader; the manifest and file listing show six changed files, all included and read. No changed files were excluded in the manifest. ## To get this to a good state Nothing is required.
ligmaSec commented 2026-12-03 22:56:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:56:36Z.

Review: COMMENTED


The trial merge is clean. The new store and library fixtures cover same-key sharing, independence across keys, and retry after both a Vulkan failure and a C++ exception. Please retain the clear-versus-build fixture as well as the resident lookup control. Together they check that waiters are woken on failure and that clearing cannot destroy a part still being published. I have no paired Vulkan result for this head yet.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6180102905 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11914#pullrequestreview-6180102905). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T22:56:36Z. **Review:** COMMENTED --- The trial merge is clean. The new store and library fixtures cover same-key sharing, independence across keys, and retry after both a Vulkan failure and a C++ exception. Please retain the clear-versus-build fixture as well as the resident lookup control. Together they check that waiters are woken on failure and that clearing cannot destroy a part still being published. I have no paired Vulkan result for this head yet. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/11914:upstream-pr/11914'
git switch 'upstream-pr/11914'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/11914'
git switch 'upstream-pr/11914'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/11914'
git switch 'upstream-pr/11914'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/11914'
git switch 'main'
git merge --squash 'upstream-pr/11914'
git switch 'main'
git merge --ff-only 'upstream-pr/11914'
git switch 'main'
git merge 'upstream-pr/11914'
git push origin 'main'
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!11914
No description provided.