fix(agc): build the pipeline journal replay at a lower thread priority #10632

Merged
noir39 merged 2 commits from upstream-pr/10632 into main 2026-10-25 07:23:58 +00:00
noir39 commented 2026-10-24 13:44:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by noir39 on 2026-10-24T13:44:56Z.


What

The pipeline journal replay builds its pipelines on half the CPU threads at the title's priority. Next to a title whose job threads spin, as Demon's Souls' 13 BPE JobWorkerThreads do (#1283), those threads together leave the presenter and the queue workers without CPU time: on Windows with the default fifo present mode the title stops after two presents and never goes on (#7203).

On Windows the replay threads now run at THREAD_PRIORITY_BELOW_NORMAL, so they take the CPU time the title and the driver leave. Linux keeps the replay threads at their priority: I can't build or run the Linux path here, so this PR doesn't change it.

Tested

Windows 11 Pro 26200, Ryzen 9 5950X (32 threads, so 16 replay threads), RTX 3080 10 GB, NVIDIA 616.56, WinLibs GCC 15.2.0 r7.

Demon's Souls PPSA01342 v1.005 on main 5d3ab7791 with and without this change (its Windows line), journal of 292 pipelines and 313 modules, default environment, presents shown in the window title:

after 60 s after 100 s
main 2 2 (still 2 after 5 min)
main, APS5_PIPELINE_JOURNAL_THREADS=2 2 95 at 90 s
main, APS5_NO_PIPELINE_JOURNAL=1 2 408 at 110 s
main, APS5_THREAD_PRIORITY=high 2 109 at 90 s
this PR 2 345

The wait at two presents for the first minute is in every row and is not changed here. This is a fix of a stall, not a speed claim, so there are no trace summaries.

Focused tests on main (6cd36e651) and on this PR from the same machine and GPU, ctest --test-dir build -R pipeline_journal -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363.0; VK_LOADER_DEBUG=layer shows the layer inserted): agc_driver_pipeline_journal, agc_pipeline_journal, agc_pipeline_journal_long_paths and agc_pipeline_journal_extended_paths pass on both, neither log has was not found but was requested by env var VK_INSTANCE_LAYERS, and neither has a VUID- message.

Checklist

  • Based on current main; no other open PR implements the same functions (tools/pr_overlap.py: ten open PRs touch PipelineJournal.cpp, none the replay threads' priority)
  • 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 (#7203 was found with Demon's Souls; its first-minute wait remains)
  • Unblocks: PPSA01342 #1283
  • GPUs tested: NVIDIA GeForce RTX 3080, driver 616.56, Windows 11 Pro 26200
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4995902991 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10632). Originally posted by [noir39](https://github.com/noir39) on 2026-10-24T13:44:56Z. --- ### What The pipeline journal replay builds its pipelines on half the CPU threads at the title's priority. Next to a title whose job threads spin, as Demon's Souls' 13 `BPE JobWorkerThread`s do (#1283), those threads together leave the presenter and the queue workers without CPU time: on Windows with the default `fifo` present mode the title stops after two presents and never goes on (#7203). On Windows the replay threads now run at `THREAD_PRIORITY_BELOW_NORMAL`, so they take the CPU time the title and the driver leave. Linux keeps the replay threads at their priority: I can't build or run the Linux path here, so this PR doesn't change it. ### Tested <!-- 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. --> Windows 11 Pro 26200, Ryzen 9 5950X (32 threads, so 16 replay threads), RTX 3080 10 GB, NVIDIA 616.56, WinLibs GCC 15.2.0 r7. Demon's Souls PPSA01342 v1.005 on main `5d3ab7791` with and without this change (its Windows line), journal of 292 pipelines and 313 modules, default environment, presents shown in the window title: | | after 60 s | after 100 s | |---|---|---| | main | 2 | 2 (still 2 after 5 min) | | main, `APS5_PIPELINE_JOURNAL_THREADS=2` | 2 | 95 at 90 s | | main, `APS5_NO_PIPELINE_JOURNAL=1` | 2 | 408 at 110 s | | main, `APS5_THREAD_PRIORITY=high` | 2 | 109 at 90 s | | this PR | 2 | 345 | The wait at two presents for the first minute is in every row and is not changed here. This is a fix of a stall, not a speed claim, so there are no trace summaries. Focused tests on `main` (`6cd36e651`) and on this PR from the same machine and GPU, `ctest --test-dir build -R pipeline_journal -V` with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Vulkan SDK 1.4.363.0; `VK_LOADER_DEBUG=layer` shows the layer inserted): `agc_driver_pipeline_journal`, `agc_pipeline_journal`, `agc_pipeline_journal_long_paths` and `agc_pipeline_journal_extended_paths` pass on both, neither log has `was not found but was requested by env var VK_INSTANCE_LAYERS`, and neither has a `VUID-` message. ### 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 (`tools/pr_overlap.py`: ten open PRs touch `PipelineJournal.cpp`, none the replay threads' priority) - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none (#7203 was found with Demon's Souls; its first-minute wait remains) - [x] Unblocks: PPSA01342 #1283 - [x] GPUs tested: NVIDIA GeForce RTX 3080, driver 616.56, Windows 11 Pro 26200 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-24 13:47:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T13:47:04Z.

Review: CHANGES_REQUESTED


Two items block a complete review at head 65b261b9de90b9089843d1693b8c0dc40ebeb308:

  1. The hosted conventions check fails because the PR body is missing the required template sections What, Tested, and Checklist. The failing job reports those three errors. Please copy the repository PR template and retain/fill its required fields and checklist.
  2. The change adds a Linux getpriority/setpriority path, but the report says that branch was not compiled or run. Please compile and run the focused pipeline-journal test(s) on Linux. AGENTS.md also requires AGC focused tests with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, with main/change logs checked for missing validation-layer and new VUID- messages. Please report those results or clearly identify any environment limitation.

The Windows measurements are useful evidence for the starvation scenario, but they do not validate the new Linux-specific system-call path or satisfy the repository's required PR-body and AGC test checks. I have not run the PR's native tests locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638467489 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10632#pullrequestreview-5638467489). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T13:47:04Z. **Review:** CHANGES_REQUESTED --- Two items block a complete review at head `65b261b9de90b9089843d1693b8c0dc40ebeb308`: 1. The hosted `conventions` check fails because the PR body is missing the required template sections `What`, `Tested`, and `Checklist`. The failing job reports those three errors. Please copy the repository PR template and retain/fill its required fields and checklist. 2. The change adds a Linux `getpriority`/`setpriority` path, but the report says that branch was not compiled or run. Please compile and run the focused pipeline-journal test(s) on Linux. `AGENTS.md` also requires AGC focused tests with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, with main/change logs checked for missing validation-layer and new `VUID-` messages. Please report those results or clearly identify any environment limitation. The Windows measurements are useful evidence for the starvation scenario, but they do not validate the new Linux-specific system-call path or satisfy the repository's required PR-body and AGC test checks. I have not run the PR's native tests locally.
MarcZX10 commented 2026-10-24 14:07:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T14:07:29Z.

Review: APPROVED


Re-reviewed exact head 21d956616667d96ae524381df591f4e5277c08d0. The Linux priority path has been removed, so my prior request for Linux compilation/testing no longer applies. The PR now limits the behavior to Windows, applies THREAD_PRIORITY_BELOW_NORMAL at the start of each replay worker, logs a failure without aborting pipeline replay, and the required PR template/conventions check now passes. The author reports the focused pipeline_journal suite passing on both main and this head with Vulkan validation enabled on the same Windows 11 / RTX 3080 setup, with no missing-layer warning or VUID- output, plus the Demon's Souls stall reproduction recovering from 2 to 345 presents by 100 seconds. I did not independently reproduce those Windows/GPU runs; Linux code is unchanged. I found no remaining blocker.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638534170 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10632#pullrequestreview-5638534170). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T14:07:29Z. **Review:** APPROVED --- Re-reviewed exact head `21d956616667d96ae524381df591f4e5277c08d0`. The Linux priority path has been removed, so my prior request for Linux compilation/testing no longer applies. The PR now limits the behavior to Windows, applies `THREAD_PRIORITY_BELOW_NORMAL` at the start of each replay worker, logs a failure without aborting pipeline replay, and the required PR template/conventions check now passes. The author reports the focused `pipeline_journal` suite passing on both `main` and this head with Vulkan validation enabled on the same Windows 11 / RTX 3080 setup, with no missing-layer warning or `VUID-` output, plus the Demon's Souls stall reproduction recovering from 2 to 345 presents by 100 seconds. I did not independently reproduce those Windows/GPU runs; Linux code is unchanged. I found no remaining blocker.
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!10632
No description provided.