perf(agc): the draw pipeline retires finished commits on a reaper thread #6617

Closed
TheAggie wants to merge 5 commits from upstream-pr/6617 into main
TheAggie commented 2026-10-15 23:11:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-15T23:11:17Z.


What

With pipelined draws the committer is the thread the queue worker waits for. After each commit it popped the item from the pipeline's deque under the pipeline mutex, which destroyed the commit's closure right there: the decode's programs, the compiled results, the stage captures, the regions, the snapshots and the rest, twenty or more heap frees a draw, on the critical thread and with the lock held while the worker's enqueue waited for it.

  • DrawPipeline::run moves the finished item out under the lock and hands it to retire, which queues it for a reaper thread. The reaper destroys batches: it is woken only when 64 items have gathered, and otherwise checks every 2 ms, so the committer pays one deque move and no wake per draw. (Waking it per commit cost more than it saved.)
  • APS5_NO_COMMIT_REAPER=1 destroys the item in place as before, though after the lock.
  • The drain, the outstanding count and the failure reporting are unchanged: a commit counts as done when it has run, as before; only the memory of its closure is released later. Nothing in a closure's destruction depends on the thread: the stage variants and entries return to mutex-guarded pools, ShaderMemory returns its pages to the destroying thread's pool (as it already did on the committer), and the rest are plain frees.

Tested

Windows 11, NVIDIA GeForce RTX 5070 Ti, MinGW-w64 GCC 15.2.0, on main ce991f1ec.

  • ctest: 1278 of 1297 pass, 14 skipped. guest_call_trace_abort and windows_backtrace_report fail, and fail the same way on plain main here; agc_driver_prepared_graphics_prebuild_0/_1 and undeliverable_host_exception fail under my test runner because it skips their environment changes and pass pattern, and pass run with those. agc_driver_gpu_indirect_arguments_misaligned_writer_ahead, new on this main, does not compile with MinGW (alignas(65536) exceeds the object file maximum of 8192) and was left out of the run. The pipelined, draw-cache and PM4 tests (13) also pass with APS5_NO_COMMIT_REAPER=1.
  • RetroArch (PPSA99169) with its PCSX2 core running Ratchet & Clank's intro, pipelined draws, immediate present, APS5_BATCH_CAP=256, audio muted, same build with and without this change, two alternating runs each: audio produced in the heavy intro scenes 52-53% of real time without, 55-56% with (the base here also carries #4943, #5609, #6312, #6538, #6539 and #6566, which make its draws hit the cache; the change itself is independent of them).

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 in TechnicalDebt
  • 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
  • AI-assisted: yes. Written with Claude Code under my direction.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4881036588 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617). Originally posted by [TheAggie](https://github.com/TheAggie) on 2026-10-15T23:11:17Z. --- ### What With pipelined draws the committer is the thread the queue worker waits for. After each commit it popped the item from the pipeline's deque under the pipeline mutex, which destroyed the commit's closure right there: the decode's programs, the compiled results, the stage captures, the regions, the snapshots and the rest, twenty or more heap frees a draw, on the critical thread and with the lock held while the worker's enqueue waited for it. - `DrawPipeline::run` moves the finished item out under the lock and hands it to `retire`, which queues it for a reaper thread. The reaper destroys batches: it is woken only when 64 items have gathered, and otherwise checks every 2 ms, so the committer pays one deque move and no wake per draw. (Waking it per commit cost more than it saved.) - `APS5_NO_COMMIT_REAPER=1` destroys the item in place as before, though after the lock. - The drain, the outstanding count and the failure reporting are unchanged: a commit counts as done when it has run, as before; only the memory of its closure is released later. Nothing in a closure's destruction depends on the thread: the stage variants and entries return to mutex-guarded pools, `ShaderMemory` returns its pages to the destroying thread's pool (as it already did on the committer), and the rest are plain frees. ### Tested Windows 11, NVIDIA GeForce RTX 5070 Ti, MinGW-w64 GCC 15.2.0, on main `ce991f1ec`. - `ctest`: 1278 of 1297 pass, 14 skipped. `guest_call_trace_abort` and `windows_backtrace_report` fail, and fail the same way on plain main here; `agc_driver_prepared_graphics_prebuild_0`/`_1` and `undeliverable_host_exception` fail under my test runner because it skips their environment changes and pass pattern, and pass run with those. `agc_driver_gpu_indirect_arguments_misaligned_writer_ahead`, new on this main, does not compile with MinGW (`alignas(65536)` exceeds the object file maximum of 8192) and was left out of the run. The pipelined, draw-cache and PM4 tests (13) also pass with `APS5_NO_COMMIT_REAPER=1`. - RetroArch (PPSA99169) with its PCSX2 core running Ratchet & Clank's intro, pipelined draws, immediate present, `APS5_BATCH_CAP=256`, audio muted, same build with and without this change, two alternating runs each: audio produced in the heavy intro scenes 52-53% of real time without, 55-56% with (the base here also carries #4943, #5609, #6312, #6538, #6539 and #6566, which make its draws hit the cache; the change itself is independent of them). ### Checklist - [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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes. Written with Claude Code under my direction. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jotitadev commented 2026-10-16 01:55:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T01:55:57Z.

Review: COMMENTED


On Linux this crashes draw tests at process exit. Each test prints its final success line, then dies with double free or corruption (out) or a SegFault. APS5_NO_COMMIT_REAPER=1 makes the crash go away.

Machine: NVIDIA GeForce RTX 3070, driver 595.99.02, Vulkan 1.4.329, Ubuntu 26.04 (kernel 7.0.0-38), i7-8700. GCC 15.2 (glibc), Release, BUILD_TESTING=ON, ANYPS5_GPU="NVIDIA GeForce RTX 3070". Head 74dad0097 merged into main 5d9dcc42d (clean merge).

main 5d9dcc42d this PR this PR + APS5_NO_COMMIT_REAPER=1
agc_driver_draw_cache_reuse_off, 20 runs passes in every suite run 15/20 fail 0/20 fail
agc_driver_inactive_vertex_point_size, 20 runs passes in every suite run 20/20 fail 0/20 fail
pipelin|draw_cache|agc_driver_pm4 (30 tests), 3 runs 30/30 2 or 3 fail per run (draw_cache_reuse*) 30/30
  • ctest -R "^agc|shader|recompiler" -j1 (flip, display and lds_atomics64 excluded): 7 failures, against 1 on main. The 6 new ones are all SegFault or Subprocess aborted at about 1.58 s: draw_cache_reuse_off, inactive_vertex_point_size, mesh_index_cache, msaa_enable_single_sample, sample_mask_draw and stencil_ref_export_unused. The remaining failure is store_over_untracked, which fails on main too (#6347).
  • Verbose output of one failing run: A repeated draw reused the cached draw without graphics pipeline libraries, then double free or corruption (out), then Subprocess aborted. The test's own checks have already passed at that point.

This is probably a lifetime problem. reap() loops forever and nothing stops or joins reaper. Queue0()'s pipeline is leaked on purpose, so the reaper is still running during exit(). Whatever was retired in the last ~2 ms is then destroyed on the reaper thread while static destructors tear down the pools and caches their closures return memory to. On main the closure is destroyed before outstanding drops, so nothing outlives the last drain. I did not take a backtrace. The env toggle and the timing (after the test's last line) both point there. A drain or shutdown that flushes retired on the caller would probably fix it, as would joining the reaper.

GPUs tested: NVIDIA GeForce RTX 3070, driver 595.99.02, Ubuntu 26.04

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5542083088 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#pullrequestreview-5542083088). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-16T01:55:57Z. **Review:** COMMENTED --- On Linux this crashes draw tests at process exit. Each test prints its final success line, then dies with `double free or corruption (out)` or a SegFault. `APS5_NO_COMMIT_REAPER=1` makes the crash go away. **Machine:** NVIDIA GeForce RTX 3070, driver 595.99.02, Vulkan 1.4.329, Ubuntu 26.04 (kernel 7.0.0-38), i7-8700. GCC 15.2 (glibc), Release, `BUILD_TESTING=ON`, `ANYPS5_GPU="NVIDIA GeForce RTX 3070"`. Head `74dad0097` merged into `main` `5d9dcc42d` (clean merge). | | `main` 5d9dcc42d | this PR | this PR + `APS5_NO_COMMIT_REAPER=1` | |---|---|---|---| | `agc_driver_draw_cache_reuse_off`, 20 runs | passes in every suite run | 15/20 fail | 0/20 fail | | `agc_driver_inactive_vertex_point_size`, 20 runs | passes in every suite run | 20/20 fail | 0/20 fail | | `pipelin\|draw_cache\|agc_driver_pm4` (30 tests), 3 runs | 30/30 | 2 or 3 fail per run (`draw_cache_reuse*`) | 30/30 | - `ctest -R "^agc|shader|recompiler" -j1` (flip, display and `lds_atomics64` excluded): 7 failures, against 1 on `main`. The 6 new ones are all `SegFault` or `Subprocess aborted` at about 1.58 s: `draw_cache_reuse_off`, `inactive_vertex_point_size`, `mesh_index_cache`, `msaa_enable_single_sample`, `sample_mask_draw` and `stencil_ref_export_unused`. The remaining failure is `store_over_untracked`, which fails on `main` too (#6347). - Verbose output of one failing run: `A repeated draw reused the cached draw without graphics pipeline libraries`, then `double free or corruption (out)`, then `Subprocess aborted`. The test's own checks have already passed at that point. This is probably a lifetime problem. `reap()` loops forever and nothing stops or joins `reaper`. `Queue0()`'s pipeline is leaked on purpose, so the reaper is still running during `exit()`. Whatever was retired in the last ~2 ms is then destroyed on the reaper thread while static destructors tear down the pools and caches their closures return memory to. On `main` the closure is destroyed before `outstanding` drops, so nothing outlives the last drain. I did not take a backtrace. The env toggle and the timing (after the test's last line) both point there. A drain or shutdown that flushes `retired` on the caller would probably fix it, as would joining the reaper. GPUs tested: NVIDIA GeForce RTX 3070, driver 595.99.02, Ubuntu 26.04 Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
fma-rc commented 2026-10-16 04:17:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-16T04:17:44Z.

Review: CHANGES_REQUESTED


I measured this in Astro's Playroom's heavy gameplay scene on an RTX 5080. The base is main 5d9dcc42d with and without this PR, hidden, with a 20 s window and two alternating rounds. Main gave 12.17 and 11.72 FPS; this PR gave 12.76 and 12.81. In the trace, queue 0 waits 4.4 µs per draw for room instead of 6.0, and the frames match main's.

The exit crash jotitadev reported reproduces on AMD too. On a Radeon 680M (RADV), agc_driver_draw_cache_reuse_off aborts with double free or corruption (!prev) in 5 of 10 runs with this PR. It passes 10 of 10 with APS5_NO_COMMIT_REAPER=1, and 10 of 10 on main. My Playroom runs end with a kill, so they never reach that path.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5543015800 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#pullrequestreview-5543015800). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-16T04:17:44Z. **Review:** CHANGES_REQUESTED --- I measured this in Astro's Playroom's heavy gameplay scene on an RTX 5080. The base is main 5d9dcc42d with and without this PR, hidden, with a 20 s window and two alternating rounds. Main gave 12.17 and 11.72 FPS; this PR gave 12.76 and 12.81. In the trace, queue 0 waits 4.4 µs per draw for room instead of 6.0, and the frames match main's. The exit crash jotitadev reported reproduces on AMD too. On a Radeon 680M (RADV), `agc_driver_draw_cache_reuse_off` aborts with `double free or corruption (!prev)` in 5 of 10 runs with this PR. It passes 10 of 10 with `APS5_NO_COMMIT_REAPER=1`, and 10 of 10 on main. My Playroom runs end with a kill, so they never reach that path.
parl0v commented 2026-10-16 22:14:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-16T22:14:03Z.


Data point from a CPU-bound scene on Windows: RTX 3060 12 GB (NVIDIA 617.42), i5-12400F, Windows 10 19045, MinGW GCC Release. Minecraft Dungeons II (PPSA16064 01.100.100), title screen, no input, 200 s rows, APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1; main bc3c0fc13 vs main + this PR, interleaved with five other PRs in one batch, two rounds. FPS is the mean of the last 10 [present] windows, GPU busy and idle gaps per frame over the last 8. This scene is CPU-bound on this machine (45-47 ms of idle gaps per frame).

libs FPS GPU busy idle gaps
main 6.70 / 6.60 105 / 106 ms 45 / 46 ms
+ this PR (74dad0097) 6.88 / 6.95 (+4.0 %) 104 / 102 ms 42 / 42 ms

Above main in both rounds and the only one of the six outside the spread: the idle gaps drop by 3-4 ms per frame with GPU busy unchanged, so the time comes off the CPU side, as you'd expect from moving the retirement off the recording thread. In earlier batches on this scene the largest single-PR gains were +1.3 to +1.6 %. 0 fatal.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6225713737 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#issuecomment-6225713737). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-16T22:14:03Z. --- Data point from a CPU-bound scene on Windows: RTX 3060 12 GB (NVIDIA 617.42), i5-12400F, Windows 10 19045, MinGW GCC Release. Minecraft Dungeons II (PPSA16064 01.100.100), title screen, no input, 200 s rows, `APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1`; `main` bc3c0fc13 vs `main` + this PR, interleaved with five other PRs in one batch, two rounds. FPS is the mean of the last 10 `[present]` windows, GPU busy and idle gaps per frame over the last 8. This scene is CPU-bound on this machine (45-47 ms of idle gaps per frame). | libs | FPS | GPU busy | idle gaps | |---|---|---|---| | `main` | 6.70 / 6.60 | 105 / 106 ms | 45 / 46 ms | | + this PR (74dad0097) | 6.88 / 6.95 (**+4.0 %**) | 104 / 102 ms | **42 / 42** ms | Above `main` in both rounds and the only one of the six outside the spread: the idle gaps drop by 3-4 ms per frame with GPU busy unchanged, so the time comes off the CPU side, as you'd expect from moving the retirement off the recording thread. In earlier batches on this scene the largest single-PR gains were +1.3 to +1.6 %. 0 fatal. AI-assisted: yes (Claude Code)
parl0v commented 2026-10-16 22:59:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-16T22:59:02Z.


A second title for comparison, same box and build (main bc3c0fc13 vs main + 74dad0097): Sword of the Sea (PPSA25344) title screen, 200 s rows, three rounds alternating.

libs FPS GPU busy idle gaps
main 9.60 / 9.54 / 9.60 80 / 80 / 80 ms 24 / 25 / 24 ms
+ this PR 9.59 / 9.60 / 9.60 (+0.2 %) 80 / 80 / 80 ms 25 / 25 / 24 ms

Flat here, which fits: this scene has about half the idle gaps per frame of the Minecraft Dungeons II title (24 ms against 45 ms), so there is less CPU-side waiting for the reaper to take off. No regression, 0 fatal.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6226266714 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#issuecomment-6226266714). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-16T22:59:02Z. --- A second title for comparison, same box and build (`main` bc3c0fc13 vs `main` + 74dad0097): Sword of the Sea (PPSA25344) title screen, 200 s rows, three rounds alternating. | libs | FPS | GPU busy | idle gaps | |---|---|---|---| | `main` | 9.60 / 9.54 / 9.60 | 80 / 80 / 80 ms | 24 / 25 / 24 ms | | + this PR | 9.59 / 9.60 / 9.60 (+0.2 %) | 80 / 80 / 80 ms | 25 / 25 / 24 ms | Flat here, which fits: this scene has about half the idle gaps per frame of the Minecraft Dungeons II title (24 ms against 45 ms), so there is less CPU-side waiting for the reaper to take off. No regression, 0 fatal. AI-assisted: yes (Claude Code)
eliyarson commented 2026-10-17 00:17:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by eliyarson on 2026-10-17T00:17:32Z.


I tested this PR locally and found a double free in some agc_ tests. Below: the finding, then a measurement of destroying the closure outside the mutex on its own.

Setup. Upstream main at 72c5eed1f plus local diagnostic patches (my local branch f62f3f762). Section 1 and the earlier batch in section 2 have #6617 applied on top; the table in section 2 is that base without #6617. Release, Linux (CachyOS), Ryzen 9 5950X, RTX 3080 Ti, NVIDIA 610.57.04. Hades II hub, pinned to cores 8-15,24-31 with taskset, save data restored and checked before every run.

1. Double free in the tests.

  • With the reaper on (default), a full parallel ctest -R '^agc_' run aborted in agc_driver_draw_cache_reuse, agc_driver_draw_cache_reuse_off and agc_driver_msaa_enable_single_sample, and agc_driver_stencil_ref_export_unused crashed. A -j1 re-run of the failing tests aborted in the same four. With APS5_NO_COMMIT_REAPER=1 or APS5_PIPELINED_DRAWS=0 they passed.
  • No backtrace: a gdb run of draw_cache_reuse passed. The cause is from reading the code: the reaper is never joined and DrawPipeline is leaked, so up to 63 retired items can outlive device.Reset() in Driver::stop() and be destroyed afterwards without the GPU lock.
  • DrawPipeline::Quiesce() (wait for items empty, set a stop flag under retireMutex, join the reaper, destroy the rest), called in Driver::stop() before the GPU lock, gave no abort in 11 runs with the reaper on (ten at -j1, one at -j4). That is not proof the race is fixed. It is about 30 lines; I can send it as a commit.
  • A window is left: run() moves the item to a local done, drops the lock, then calls retire(std::move(done)), so Quiesce() can return while the committer holds the last popped item. A retiring counter (incremented under the lock when the item is moved out, decremented after the destroy), with Quiesce() waiting for items.empty() && retiring == 0, closes it for Quiesce(). With the reaper, making Drain() wait for it too would likely cost the gain; that is inference, not measured. I have not added the counter on top of the reaper.

2. Destroying the closure outside the mutex accounts for part of the gain on its own. Same binary, only that change, no reaper thread, toggled by an environment variable. n=4 per arm, interleaved (OFF ON ON OFF ON OFF OFF ON), no crashes:

Arm FPS (mean ± sd) 1% low (mean ± sd)
baseline 62.45 ± 0.67 45.85 ± 0.15
closure destroyed outside the mutex 66.93 ± 0.60 50.11 ± 0.24

In an earlier batch (n=4 per arm, interleaved, Quiesce fix applied), #6617 with the reaper gave 71.09 ± 0.47 FPS and with APS5_NO_COMMIT_REAPER=1 66.27 ± 1.47. The reaper-off path also destroys the item after the lock is released, so its roughly 4 FPS gain over a plain baseline build is probably the same effect (untested). If so, about half the gain is the unlocked destroy and half the reaper, which costs about 2.2 ms/frame of CPU on another core. The batches used different binaries at different times, so I am not comparing numbers across them.

One title, one machine, pinned cores. No unpinned runs, no other game, no TSan.

3. The patch. The variant from section 2 is below. The game runs used the opt-in version of the switch; with the default flipped (APS5_NO_COMMIT_DESTROY_UNLOCKED=1 restores destroying inside the lock) I re-ran the agc_ tests in both modes, not the game. It is against current main (85643f75e): git apply --check passes and DrawPipeline.cpp compiles; I have not done a full build or run tests on that base. It does not apply on #6617's head (74dad0097): it replaces #6617's run() change instead of stacking on it, so on the PR the retiring decrement would move to after retire() returns. It covers only the no-reaper case. I can push it as a branch on my fork or as a commit on top of this PR if you want it; I will not open a separate PR.

diff --git a/core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp b/core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp
--- a/core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp
+++ b/core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp
@@ -58,6 +58,7 @@ private:
     std::exception_ptr failure;
     std::atomic<std::size_t> outstanding{0};
     std::uint32_t idleWaiters = 0;
+    std::uint32_t retiring = 0;
     bool committerWaiting = false;
     bool stopped = false;
     std::thread thread;
diff --git a/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp b/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp
--- a/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp
+++ b/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp
@@ -117,6 +117,10 @@ void DrawPipeline::report(std::chrono::steady_clock::time_point now) {
 }
 
 void DrawPipeline::run() {
+    static const bool destroyUnlocked = [] {
+        const char* text = std::getenv("APS5_NO_COMMIT_DESTROY_UNLOCKED");
+        return text == nullptr || text[0] != '1';
+    }();
     for (;;) {
         Commit* commit = nullptr;
         {
@@ -146,12 +150,23 @@ void DrawPipeline::run() {
             stopped = true;
             if (!shutdown) Driver::Get().ReportFailure(fatal);
         }
-        std::lock_guard lock(mutex);
+        std::unique_lock lock(mutex);
+        std::optional<Item> finished;
+        if (destroyUnlocked) {
+            finished = std::move(items.front());
+            ++retiring;
+        }
         items.pop_front();
         ++commits;
         commitNs += spent;
         if (failed) ++commitErrors;
         if (fatal != nullptr && failure == nullptr) failure = fatal;
+        if (finished.has_value()) {
+            lock.unlock();
+            finished.reset();
+            lock.lock();
+            --retiring;
+        }
         outstanding.fetch_sub(1, std::memory_order_release);
         if (idleWaiters != 0) idle.notify_all();
     }
@@ -164,7 +179,7 @@ void DrawPipeline::Drain(DrainReason reason, std::uint32_t opcode) {
     const auto start = std::chrono::steady_clock::now();
     std::unique_lock lock(mutex);
     ++idleWaiters;
-    idle.wait(lock, [&] { return items.empty(); });
+    idle.wait(lock, [&] { return items.empty() && retiring == 0; });
     --idleWaiters;
     const auto index = static_cast<std::size_t>(reason);
     ++drains[index];
  • Test (not posted): the destructor signals entry and sleeps 20 ms, then Drain() must return only after it finished. Without && retiring == 0 it failed 20 of 20; restored, 0 of 20.
  • Overlaps() and PendingLabel() scan items only. Before, the closure was destroyed inside pop_front() under the mutex, so they could not run during the destroy; now they can, and the item is not visible to them while it is destroyed. That assumes closure destructors do not touch guest memory.

LLM assistance used. I ran the builds and tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6227223942 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#issuecomment-6227223942). Originally posted by [eliyarson](https://github.com/eliyarson) on 2026-10-17T00:17:32Z. --- I tested this PR locally and found a double free in some `agc_` tests. Below: the finding, then a measurement of destroying the closure outside the mutex on its own. **Setup.** Upstream main at 72c5eed1f plus local diagnostic patches (my local branch f62f3f762). Section 1 and the earlier batch in section 2 have #6617 applied on top; the table in section 2 is that base without #6617. Release, Linux (CachyOS), Ryzen 9 5950X, RTX 3080 Ti, NVIDIA 610.57.04. Hades II hub, pinned to cores 8-15,24-31 with `taskset`, save data restored and checked before every run. **1. Double free in the tests.** - With the reaper on (default), a full parallel `ctest -R '^agc_'` run aborted in `agc_driver_draw_cache_reuse`, `agc_driver_draw_cache_reuse_off` and `agc_driver_msaa_enable_single_sample`, and `agc_driver_stencil_ref_export_unused` crashed. A `-j1` re-run of the failing tests aborted in the same four. With `APS5_NO_COMMIT_REAPER=1` or `APS5_PIPELINED_DRAWS=0` they passed. - No backtrace: a gdb run of `draw_cache_reuse` passed. The cause is from reading the code: the reaper is never joined and `DrawPipeline` is leaked, so up to 63 retired items can outlive `device.Reset()` in `Driver::stop()` and be destroyed afterwards without the GPU lock. - `DrawPipeline::Quiesce()` (wait for `items` empty, set a stop flag under `retireMutex`, join the reaper, destroy the rest), called in `Driver::stop()` before the GPU lock, gave no abort in 11 runs with the reaper on (ten at `-j1`, one at `-j4`). That is not proof the race is fixed. It is about 30 lines; I can send it as a commit. - A window is left: `run()` moves the item to a local `done`, drops the lock, then calls `retire(std::move(done))`, so `Quiesce()` can return while the committer holds the last popped item. A `retiring` counter (incremented under the lock when the item is moved out, decremented after the destroy), with `Quiesce()` waiting for `items.empty() && retiring == 0`, closes it for `Quiesce()`. With the reaper, making `Drain()` wait for it too would likely cost the gain; that is inference, not measured. I have not added the counter on top of the reaper. **2. Destroying the closure outside the mutex accounts for part of the gain on its own.** Same binary, only that change, no reaper thread, toggled by an environment variable. n=4 per arm, interleaved (OFF ON ON OFF ON OFF OFF ON), no crashes: | Arm | FPS (mean ± sd) | 1% low (mean ± sd) | | --- | --- | --- | | baseline | 62.45 ± 0.67 | 45.85 ± 0.15 | | closure destroyed outside the mutex | 66.93 ± 0.60 | 50.11 ± 0.24 | In an earlier batch (n=4 per arm, interleaved, Quiesce fix applied), #6617 with the reaper gave 71.09 ± 0.47 FPS and with `APS5_NO_COMMIT_REAPER=1` 66.27 ± 1.47. The reaper-off path also destroys the item after the lock is released, so its roughly 4 FPS gain over a plain baseline build is probably the same effect (untested). If so, about half the gain is the unlocked destroy and half the reaper, which costs about 2.2 ms/frame of CPU on another core. The batches used different binaries at different times, so I am not comparing numbers across them. One title, one machine, pinned cores. No unpinned runs, no other game, no TSan. **3. The patch.** The variant from section 2 is below. The game runs used the opt-in version of the switch; with the default flipped (`APS5_NO_COMMIT_DESTROY_UNLOCKED=1` restores destroying inside the lock) I re-ran the `agc_` tests in both modes, not the game. It is against current main (85643f75e): `git apply --check` passes and `DrawPipeline.cpp` compiles; I have not done a full build or run tests on that base. It does not apply on #6617's head (74dad0097): it replaces #6617's `run()` change instead of stacking on it, so on the PR the `retiring` decrement would move to after `retire()` returns. It covers only the no-reaper case. I can push it as a branch on my fork or as a commit on top of this PR if you want it; I will not open a separate PR. ```diff diff --git a/core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp b/core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp --- a/core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp +++ b/core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp @@ -58,6 +58,7 @@ private: std::exception_ptr failure; std::atomic<std::size_t> outstanding{0}; std::uint32_t idleWaiters = 0; + std::uint32_t retiring = 0; bool committerWaiting = false; bool stopped = false; std::thread thread; diff --git a/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp b/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp --- a/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp +++ b/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp @@ -117,6 +117,10 @@ void DrawPipeline::report(std::chrono::steady_clock::time_point now) { } void DrawPipeline::run() { + static const bool destroyUnlocked = [] { + const char* text = std::getenv("APS5_NO_COMMIT_DESTROY_UNLOCKED"); + return text == nullptr || text[0] != '1'; + }(); for (;;) { Commit* commit = nullptr; { @@ -146,12 +150,23 @@ void DrawPipeline::run() { stopped = true; if (!shutdown) Driver::Get().ReportFailure(fatal); } - std::lock_guard lock(mutex); + std::unique_lock lock(mutex); + std::optional<Item> finished; + if (destroyUnlocked) { + finished = std::move(items.front()); + ++retiring; + } items.pop_front(); ++commits; commitNs += spent; if (failed) ++commitErrors; if (fatal != nullptr && failure == nullptr) failure = fatal; + if (finished.has_value()) { + lock.unlock(); + finished.reset(); + lock.lock(); + --retiring; + } outstanding.fetch_sub(1, std::memory_order_release); if (idleWaiters != 0) idle.notify_all(); } @@ -164,7 +179,7 @@ void DrawPipeline::Drain(DrainReason reason, std::uint32_t opcode) { const auto start = std::chrono::steady_clock::now(); std::unique_lock lock(mutex); ++idleWaiters; - idle.wait(lock, [&] { return items.empty(); }); + idle.wait(lock, [&] { return items.empty() && retiring == 0; }); --idleWaiters; const auto index = static_cast<std::size_t>(reason); ++drains[index]; ``` - Test (not posted): the destructor signals entry and sleeps 20 ms, then `Drain()` must return only after it finished. Without `&& retiring == 0` it failed 20 of 20; restored, 0 of 20. - `Overlaps()` and `PendingLabel()` scan `items` only. Before, the closure was destroyed inside `pop_front()` under the mutex, so they could not run during the destroy; now they can, and the item is not visible to them while it is destroyed. That assumes closure destructors do not touch guest memory. LLM assistance used. I ran the builds and tests.
milescoviello commented 2026-10-17 06:48:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-17T06:48:16Z.


A Linux data point on how much this costs the committer in another title, from a profile and not a measurement of this PR. Metal Gear Solid 4 (PPSA18194), Ubuntu 24.04, i7-13700K, RTX 4070 Ti (595.99.02), Release, pad input. main 0dc15620d2 plus what MGS4 needs here (#6814, #6842, #6237) and #6917. In this scene the committer holds the GPU mutex for about 7.9 s of every 10 s (APS5_PROFILE_DRAW, 124k commits per 10 s).

perf record -F 199 --call-graph dwarf for 6 s at 225 s; 555 of the samples have DrawPipeline::run on the stack:

  • 81.4% under Driver::commitDraw.
  • 10.5% (58 samples) in the std::function manager of Driver::draw's commit closure, that is destroying it from items.pop_front(): _Sp_counted_base::_M_release, free, _int_free.

So in MGS4 about a tenth of the committer's time goes to the closure frees this PR moves off it. I haven't run this PR on MGS4.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6230858811 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#issuecomment-6230858811). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-17T06:48:16Z. --- A Linux data point on how much this costs the committer in another title, from a profile and not a measurement of this PR. Metal Gear Solid 4 (PPSA18194), Ubuntu 24.04, i7-13700K, RTX 4070 Ti (595.99.02), Release, pad input. `main` 0dc15620d2 plus what MGS4 needs here (#6814, #6842, #6237) and #6917. In this scene the committer holds the GPU mutex for about 7.9 s of every 10 s (`APS5_PROFILE_DRAW`, 124k commits per 10 s). `perf record -F 199 --call-graph dwarf` for 6 s at 225 s; 555 of the samples have `DrawPipeline::run` on the stack: - 81.4% under `Driver::commitDraw`. - 10.5% (58 samples) in the `std::function` manager of `Driver::draw`'s commit closure, that is destroying it from `items.pop_front()`: `_Sp_counted_base::_M_release`, `free`, `_int_free`. So in MGS4 about a tenth of the committer's time goes to the closure frees this PR moves off it. I haven't run this PR on MGS4. AI-assisted: yes (Claude Code)
Pacuka commented 2026-10-18 12:30:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pacuka on 2026-10-18T12:30:43Z.


Linux data point: The Smurfs - Dreams (PPSA21607, Unreal Engine), CachyOS, Ryzen 9 5950X, RX 6650 XT / RADV Mesa 26.2.4, main 9f25d0bf5 + this PR + #6566 + #6208 + #6501 (+ unrelated local rendering fixes). Same spot in the Smurfs' Village, standing still, APS5_PROFILE_DRAW=1:

  • Without this PR (and without #6566): 75–78 presents per 10 s, ~74 us per commit.
  • APS5_NO_COMMIT_REAPER=1 (#6566 only): 74–79 presents per 10 s, ~75 us per commit.
  • With the reaper: 80–83 presents per 10 s, 70 us per commit (+7%).

The committer is the bottleneck in this title (~120k commits per 10 s), so the commit time maps straight to frame rate. No rendering differences or aborts.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6249937636 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#issuecomment-6249937636). Originally posted by [Pacuka](https://github.com/Pacuka) on 2026-10-18T12:30:43Z. --- Linux data point: The Smurfs - Dreams (PPSA21607, Unreal Engine), CachyOS, Ryzen 9 5950X, RX 6650 XT / RADV Mesa 26.2.4, main 9f25d0bf5 + this PR + #6566 + #6208 + #6501 (+ unrelated local rendering fixes). Same spot in the Smurfs' Village, standing still, `APS5_PROFILE_DRAW=1`: - Without this PR (and without #6566): 75–78 presents per 10 s, ~74 us per commit. - `APS5_NO_COMMIT_REAPER=1` (#6566 only): 74–79 presents per 10 s, ~75 us per commit. - With the reaper: 80–83 presents per 10 s, ~70 us per commit (~+7%). The committer is the bottleneck in this title (~120k commits per 10 s), so the commit time maps straight to frame rate. No rendering differences or aborts. AI-assisted (Claude Code).
adriadam10 commented 2026-10-19 06:51:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T06:51:31Z.

Review: DISMISSED


Thanks for the measurements. Reading the diff, the crash jotitadev, fma-rc and eliyarson reported has two causes in DrawPipeline.cpp:

  • reap() loops forever (l.198-209), so the runningCommitters.fetch_sub that used to end run() now sits after it (l.210) and never runs; run() no longer decrements it. Put it back at the end of run().
  • The reaper thread is never stopped or joined: Stop() (l.213) joins only the committer. Retired items (up to 63) outlive device.Reset() in Driver::stop() and are destroyed afterwards without the GPU lock, which fits the double free or corruption at exit that goes away with APS5_NO_COMMIT_REAPER=1. The reaper needs a stop flag set under retireMutex, a final drain of retired, and a join in Stop(), so every closure is destroyed before the device goes. eliyarson's Quiesce() plus a retiring counter (his comment above) covers the window between popping the item and retire().

Also, the perf label asks for the aps5-summary.jsonl lines of a capture on main and one with the change, from the same title and scene, plus the tools/trace_digest.py output; the third-party numbers help but the form asks for them in the PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5567864433 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#pullrequestreview-5567864433). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T06:51:31Z. **Review:** DISMISSED --- Thanks for the measurements. Reading the diff, the crash jotitadev, fma-rc and eliyarson reported has two causes in `DrawPipeline.cpp`: - `reap()` loops forever (l.198-209), so the `runningCommitters.fetch_sub` that used to end `run()` now sits after it (l.210) and never runs; `run()` no longer decrements it. Put it back at the end of `run()`. - The reaper thread is never stopped or joined: `Stop()` (l.213) joins only the committer. Retired items (up to 63) outlive `device.Reset()` in `Driver::stop()` and are destroyed afterwards without the GPU lock, which fits the `double free or corruption` at exit that goes away with `APS5_NO_COMMIT_REAPER=1`. The reaper needs a stop flag set under `retireMutex`, a final drain of `retired`, and a join in `Stop()`, so every closure is destroyed before the device goes. eliyarson's `Quiesce()` plus a `retiring` counter (his comment above) covers the window between popping the item and `retire()`. Also, the `perf` label asks for the `aps5-summary.jsonl` lines of a capture on `main` and one with the change, from the same title and scene, plus the `tools/trace_digest.py` output; the third-party numbers help but the form asks for them in the PR.
JJenkx commented 2026-10-19 17:15:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-19T17:15:38Z.


Following the teardown reports above, I tested a shutdown follow-up on main 7a015c0946e2f421b7977129dc7fc255a133019b plus this PR at 74dad00977cd0485dfc2965ed6371b68fe779cb6.

Source: integration branch, retaining this PR's authored commit. The follow-up 9b3ce9fc4d joins the committer first, then signals the reaper to flush its last batch and joins it before Stop() returns. This covers the pop-to-retire window on the normal external shutdown path without changing ordinary Drain(). It also puts the committer-count decrement back at the end of run(); merging this PR into this main otherwise leaves it after the endless reap() loop.

Regression tests cover a captured object's blocked destructor and a 65-item batch tail. The blocked-destructor test passes on main, fails with the unmodified PR integrated into main (Stop returned while a closure destructor was still running), and passes with the follow-up. This reproduces premature shutdown, not an allocator-corruption backtrace.

Validation on the same Linux / Radeon RX 6650 XT / RADV machine, with Vulkan required, shader cache disabled and Khronos validation enabled:

  • Main plus the regression tests: 11/11 pass.
  • PR plus follow-up: 11/11 pass, including all four draw_cache_reuse modes and inactive_vertex_point_size.
  • Follow-up with APS5_NO_COMMIT_REAPER=1: 11/11 pass.
  • Repeated both new Stop tests, draw_cache_reuse_off, and inactive_vertex_point_size 20 times each: 80/80 executions pass.
  • No skips, missing validation layer or VUID- errors in those passing runs. Conventions check passes after documenting the existing fallback switch.

The expanded suite command is:

ctest --test-dir build-full -R '^(agc_draw_pipeline_stop_(active|tail)|agc_driver_(pipelined_fill|pm4|same_queue_label_wait|pipelined_predication_read|draw_cache_reuse(_off|_verify|_inline)?|inactive_vertex_point_size))$' -V --timeout 30

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation were set; exact commands, layer/ICD paths, patches and verbose logs are in the evidence bundle.

These are shutdown/test results. The subsequent title measurement is pinned to the original sources above and is only one ordered pair. The existing committer self-stop/detach behavior is preserved and is not covered by the synchronous shutdown claim. AI-assisted: yes.

Refresh on main 48790e0233fd2237aac77f25683339d3bc0d4c8f

Replayed the same four patches onto this main without merge commits: refreshed integration branch, candidate a976a27f7afba52ddaa06c938fbb4f610257b042, shutdown follow-up. git range-diff reports all four patches unchanged, retaining the original PR author's commit.

Reran the same 11 tests on main plus the regression tests, the refreshed candidate, and the candidate with APS5_NO_COMMIT_REAPER=1: 11/11 pass in each arm on the same RX 6650 XT / RADV machine with Vulkan required, shader cache disabled, and Khronos validation enabled. No skips, missing-layer messages, or VUID- errors. Full libs build and conventions pass. Fresh logs, exact commands, source patches, and range-diff.

The earlier negative control, 80-run stress result, and native benchmark were not repeated on this refreshed base. No new performance claim. AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6272926948 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#issuecomment-6272926948). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-19T17:15:38Z. --- Following the teardown reports above, I tested a shutdown follow-up on main `7a015c0946e2f421b7977129dc7fc255a133019b` plus this PR at `74dad00977cd0485dfc2965ed6371b68fe779cb6`. Source: [integration branch](https://github.com/JJenkx/AnyPS5/tree/review/commit-retirement-sync156), retaining this PR's authored commit. The follow-up [9b3ce9fc4d](https://github.com/JJenkx/AnyPS5/commit/9b3ce9fc4d) joins the committer first, then signals the reaper to flush its last batch and joins it before `Stop()` returns. This covers the pop-to-retire window on the normal external shutdown path without changing ordinary `Drain()`. It also puts the committer-count decrement back at the end of `run()`; merging this PR into this main otherwise leaves it after the endless `reap()` loop. [Regression tests](https://github.com/JJenkx/AnyPS5/commit/d30141e9d3) cover a captured object's blocked destructor and a 65-item batch tail. The blocked-destructor test passes on main, fails with the unmodified PR integrated into main (`Stop returned while a closure destructor was still running`), and passes with the follow-up. This reproduces premature shutdown, not an allocator-corruption backtrace. Validation on the same Linux / Radeon RX 6650 XT / RADV machine, with Vulkan required, shader cache disabled and Khronos validation enabled: - Main plus the regression tests: 11/11 pass. - PR plus follow-up: 11/11 pass, including all four `draw_cache_reuse` modes and `inactive_vertex_point_size`. - Follow-up with `APS5_NO_COMMIT_REAPER=1`: 11/11 pass. - Repeated both new Stop tests, `draw_cache_reuse_off`, and `inactive_vertex_point_size` 20 times each: 80/80 executions pass. - No skips, missing validation layer or `VUID-` errors in those passing runs. Conventions check passes after [documenting the existing fallback switch](https://github.com/JJenkx/AnyPS5/commit/1365624ca5). The expanded suite command is: ```sh ctest --test-dir build-full -R '^(agc_draw_pipeline_stop_(active|tail)|agc_driver_(pipelined_fill|pm4|same_queue_label_wait|pipelined_predication_read|draw_cache_reuse(_off|_verify|_inline)?|inactive_vertex_point_size))$' -V --timeout 30 ``` `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` were set; exact commands, layer/ICD paths, patches and verbose logs are in the [evidence bundle](https://github.com/JJenkx/AnyPS5/releases/download/game-library-checks-20261016/sync156-commit-retirement-evidence.tar.gz). These are shutdown/test results. The subsequent [title measurement](https://github.com/boykopovar/AnyPS5/pull/6617#issuecomment-6273315386) is pinned to the original sources above and is only one ordered pair. The existing committer self-stop/detach behavior is preserved and is not covered by the synchronous shutdown claim. AI-assisted: yes. ### Refresh on main `48790e0233fd2237aac77f25683339d3bc0d4c8f` Replayed the same four patches onto this main without merge commits: [refreshed integration branch](https://github.com/JJenkx/AnyPS5/tree/review/commit-retirement-sync158), candidate `a976a27f7afba52ddaa06c938fbb4f610257b042`, [shutdown follow-up](https://github.com/JJenkx/AnyPS5/commit/3f563df36813562b27c64ba143a0c96ed9097ca8). `git range-diff` reports all four patches unchanged, retaining the original PR author's commit. Reran the same 11 tests on main plus the regression tests, the refreshed candidate, and the candidate with `APS5_NO_COMMIT_REAPER=1`: 11/11 pass in each arm on the same RX 6650 XT / RADV machine with Vulkan required, shader cache disabled, and Khronos validation enabled. No skips, missing-layer messages, or `VUID-` errors. Full `libs` build and conventions pass. [Fresh logs, exact commands, source patches, and range-diff](https://github.com/JJenkx/AnyPS5/releases/download/game-library-checks-20261016/sync158-commit-retirement-refresh-evidence.tar.gz). The earlier negative control, 80-run stress result, and native benchmark were not repeated on this refreshed base. No new performance claim. AI-assisted: yes.
JJenkx commented 2026-10-19 17:35:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-19T17:35:35Z.


Native-title follow-up to the shutdown tests above: Record of Lodoss War -Deedlit in Wonder Labyrinth- (PPSA05347), stationary opening forest with tutorial text. Same machine, scene, scripted inputs and settings; separate per-source caches warmed by running the scene once and restarting. One main-then-candidate pair.

  • Baseline main: 7a015c0946e2f421b7977129dc7fc255a133019b.
  • Candidate: 1365624ca52d572b5c0d772249f9de8c53f262f5 = that main + this PR's authored commit + the shutdown follow-up/regression tests linked above.
  • Main 23.26 FPS, candidate 23.93 FPS (+2.85%). This is a small single-pair result, not evidence of a repeatable gain or a full-game improvement.
  • All four launches (warmup/capture for each build) exited 0 through ordinary window close, native PIDs are gone, and the temporary kernel limit was restored after every launch.
  • Scene captures show the same character position, scene and readable tutorial text, with animation differences. Both measured runs logged the same four storage-image destruction warnings at exit; no clean-warning or console-equivalence claim. Native performance capture did not enable validation; the separately linked focused-test validation is the correctness evidence.
  • Captured baseline was main at test start. Main advanced to b6583dd8687f359c2caea295cde23e4732b73433 by the post-test PR audit; these numbers apply to the exact pins above.

main official summary:

{"commit":"7a015c0946e2","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"1","APS5_SPIRV_OPT":"full","APS5_TRACE_SECONDS":"200:30"},"gpu":"AMD Radeon RX 6650 XT (RADV NAVI23)","driver":"radv Mesa 26.2.4-arch1.1","os":"Linux 7.2.9-arch1-1","resolution":"3840x2160","window":{"spec":"seconds 200:30","first_present":9410,"ms":30003.439},"presents":698,"frame_ms":{"p50":41.744,"p90":52.656,"p99":68.522,"max":79.143},"gpu_busy_ms_per_present":2.218,"worker_busy_pct":{"queue worker 0x0":43.62},"top_phases_ms_per_frame":{"Driver.Packet":18.746,"Driver.Packet.device_lock":12.798,"Graphics.Draw":9.591,"Graphics.Draw.validate":7.781,"Driver.Packet.prepare_memory":5.045,"GpuMutex.wait.label":3.465,"Recorder.Sync":3.323,"GpuMutex.wait.other":2.98},"trace_dropped":false,"trace":"aps5-trace-7a015c0946e2-1334271.json.gz"}

candidate official summary:

{"commit":"1365624ca52d","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"1","APS5_SPIRV_OPT":"full","APS5_TRACE_SECONDS":"200:30"},"gpu":"AMD Radeon RX 6650 XT (RADV NAVI23)","driver":"radv Mesa 26.2.4-arch1.1","os":"Linux 7.2.9-arch1-1","resolution":"3840x2160","window":{"spec":"seconds 200:30","first_present":9494,"ms":30008.19},"presents":718,"frame_ms":{"p50":40.368,"p90":51.067,"p99":63.197,"max":72.338},"gpu_busy_ms_per_present":2.28,"worker_busy_pct":{"queue worker 0x0":42.605},"top_phases_ms_per_frame":{"Driver.Packet":17.802,"Driver.Packet.device_lock":12.24,"Graphics.Draw":9.282,"Graphics.Draw.validate":7.487,"Driver.Packet.prepare_memory":4.658,"GpuMutex.wait.label":3.052,"Recorder.Sync":2.941,"GpuMutex.wait.other":2.898},"trace_dropped":false,"trace":"aps5-trace-1365624ca52d-1495193.json.gz"}

Official tools/trace_digest.py outputs: main, candidate. Traces: main, candidate. Evidence bundle includes exact source patch/attribution, protocol, commands, reports, full measured terminal log, screenshots and digests. No dropped trace events. Ryzen 9 7950X / RX 6650 XT / RADV Mesa 26.2.4, Linux 7.2.9. AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6273315386 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#issuecomment-6273315386). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-19T17:35:35Z. --- Native-title follow-up to the shutdown tests above: Record of Lodoss War -Deedlit in Wonder Labyrinth- (`PPSA05347`), stationary opening forest with tutorial text. Same machine, scene, scripted inputs and settings; separate per-source caches warmed by running the scene once and restarting. One main-then-candidate pair. - Baseline main: `7a015c0946e2f421b7977129dc7fc255a133019b`. - Candidate: `1365624ca52d572b5c0d772249f9de8c53f262f5` = that main + this PR's authored commit + the shutdown follow-up/regression tests linked above. - Main **23.26 FPS**, candidate **23.93 FPS** (**+2.85%**). This is a small single-pair result, not evidence of a repeatable gain or a full-game improvement. - All four launches (warmup/capture for each build) exited 0 through ordinary window close, native PIDs are gone, and the temporary kernel limit was restored after every launch. - Scene captures show the same character position, scene and readable tutorial text, with animation differences. Both measured runs logged the same four storage-image destruction warnings at exit; no clean-warning or console-equivalence claim. Native performance capture did not enable validation; the separately linked focused-test validation is the correctness evidence. - Captured baseline was main at test start. Main advanced to `b6583dd8687f359c2caea295cde23e4732b73433` by the post-test PR audit; these numbers apply to the exact pins above. main official summary: ```json {"commit":"7a015c0946e2","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"1","APS5_SPIRV_OPT":"full","APS5_TRACE_SECONDS":"200:30"},"gpu":"AMD Radeon RX 6650 XT (RADV NAVI23)","driver":"radv Mesa 26.2.4-arch1.1","os":"Linux 7.2.9-arch1-1","resolution":"3840x2160","window":{"spec":"seconds 200:30","first_present":9410,"ms":30003.439},"presents":698,"frame_ms":{"p50":41.744,"p90":52.656,"p99":68.522,"max":79.143},"gpu_busy_ms_per_present":2.218,"worker_busy_pct":{"queue worker 0x0":43.62},"top_phases_ms_per_frame":{"Driver.Packet":18.746,"Driver.Packet.device_lock":12.798,"Graphics.Draw":9.591,"Graphics.Draw.validate":7.781,"Driver.Packet.prepare_memory":5.045,"GpuMutex.wait.label":3.465,"Recorder.Sync":3.323,"GpuMutex.wait.other":2.98},"trace_dropped":false,"trace":"aps5-trace-7a015c0946e2-1334271.json.gz"} ``` candidate official summary: ```json {"commit":"1365624ca52d","dirty":false,"env":{"APS5_DRAW_CACHE_ENTRIES":"4096","APS5_HOST_IMPORT_MIB":"16384","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINED_DRAWS":"1","APS5_SPIRV_OPT":"full","APS5_TRACE_SECONDS":"200:30"},"gpu":"AMD Radeon RX 6650 XT (RADV NAVI23)","driver":"radv Mesa 26.2.4-arch1.1","os":"Linux 7.2.9-arch1-1","resolution":"3840x2160","window":{"spec":"seconds 200:30","first_present":9494,"ms":30008.19},"presents":718,"frame_ms":{"p50":40.368,"p90":51.067,"p99":63.197,"max":72.338},"gpu_busy_ms_per_present":2.28,"worker_busy_pct":{"queue worker 0x0":42.605},"top_phases_ms_per_frame":{"Driver.Packet":17.802,"Driver.Packet.device_lock":12.24,"Graphics.Draw":9.282,"Graphics.Draw.validate":7.487,"Driver.Packet.prepare_memory":4.658,"GpuMutex.wait.label":3.052,"Recorder.Sync":2.941,"GpuMutex.wait.other":2.898},"trace_dropped":false,"trace":"aps5-trace-1365624ca52d-1495193.json.gz"} ``` Official `tools/trace_digest.py` outputs: [main](https://github.com/JJenkx/AnyPS5/releases/download/game-library-checks-20261016/sync157-main-digest.txt), [candidate](https://github.com/JJenkx/AnyPS5/releases/download/game-library-checks-20261016/sync157-candidate-digest.txt). Traces: [main](https://github.com/JJenkx/AnyPS5/releases/download/game-library-checks-20261016/aps5-trace-7a015c0946e2-1334271.json.gz), [candidate](https://github.com/JJenkx/AnyPS5/releases/download/game-library-checks-20261016/aps5-trace-1365624ca52d-1495193.json.gz). [Evidence bundle](https://github.com/JJenkx/AnyPS5/releases/download/game-library-checks-20261016/sync157-commit-retirement-native-evidence.tar.gz) includes exact source patch/attribution, protocol, commands, reports, full measured terminal log, screenshots and digests. No dropped trace events. Ryzen 9 7950X / RX 6650 XT / RADV Mesa 26.2.4, Linux 7.2.9. AI-assisted: yes.
eliyarson commented 2026-10-21 23:30:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by eliyarson on 2026-10-21T23:30:21Z.


Thanks @adriadam10. I read @JJenkx's follow-up 9b3ce9fc4d (branch review/commit-retirement-sync156) against the two causes and the pop-to-retire window I described earlier. This is from reading the code; I have not built or run it.

  • runningCommitters.fetch_sub is back at the end of run().
  • Stop() joins the committer, then sets reaperClosing under retireMutex; the reaper destroys what is left in retired and exits, and Stop() joins it. Driver::stop() calls Stop() before device.Reset().
  • The pop-to-retire window is closed on that path: the committer leaves run() only once items is empty, and each retire() returns before it checks again, so the last one has finished before the reaper is told to close. With APS5_NO_COMMIT_REAPER=1 the destroy runs on the committer, which is joined first.

That covers what my Quiesce() and retiring counter were for, so neither is needed and I am not offering a patch for them. The one path I can't say is covered is Stop() called from the committer thread itself (detach, no reaper join), which @JJenkx already notes.

@TheAggie, if you pull this into #6617: @JJenkx's replay of it on newer main is 3f563df36 on review/commit-retirement-sync158, which they report unchanged by range-diff.

The no-reaper variant from my earlier comment (closure destroyed after the lock is released, no reaper thread) is now on my fork as branch rb/commit-destroy-unlocked, rebased on current main a6dcea927. It is on by default; APS5_NO_COMMIT_DESTROY_UNLOCKED=1 turns it off. Its retiring counter only makes Drain() wait for that unlocked destroy; it is not the Quiesce() counter above, and like the patch in that comment the branch replaces #6617's run() change instead of stacking on it. On Linux (RTX 3080 Ti) it builds and ctest -R agc passes apart from one skipped test and the three agc_driver_sample_order* tests, which also fail on that main. I have no FPS numbers on this base: Hades II on current main aborts during the hub load (native multisample depth metadata fill transition is not implemented, the path #6300 works on), so the numbers in my earlier comment are from the older base only.

For the perf label: @JJenkx posted one main/candidate pair for Record of Lodoss War. I can add a Hades II pair (aps5-summary.jsonl lines for main and for the change, same scene, plus tools/trace_digest.py output) if that helps. I have not run it yet; on current main it needs the hub-load abort above fixed first.

LLM assistance used.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6328884249 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#issuecomment-6328884249). Originally posted by [eliyarson](https://github.com/eliyarson) on 2026-10-21T23:30:21Z. --- Thanks @adriadam10. I read @JJenkx's follow-up `9b3ce9fc4d` (branch `review/commit-retirement-sync156`) against the two causes and the pop-to-retire window I described earlier. This is from reading the code; I have not built or run it. - `runningCommitters.fetch_sub` is back at the end of `run()`. - `Stop()` joins the committer, then sets `reaperClosing` under `retireMutex`; the reaper destroys what is left in `retired` and exits, and `Stop()` joins it. `Driver::stop()` calls `Stop()` before `device.Reset()`. - The pop-to-retire window is closed on that path: the committer leaves `run()` only once `items` is empty, and each `retire()` returns before it checks again, so the last one has finished before the reaper is told to close. With `APS5_NO_COMMIT_REAPER=1` the destroy runs on the committer, which is joined first. That covers what my `Quiesce()` and `retiring` counter were for, so neither is needed and I am not offering a patch for them. The one path I can't say is covered is `Stop()` called from the committer thread itself (detach, no reaper join), which @JJenkx already notes. @TheAggie, if you pull this into #6617: @JJenkx's replay of it on newer main is `3f563df36` on `review/commit-retirement-sync158`, which they report unchanged by `range-diff`. The no-reaper variant from my earlier comment (closure destroyed after the lock is released, no reaper thread) is now on my fork as branch [`rb/commit-destroy-unlocked`](https://github.com/eliyarson/AnyPS5/tree/rb/commit-destroy-unlocked), rebased on current main `a6dcea927`. It is on by default; `APS5_NO_COMMIT_DESTROY_UNLOCKED=1` turns it off. Its `retiring` counter only makes `Drain()` wait for that unlocked destroy; it is not the `Quiesce()` counter above, and like the patch in that comment the branch replaces #6617's `run()` change instead of stacking on it. On Linux (RTX 3080 Ti) it builds and `ctest -R agc` passes apart from one skipped test and the three `agc_driver_sample_order*` tests, which also fail on that main. I have no FPS numbers on this base: Hades II on current main aborts during the hub load (`native multisample depth metadata fill transition is not implemented`, the path #6300 works on), so the numbers in my earlier comment are from the older base only. For the `perf` label: @JJenkx posted one main/candidate pair for Record of Lodoss War. I can add a Hades II pair (`aps5-summary.jsonl` lines for main and for the change, same scene, plus `tools/trace_digest.py` output) if that helps. I have not run it yet; on current main it needs the hub-load abort above fixed first. LLM assistance used.
oneandonlydean commented 2026-10-22 04:04:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T04:04:17Z.


I'm picking this up alongside @adriadam10 because it is part of a stack that gets PPSA04263 further on current main. The two open change requests still apply to 74dad00977, in particular @adriadam10's: reap() loops forever and teardown double-frees (as @jotitadev saw on Linux). I'm checking whether that still reproduces on current main and how small the fix is. @TheAggie, if you can push a fix, that's the quickest path. Otherwise I'll propose one here for you and the reviewers to look at.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6332399231 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#issuecomment-6332399231). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-22T04:04:17Z. --- I'm picking this up alongside @adriadam10 because it is part of a stack that gets PPSA04263 further on current `main`. The two open change requests still apply to 74dad00977, in particular @adriadam10's: `reap()` loops forever and teardown double-frees (as @jotitadev saw on Linux). I'm checking whether that still reproduces on current `main` and how small the fix is. @TheAggie, if you can push a fix, that's the quickest path. Otherwise I'll propose one here for you and the reviewers to look at.
johandavidcm commented 2026-10-22 06:35:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by johandavidcm on 2026-10-22T06:35:19Z.


Windows data point from Yakuza 0 Director's Cut (PPSA31327), which is committer-bound in gameplay. Windows 11 Pro 26200, RTX 4070 (617.42), Ryzen 7 7800X3D, WinLibs GCC 15.2.0, Release, character standing still in Kamurocho.

  • Base: main 80565c594 + #8098 (the title's audio) + #8117. Change: this PR (74dad0097), which merges cleanly onto that base.
  • Method: scripted runs (pad input file, APS5_NO_PAD_INPUT=1). APS5_TRACE_SECONDS=170:60 in gameplay. Builds were interleaved over three batches.
Build p50 per run (ms) Mean p50 Presents in 60 s
Base 343.7, 330.8, 344.7, 343.8, 343.8, 339.0 341.0 174-181
This PR 302.4, 334.7, 302.1, 310.9 312.5 (-8.3 %) 180-199
  • Three of the four runs are 9-11 % faster. One (334.7 ms) is within the base's spread.
  • GPU busy per present is unchanged.
  • In the traces, the queue worker's Driver.Packet goes from 338 to 309 ms per frame, and Graphics.Draw from 290 to 281 ms, consistent with the worker waiting less on the committer.

Replicated on current main 0c6a5bd59 (+ #8098 + #8117). This PR still merges cleanly. Same scene, window 140:60, 2 runs each:

Build p50 per run (ms) Mean p50
Base 346.4, 360.0 353.2
This PR 310.8, 312.5 311.7 (-11.7 %)
  • Together with #6192, this PR gives 297.8 ms (302.6 and 292.9), -15.7 % against the same base.
Summary lines (one run of each build)
{"commit":"a286c08cd91f","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"170:60"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7800X3D 8-Core Processor","cpu_threads":16,"memory_mib":31892,"title_id":"PPSA31327","title":"Yakuza 0 Director's Cut","content_version":"01.015.000","resolution":"1920x1080","window":{"spec":"seconds 170:60","first_present":2932,"ms":60110.216},"presents":174,"frame_ms":{"p50":343.785,"p90":352.964,"p99":443.525,"max":448.872},"gpu_busy_ms_per_present":74.113,"worker_busy_pct":{"queue worker 0x0":98.708},"top_phases_ms_per_frame":{"Driver.Packet":340.744,"Driver.Packet.draw":310.283,"Driver.Draw":307.147,"Graphics.Draw":292.543,"Graphics.Draw.draw_and_resource_release":204.982,"Driver.Draw.shader_compile_and_link":159.927,"Shader.DrawStage":125.474,"Driver.Draw.draw_enqueued":116.955},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":3.265,"events_lost":4557401,"totals_full":false},"draw committer":{"events_full_after_s":8.264,"events_lost":1660133,"totals_full":false}},"trace":"aps5-trace-a286c08cd91f-18056.json.gz"}
{"commit":"8af2a67c84e7","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"170:60"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7800X3D 8-Core Processor","cpu_threads":16,"memory_mib":31892,"title_id":"PPSA31327","title":"Yakuza 0 Director's Cut","content_version":"01.015.000","resolution":"1920x1080","window":{"spec":"seconds 170:60","first_present":2988,"ms":60071.381},"presents":198,"frame_ms":{"p50":302.144,"p90":314.216,"p99":328.471,"max":405.043},"gpu_busy_ms_per_present":72.331,"worker_busy_pct":{"queue worker 0x0":98.613},"top_phases_ms_per_frame":{"Driver.Packet":298.984,"Graphics.Draw":271.880,"Driver.Packet.draw":270.452,"Driver.Draw":267.294,"Graphics.Draw.draw_and_resource_release":192.471,"Driver.Draw.shader_compile_and_link":150.712,"Shader.DrawStage":118.400,"Driver.Draw.draw_enqueued":88.169},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":3.384,"events_lost":4513922,"totals_full":false},"draw committer":{"events_full_after_s":7.938,"events_lost":1744082,"totals_full":false}},"trace":"aps5-trace-8af2a67c84e7-8036.json.gz"}

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6334425401 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#issuecomment-6334425401). Originally posted by [johandavidcm](https://github.com/johandavidcm) on 2026-10-22T06:35:19Z. --- Windows data point from Yakuza 0 Director's Cut (PPSA31327), which is committer-bound in gameplay. Windows 11 Pro 26200, RTX 4070 (617.42), Ryzen 7 7800X3D, WinLibs GCC 15.2.0, Release, character standing still in Kamurocho. - **Base:** `main` 80565c594 + #8098 (the title's audio) + #8117. **Change:** this PR (74dad0097), which merges cleanly onto that base. - **Method:** scripted runs (pad input file, `APS5_NO_PAD_INPUT=1`). `APS5_TRACE_SECONDS=170:60` in gameplay. Builds were interleaved over three batches. | Build | p50 per run (ms) | Mean p50 | Presents in 60 s | |---|---|---|---| | Base | 343.7, 330.8, 344.7, 343.8, 343.8, 339.0 | 341.0 | 174-181 | | This PR | 302.4, 334.7, 302.1, 310.9 | 312.5 (-8.3 %) | 180-199 | - Three of the four runs are 9-11 % faster. One (334.7 ms) is within the base's spread. - GPU busy per present is unchanged. - In the traces, the queue worker's `Driver.Packet` goes from 338 to 309 ms per frame, and `Graphics.Draw` from 290 to 281 ms, consistent with the worker waiting less on the committer. **Replicated on current `main`** 0c6a5bd59 (+ #8098 + #8117). This PR still merges cleanly. Same scene, window `140:60`, 2 runs each: | Build | p50 per run (ms) | Mean p50 | |---|---|---| | Base | 346.4, 360.0 | 353.2 | | This PR | 310.8, 312.5 | 311.7 (-11.7 %) | - Together with #6192, this PR gives 297.8 ms (302.6 and 292.9), -15.7 % against the same base. <details><summary>Summary lines (one run of each build)</summary> ```json {"commit":"a286c08cd91f","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"170:60"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7800X3D 8-Core Processor","cpu_threads":16,"memory_mib":31892,"title_id":"PPSA31327","title":"Yakuza 0 Director's Cut","content_version":"01.015.000","resolution":"1920x1080","window":{"spec":"seconds 170:60","first_present":2932,"ms":60110.216},"presents":174,"frame_ms":{"p50":343.785,"p90":352.964,"p99":443.525,"max":448.872},"gpu_busy_ms_per_present":74.113,"worker_busy_pct":{"queue worker 0x0":98.708},"top_phases_ms_per_frame":{"Driver.Packet":340.744,"Driver.Packet.draw":310.283,"Driver.Draw":307.147,"Graphics.Draw":292.543,"Graphics.Draw.draw_and_resource_release":204.982,"Driver.Draw.shader_compile_and_link":159.927,"Shader.DrawStage":125.474,"Driver.Draw.draw_enqueued":116.955},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":3.265,"events_lost":4557401,"totals_full":false},"draw committer":{"events_full_after_s":8.264,"events_lost":1660133,"totals_full":false}},"trace":"aps5-trace-a286c08cd91f-18056.json.gz"} ``` ```json {"commit":"8af2a67c84e7","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"170:60"},"gpu":"NVIDIA GeForce RTX 4070","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7800X3D 8-Core Processor","cpu_threads":16,"memory_mib":31892,"title_id":"PPSA31327","title":"Yakuza 0 Director's Cut","content_version":"01.015.000","resolution":"1920x1080","window":{"spec":"seconds 170:60","first_present":2988,"ms":60071.381},"presents":198,"frame_ms":{"p50":302.144,"p90":314.216,"p99":328.471,"max":405.043},"gpu_busy_ms_per_present":72.331,"worker_busy_pct":{"queue worker 0x0":98.613},"top_phases_ms_per_frame":{"Driver.Packet":298.984,"Graphics.Draw":271.880,"Driver.Packet.draw":270.452,"Driver.Draw":267.294,"Graphics.Draw.draw_and_resource_release":192.471,"Driver.Draw.shader_compile_and_link":150.712,"Shader.DrawStage":118.400,"Driver.Draw.draw_enqueued":88.169},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":3.384,"events_lost":4513922,"totals_full":false},"draw committer":{"events_full_after_s":7.938,"events_lost":1744082,"totals_full":false}},"trace":"aps5-trace-8af2a67c84e7-8036.json.gz"} ``` </details> AI-assisted: yes
fma-rc commented 2026-10-22 19:17:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-22T19:17:10Z.

Review: APPROVED


Read 8326fb0768, it fixes the crash I reported. The reaper now exits on reaperStopping, drains what was retired before it stopped, and Stop() joins it after the committer, so nothing retired outlives the device. A retire after the stop destroys the item outside retireMutex, which is right. closing and reaperStopping both stay set after Stop(), so later commits run and are destroyed inline, which matches how the committer already behaves after shutdown. The new test checks both the reaper count and the closure lifetime. Runs on RADV are in my comment above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5619605308 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6617#pullrequestreview-5619605308). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-22T19:17:10Z. **Review:** APPROVED --- Read 8326fb0768, it fixes the crash I reported. The reaper now exits on `reaperStopping`, drains what was retired before it stopped, and `Stop()` joins it after the committer, so nothing retired outlives the device. A retire after the stop destroys the item outside `retireMutex`, which is right. `closing` and `reaperStopping` both stay set after `Stop()`, so later commits run and are destroyed inline, which matches how the committer already behaves after shutdown. The new test checks both the reaper count and the closure lifetime. Runs on RADV are in my comment above.

Pull request closed

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!6617
No description provided.