graphics: avoid draining unrelated priority work on guest unmap #1263

Open
github-bot wants to merge 4 commits from github-bot/gh-1263 into main AGit
Owner

@⁠popeee99 on GitHub · 2026-10-08 23:04 UTC · original
popeee99:fix/range-scoped-priority-unmap → main · +369 −32 · 10 files · 4 commits · open

Avoid draining the GPU queue when guest memory is unmapped while an unrelated priority callback is pending. Fixes #1178 (#1178). ### Cause and change RenderContext::UnmapMemory used a global pending-priority check, so even a host-only end-of-pipe event forced Finish() while the guest memory-operation lock was held. Priority operations now carry an optional guest range. Buffer and texture downloads declare their writeback ranges; flip, interrupt and suspend-point callbacks declare no guest-memory access. Omitted ranges remain conservative. The scheduler checks both queued operations and the currently executing callback under its existing mutex, retaining the active range until the callback returns. Existing cache-ownership checks and completion ordering are preserved. Buffer downloads conservatively cover their entire source buffer, including every packed copy. This does not remove required waits for cached GPU resources, overlapping writebacks or unannotated callbacks. ### Regression evidence A standalone reproduction linked against unchanged upstream emulator code at 2f4b8a335d5e27a5153bdea670bd877a061e37b1 queues the existing Sync::TriggerEopEventAtEndOfPipe operation, then unmaps an unrelated CPU-only range. Upstream advances the submission tick from 1 to 2 and fails the no-submission assertion. With the fix, the tick is unchanged. SchedulerUnmapTests.cpp uses a real Vulkan device and the production RenderContext and CommandScheduler. Its five scenarios cover host-only events, multiple queued ranges and overlap/adjacency boundaries, conservative unknown ranges, an actively executing callback, and real guest-backing writeback before unmap returns. These are state-based checks, not timing benchmarks. The focused fixture can run without the barycentric and min-LOD extensions required by the broader shader harness. ### Validation - Local Linux/WSL, Clang 21.1.8, Mesa llvmpipe: all five new scenarios pass. - ASan + UBSan: the test and every changed production translation unit are instrumented; all five scenarios pass without sanitizer diagnostics. Unchanged emulator translation units and third-party libraries were reused without sanitizer instrumentation. The guest test address is outside ASan's shadow reservation; no sanitizer checks are disabled. - Existing memory-tracker, page-manager, BitArray, LRU and emulator CLI CTest checks: 8/8 pass. - Full local emulator build and the CMake regression target both succeed; CTest runs all five scenarios successfully (18.91 seconds). - Implementation-commit fork CI: run 37852205381 succeeds on commit 6590aabb47f2b2a272d2ad979b64d3779b687a39: full application builds succeed on Windows, Linux and macOS; Windows CTest 12/12, Linux 15/15 (including scheduler_unmap, 4.55 seconds), macOS 14/14. All platforms build the new target; its Vulkan runtime regression runs on Linux with Mesa software Vulkan. Windows and macOS run their existing CI suites; this PR does not claim a Vulkan runtime test on those runners. - git diff --check passes.

  • Documentation follow-up 7cbcad4a8058a6663ed17f07b42d8de4a1284659 adds function contracts only. Removing the added documentation lines reproduces the previously verified source exactly. Cross-platform CI for this follow-up is in progress. ### Related work and limits PR #1190 changes submission ordering and merges cleanly in a three-way tree check; it was not combined for game testing. PR #702 addresses predicate waits, not unmap. It already conflicts with current main, and both changes touch the texture-download callback. Integrating both must preserve #702's pending-download bookkeeping and this PR's range argument; no combined-build claim is made. No proprietary game files were used. Ready or Not, hardware-GPU behavior and frame-time/audio improvements were not tested. The evidence establishes removal of the unrelated submission and preservation of the tested memory-completion ordering, not a game-performance result. ### AI assistance OpenAI Codex assisted with investigation, implementation, diff review and test execution. No human code review is claimed; human maintainer review is requested.
**@⁠popeee99** on GitHub · 2026-10-08 23:04 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1263) `popeee99:fix/range-scoped-priority-unmap` → `main` · +369 −32 · 10 files · 4 commits · open Avoid draining the GPU queue when guest memory is unmapped while an unrelated priority callback is pending. Fixes #1178 (https://git.gtahub.st/github/KytyPS5--KytyPS5/issues/1178). ### Cause and change `RenderContext::UnmapMemory` used a global pending-priority check, so even a host-only end-of-pipe event forced `Finish()` while the guest memory-operation lock was held. Priority operations now carry an optional guest range. Buffer and texture downloads declare their writeback ranges; flip, interrupt and suspend-point callbacks declare no guest-memory access. Omitted ranges remain conservative. The scheduler checks both queued operations and the currently executing callback under its existing mutex, retaining the active range until the callback returns. Existing cache-ownership checks and completion ordering are preserved. Buffer downloads conservatively cover their entire source buffer, including every packed copy. This does not remove required waits for cached GPU resources, overlapping writebacks or unannotated callbacks. ### Regression evidence A standalone reproduction linked against unchanged upstream emulator code at `2f4b8a335d5e27a5153bdea670bd877a061e37b1` queues the existing `Sync::TriggerEopEventAtEndOfPipe` operation, then unmaps an unrelated CPU-only range. Upstream advances the submission tick from **1 to 2** and fails the no-submission assertion. With the fix, the tick is unchanged. `SchedulerUnmapTests.cpp` uses a real Vulkan device and the production `RenderContext` and `CommandScheduler`. Its five scenarios cover host-only events, multiple queued ranges and overlap/adjacency boundaries, conservative unknown ranges, an actively executing callback, and real guest-backing writeback before unmap returns. These are state-based checks, not timing benchmarks. The focused fixture can run without the barycentric and min-LOD extensions required by the broader shader harness. ### Validation - Local Linux/WSL, Clang 21.1.8, Mesa llvmpipe: all five new scenarios pass. - ASan + UBSan: the test and every changed production translation unit are instrumented; all five scenarios pass without sanitizer diagnostics. Unchanged emulator translation units and third-party libraries were reused without sanitizer instrumentation. The guest test address is outside ASan's shadow reservation; no sanitizer checks are disabled. - Existing memory-tracker, page-manager, BitArray, LRU and emulator CLI CTest checks: **8/8 pass**. - Full local emulator build and the CMake regression target both succeed; CTest runs all five scenarios successfully (18.91 seconds). - Implementation-commit fork CI: [run 37852205381](https://github.com/popeee99/KytyPS5/actions/runs/37852205381) succeeds on commit `6590aabb47f2b2a272d2ad979b64d3779b687a39`: full application builds succeed on Windows, Linux and macOS; Windows CTest **12/12**, Linux **15/15** (including `scheduler_unmap`, 4.55 seconds), macOS **14/14**. All platforms build the new target; its Vulkan runtime regression runs on Linux with Mesa software Vulkan. Windows and macOS run their existing CI suites; this PR does not claim a Vulkan runtime test on those runners. - `git diff --check` passes. - Documentation follow-up `7cbcad4a8058a6663ed17f07b42d8de4a1284659` adds function contracts only. Removing the added documentation lines reproduces the previously verified source exactly. [Cross-platform CI for this follow-up](https://github.com/popeee99/KytyPS5/actions/runs/37858261228) is in progress. ### Related work and limits PR #1190 changes submission ordering and merges cleanly in a three-way tree check; it was not combined for game testing. PR #702 addresses predicate waits, not unmap. It already conflicts with current main, and both changes touch the texture-download callback. Integrating both must preserve #702's pending-download bookkeeping and this PR's range argument; no combined-build claim is made. No proprietary game files were used. Ready or Not, hardware-GPU behavior and frame-time/audio improvements were not tested. The evidence establishes removal of the unrelated submission and preservation of the tested memory-completion ordering, not a game-performance result. ### AI assistance OpenAI Codex assisted with investigation, implementation, diff review and test execution. No human code review is claimed; human maintainer review is requested.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:50:36 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 23:08 UTC · original · edited 2026-10-08 23:26 UTC

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b718c408-8dca-4b32-86e2-8ab6323a2b09
📥 Commits

Reviewing files that changed from the base of the PR and between 2f4b8a335d and 7cbcad4a80.

📒 Files selected for processing (10)
  • .github/workflows/build.yml
  • CMakeLists.txt
  • src/graphics/guest_gpu/graphicsRun.cpp
  • src/graphics/host_gpu/renderer/cache/bufferCache.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/commandScheduler.cpp
  • src/graphics/host_gpu/renderer/commandScheduler.h
  • src/graphics/host_gpu/renderer/renderContext.cpp
  • src/graphics/host_gpu/renderer/sync.cpp
  • tests/SchedulerUnmapTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

Deferred priority operations now carry optional guest ranges, and RenderContext::UnmapMemory checks for pending operations that overlap the range being unmapped. Buffer and texture writebacks provide their guest ranges; other deferred callbacks pass empty ranges. A Vulkan-backed test covers range overlap, unknown ranges, active callbacks, host events, and guest-memory writeback. CMake and CI configuration adds and builds the test; Linux CI also runs it.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 7cbca

No new merge-blocking issue is established. The remaining active-overlap test gap is optional integration coverage.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 64.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 37 functions across 8 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check Passed The description clearly explains the scheduler range changes, the guest-unmap fix, regression coverage, validation results, and known limits.
Title check Passed The title concisely and accurately describes the main change: avoiding unrelated priority-work draining during guest memory unmap.
Linked Issues check Passed The changes meet the coding requirements in [#1178]. RenderContext::UnmapMemory waits for priority work only when the unmapped range overlaps queued or active guest-memory work. Empty ranges represe…
Out of Scope Changes check Passed The changes stay within [#1178]. Scheduler range tracking, callback annotations, unmap handling, regression tests, CMake registration, and Vulkan CI dependencies implement or validate range-specific w…
Full details: Docstring Coverage

Explanation

Docstring coverage is 64.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 37 functions across 8 files. (2 skipped: 2 unsupported.)

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 23:08 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1263#issuecomment-6070839419) · edited 2026-10-08 23:26 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1263?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `b718c408-8dca-4b32-86e2-8ab6323a2b09` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 2f4b8a335d5e27a5153bdea670bd877a061e37b1 and 7cbcad4a8058a6663ed17f07b42d8de4a1284659. </details> <details> <summary>📒 Files selected for processing (10)</summary> * `.github/workflows/build.yml` * `CMakeLists.txt` * `src/graphics/guest_gpu/graphicsRun.cpp` * `src/graphics/host_gpu/renderer/cache/bufferCache.cpp` * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/commandScheduler.cpp` * `src/graphics/host_gpu/renderer/commandScheduler.h` * `src/graphics/host_gpu/renderer/renderContext.cpp` * `src/graphics/host_gpu/renderer/sync.cpp` * `tests/SchedulerUnmapTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough Deferred priority operations now carry optional guest ranges, and `RenderContext::UnmapMemory` checks for pending operations that overlap the range being unmapped. Buffer and texture writebacks provide their guest ranges; other deferred callbacks pass empty ranges. A Vulkan-backed test covers range overlap, unknown ranges, active callbacks, host events, and guest-memory writeback. CMake and CI configuration adds and builds the test; Linux CI also runs it. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"7cbcad4a8058a6663ed17f07b42d8de4a1284659" --> **Change:** Bug fix · **Severity of issue fixed:** Medium <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **⚪ Minimal** · up to `7cbca` <!-- final_review_risk_coverage:{"sourceCommitId":"7cbcad4a8058a6663ed17f07b42d8de4a1284659","coveredCommitId":"7cbcad4a8058a6663ed17f07b42d8de4a1284659","kind":"reviewed"} --> No new merge-blocking issue is established. The remaining active-overlap test gap is optional integration coverage. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :---------------- | :---------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 64.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 37 functions across 8 files. (2 skipped: … | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------ | :-------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description clearly explains the scheduler range changes, the guest-unmap fix, regression coverage, validation results, and known limits. | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title concisely and accurately describes the main change: avoiding unrelated priority-work draining during guest memory unmap. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The changes meet the coding requirements in [`#1178`]. `RenderContext::UnmapMemory` waits for priority work only when the unmapped range overlaps queued or active guest-memory work. Empty ranges represe… | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The changes stay within [`#1178`]. Scheduler range tracking, callback annotations, unmap handling, regression tests, CMake registration, and Vulkan CI dependencies implement or validate range-specific w… | </details> <details> <summary>Full details: Docstring Coverage</summary> **Explanation** Docstring coverage is 64.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 37 functions across 8 files. (2 skipped: 2 unsupported.) </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1263)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 23:17 UTC · original · reviewed

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · 🩺 Stability & Availability · SchedulerUnmapTests.cpp:202-230

tests/SchedulerUnmapTests.cpp:202-230
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

The test does not exercise the claimed regression. CheckActiveRange unmaps {Base + Page, Page}, while the blocked callback owns {Base, Page}. It therefore verifies only that a disjoint unmap does not wait for the active callback. It does not assert that an overlapping unmap waits until the callback completes.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f470db0f-989d-4c9c-b387-1899bf841ae0
📥 Commits

Reviewing files that changed from the base of the PR and between 6590aabb47 and 7cbcad4a80.

📒 Files selected for processing (7)
  • src/graphics/guest_gpu/graphicsRun.cpp
  • src/graphics/host_gpu/renderer/cache/bufferCache.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/commandScheduler.cpp
  • src/graphics/host_gpu/renderer/renderContext.cpp
  • src/graphics/host_gpu/renderer/sync.cpp
  • tests/SchedulerUnmapTests.cpp
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/graphics/host_gpu/renderer/cache/bufferCache.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/guest_gpu/graphicsRun.cpp
  • src/graphics/host_gpu/renderer/renderContext.cpp
  • src/graphics/host_gpu/renderer/sync.cpp
  • src/graphics/host_gpu/renderer/commandScheduler.cpp
  • tests/SchedulerUnmapTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 23:17 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1263#pullrequestreview-5463985697) · **reviewed** > [!CAUTION] > Some comments are outside the diff and can’t be posted inline due to GitHub limitations. > > **⚠️ Outside diff range comments (1)** > > <details> > <summary><strong>🟠 Major</strong> · <strong>🩺 Stability &amp; Availability</strong> · <code>SchedulerUnmapTests.cpp:202-230</code></summary><blockquote> > > `tests/SchedulerUnmapTests.cpp:202-230` > **🩺 Stability & Availability** | **🟠 Major** | **⚡ Quick win** > > The test does not exercise the claimed regression. `CheckActiveRange` unmaps `{Base + Page, Page}`, while the blocked callback owns `{Base, Page}`. It therefore verifies only that a disjoint unmap does not wait for the active callback. It does not assert that an overlapping unmap waits until the callback completes. > > <!-- cr-comment:v1:5819797cb276c247a6ca2f5e --> > > </blockquote></details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `f470db0f-989d-4c9c-b387-1899bf841ae0` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 6590aabb47f2b2a272d2ad979b64d3779b687a39 and 7cbcad4a8058a6663ed17f07b42d8de4a1284659. </details> <details> <summary>📒 Files selected for processing (7)</summary> * `src/graphics/guest_gpu/graphicsRun.cpp` * `src/graphics/host_gpu/renderer/cache/bufferCache.cpp` * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/commandScheduler.cpp` * `src/graphics/host_gpu/renderer/renderContext.cpp` * `src/graphics/host_gpu/renderer/sync.cpp` * `tests/SchedulerUnmapTests.cpp` </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes (7)</summary> * src/graphics/host_gpu/renderer/cache/bufferCache.cpp * src/graphics/host_gpu/renderer/cache/textureCache.cpp * src/graphics/guest_gpu/graphicsRun.cpp * src/graphics/host_gpu/renderer/renderContext.cpp * src/graphics/host_gpu/renderer/sync.cpp * src/graphics/host_gpu/renderer/commandScheduler.cpp * tests/SchedulerUnmapTests.cpp </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=8e74bc8e-ad83-46de-b170-107877ba85fe attempt=ce0ccfb2-70e0-4a36-8cfe-2e4163869be1 batch=1/1 -->
Author
Owner

@⁠popeee99 on GitHub · 2026-10-08 23:18 UTC · original

@⁠coderabbitai Please identify the exact file paths and function names counted as undocumented by the 64.86% docstring-coverage check on 7cbcad4a. The report counts 37 functions but does not list the missing ones. We want to document meaningful API, synchronization and lifetime contracts without adding redundant comments or changing the coverage configuration. Please also clarify the suggested active overlapping-writeback regression gap with reference to CheckActiveRange and CheckGuestWriteback.

**@⁠popeee99** on GitHub · 2026-10-08 23:18 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1263#issuecomment-6070956870) @⁠coderabbitai Please identify the exact file paths and function names counted as undocumented by the 64.86% docstring-coverage check on 7cbcad4a. The report counts 37 functions but does not list the missing ones. We want to document meaningful API, synchronization and lifetime contracts without adding redundant comments or changing the coverage configuration. Please also clarify the suggested active overlapping-writeback regression gap with reference to CheckActiveRange and CheckGuestWriteback.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 23:19 UTC · original

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
git rev-parse HEAD
git show --no-patch --format='%H %s' 7cbcad4a
gh api repos/KytyPS5/KytyPS5/issues/1263/comments --paginate --jq '.[] | {id, user:.user.login, body}'
gh api repos/KytyPS5/KytyPS5/pulls/1263/comments --paginate --jq '.[] | {id, user:.user.login, path, line, commit_id, body}'
gh api repos/KytyPS5/KytyPS5/commits/7cbcad4a/check-runs --jq '.check_runs[] | {name, conclusion, output}'
ast-grep outline tests/SchedulerUnmapTests.cpp --items all
git diff 7cbcad4a^ 7cbcad4a --stat
fd -H -i 'coderabbit|docstring|coverage' . -E .git

Length of output: 11427


🏁 Script executed:

#!/bin/bash
set -euo pipefail
gh api repos/KytyPS5/KytyPS5/pulls/1263 --jq '{base:.base.sha,head:.head.sha}'
gh api repos/KytyPS5/KytyPS5/pulls/1263/files --paginate --jq '.[] | {filename, patch}'
cat -n .coderabbit.yaml
sed -n '16,270p' tests/SchedulerUnmapTests.cpp | cat -n
for f in src/graphics/guest_gpu/graphicsRun.cpp src/graphics/host_gpu/renderer/cache/bufferCache.cpp src/graphics/host_gpu/renderer/cache/textureCache.cpp src/graphics/host_gpu/renderer/commandScheduler.cpp src/graphics/host_gpu/renderer/commandScheduler.h src/graphics/host_gpu/renderer/renderContext.cpp src/graphics/host_gpu/renderer/sync.cpp; do
  ast-grep outline "$f" --items all
done

Length of output: 72907


🏁 Script executed:

#!/bin/bash
set -euo pipefail
nl -ba src/graphics/host_gpu/renderer/commandScheduler.h | sed -n '17,100p'
nl -ba src/graphics/host_gpu/renderer/commandScheduler.cpp | sed -n '184,350p'
nl -ba src/graphics/host_gpu/renderer/renderContext.cpp | sed -n '90,130p'
nl -ba tests/SchedulerUnmapTests.cpp | sed -n '176,236p'

Length of output: 17396


@popeee99 I checked the source and the published report at 7cbcad4a8058a6663ed17f07b42d8de4a1284659.

Docstring coverage

I cannot identify the exact 13 functions that the check classified as undocumented from the available report. The published comment contains only the aggregate result. GitHub returned no check-run output with a per-function list.

The arithmetic is consistent with 24 documented functions out of 37, leaving 13 undocumented functions. It does not identify those functions.

Source inspection found the following 24 named function definitions touched by the PR. Every definition already has an adjacent /// documentation comment at this commit:

File path Documented function definitions
src/graphics/guest_gpu/graphicsRun.cpp GuestGpu::Process, CommandProcessor::PrepareCpuFlip
src/graphics/host_gpu/renderer/cache/bufferCache.cpp BufferCache::DownloadBufferMemory<async>
src/graphics/host_gpu/renderer/cache/textureCache.cpp TextureCache::DownloadImageMemory
src/graphics/host_gpu/renderer/commandScheduler.cpp CommandScheduler::PopPendingOperations, CommandScheduler::DeferPriorityOperation, CommandScheduler::QueueOperation, CommandScheduler::HasPendingPriorityOperations(), CommandScheduler::HasPendingPriorityOperations(GuestRange), CommandScheduler::PriorityOperationsThread
src/graphics/host_gpu/renderer/renderContext.cpp RenderContext::UnmapMemory
src/graphics/host_gpu/renderer/sync.cpp Sync::WriteAtEndOfPipeWithInterruptWriteBackFlip32, Sync::WriteAtEndOfPipeWithFlip32, Sync::WriteAtEndOfPipeOnlyFlip, Sync::TriggerEopEventAtEndOfPipe
tests/SchedulerUnmapTests.cpp Require, RequireVk, VulkanContext::VulkanContext, VulkanContext::~VulkanContext, CheckHostEvent, CheckQueuedRanges, CheckUnknownRange, CheckGuestWriteback, CheckActiveRange, main

The eighth C++ file is src/graphics/host_gpu/renderer/commandScheduler.h. Its changed function declarations have documented definitions in commandScheduler.cpp.

This source audit does not reproduce the check’s classification. I cannot establish whether the remaining entries are declarations, lambdas, or other extracted functions. Listing any of them as the exact missing 13 would be speculation.

The existing comments already describe meaningful contracts:

  • Unknown ranges remain conservative.
  • Empty ranges promise no guest-memory access.
  • Declared ranges must cover all callback guest accesses.
  • Captured resources must survive callback execution.
  • The active range remains visible until the callback returns.
  • Normal callbacks wait for priority callbacks through the same tick.
  • Deferred completion callbacks cannot initiate an unmap that waits on themselves.

I do not recommend duplicate comments or coverage-configuration changes based on this aggregate warning. Please retry the check and share any per-function diagnostic output it exposes. Until that output is available, the exact missing-function list remains unverified.

Active overlapping-writeback regression

My earlier wording was too broad. The tests already cover active-range retention and writeback-before-unmap-return. The remaining suggestion concerns their combination.

Both functions are in tests/SchedulerUnmapTests.cpp:

Test Existing coverage Case it does not directly exercise
CheckActiveRange, Line 204 Uses semaphores to hold an executing callback. Checks that its overlapping range remains visible. Confirms that an adjacent unmap does not submit more work. Checks range removal after callback completion. Calls no overlapping unmap while the callback is blocked. Performs no guest writeback.
CheckGuestWriteback, Line 180 Uses real guest backing. Defers WriteBacking, calls an overlapping unmap, then verifies the published value before releasing the kernel mapping. Does not force the callback to be executing and blocked before unmap starts.

The narrow additional case would:

  1. Hold a callback inside execution, after its GPU tick completes.
  2. Start an unmap of the callback’s overlapping range.
  3. Verify that unmap cannot return before callback completion.
  4. Release the callback, perform WriteBacking, and verify the value after unmap returns.

This would directly test the integration between active-range detection and the completion wait. The implementation already retains the active range through callback return and includes the active callback in WaitPriorityOperations.

This is an optional strengthening of integration coverage, not evidence of a current ordering defect or missing active-range coverage.

Thanks for the guidance on meaningful documentation.


✏️ Learnings added
Learnt from: popeee99
URL: https://github.com/KytyPS5/KytyPS5/pull/1263

Timestamp: 2026-10-08T23:19:39.202Z
Learning: For KytyPS5/KytyPS5, the user prefers documentation that explains meaningful API, synchronization, and lifetime contracts. Do not recommend redundant comments or coverage-configuration changes merely to satisfy an aggregate docstring-coverage warning.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 23:19 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1263#issuecomment-6070970946) <!-- This is an auto-generated reply by CodeRabbit --> > [!TIP] > For best results, initiate chat on the files or code changes. <details> <summary>🧩 Analysis chain</summary> 🏁 Script executed: ```shell #!/bin/bash set -euo pipefail git rev-parse HEAD git show --no-patch --format='%H %s' 7cbcad4a gh api repos/KytyPS5/KytyPS5/issues/1263/comments --paginate --jq '.[] | {id, user:.user.login, body}' gh api repos/KytyPS5/KytyPS5/pulls/1263/comments --paginate --jq '.[] | {id, user:.user.login, path, line, commit_id, body}' gh api repos/KytyPS5/KytyPS5/commits/7cbcad4a/check-runs --jq '.check_runs[] | {name, conclusion, output}' ast-grep outline tests/SchedulerUnmapTests.cpp --items all git diff 7cbcad4a^ 7cbcad4a --stat fd -H -i 'coderabbit|docstring|coverage' . -E .git ``` Length of output: 11427 --- 🏁 Script executed: ```shell #!/bin/bash set -euo pipefail gh api repos/KytyPS5/KytyPS5/pulls/1263 --jq '{base:.base.sha,head:.head.sha}' gh api repos/KytyPS5/KytyPS5/pulls/1263/files --paginate --jq '.[] | {filename, patch}' cat -n .coderabbit.yaml sed -n '16,270p' tests/SchedulerUnmapTests.cpp | cat -n for f in src/graphics/guest_gpu/graphicsRun.cpp src/graphics/host_gpu/renderer/cache/bufferCache.cpp src/graphics/host_gpu/renderer/cache/textureCache.cpp src/graphics/host_gpu/renderer/commandScheduler.cpp src/graphics/host_gpu/renderer/commandScheduler.h src/graphics/host_gpu/renderer/renderContext.cpp src/graphics/host_gpu/renderer/sync.cpp; do ast-grep outline "$f" --items all done ``` Length of output: 72907 --- 🏁 Script executed: ```shell #!/bin/bash set -euo pipefail nl -ba src/graphics/host_gpu/renderer/commandScheduler.h | sed -n '17,100p' nl -ba src/graphics/host_gpu/renderer/commandScheduler.cpp | sed -n '184,350p' nl -ba src/graphics/host_gpu/renderer/renderContext.cpp | sed -n '90,130p' nl -ba tests/SchedulerUnmapTests.cpp | sed -n '176,236p' ``` Length of output: 17396 --- </details> `@popeee99` I checked the source and the published report at `7cbcad4a8058a6663ed17f07b42d8de4a1284659`. ## Docstring coverage **I cannot identify the exact 13 functions that the check classified as undocumented from the available report.** The published comment contains only the aggregate result. GitHub returned no check-run output with a per-function list. The arithmetic is consistent with **24 documented functions out of 37**, leaving **13 undocumented functions**. It does not identify those functions. Source inspection found the following **24 named function definitions touched by the PR**. Every definition already has an adjacent `///` documentation comment at this commit: | File path | Documented function definitions | |:---|:---| | `src/graphics/guest_gpu/graphicsRun.cpp` | `GuestGpu::Process`, `CommandProcessor::PrepareCpuFlip` | | `src/graphics/host_gpu/renderer/cache/bufferCache.cpp` | `BufferCache::DownloadBufferMemory<async>` | | `src/graphics/host_gpu/renderer/cache/textureCache.cpp` | `TextureCache::DownloadImageMemory` | | `src/graphics/host_gpu/renderer/commandScheduler.cpp` | `CommandScheduler::PopPendingOperations`, `CommandScheduler::DeferPriorityOperation`, `CommandScheduler::QueueOperation`, `CommandScheduler::HasPendingPriorityOperations()`, `CommandScheduler::HasPendingPriorityOperations(GuestRange)`, `CommandScheduler::PriorityOperationsThread` | | `src/graphics/host_gpu/renderer/renderContext.cpp` | `RenderContext::UnmapMemory` | | `src/graphics/host_gpu/renderer/sync.cpp` | `Sync::WriteAtEndOfPipeWithInterruptWriteBackFlip32`, `Sync::WriteAtEndOfPipeWithFlip32`, `Sync::WriteAtEndOfPipeOnlyFlip`, `Sync::TriggerEopEventAtEndOfPipe` | | `tests/SchedulerUnmapTests.cpp` | `Require`, `RequireVk`, `VulkanContext::VulkanContext`, `VulkanContext::~VulkanContext`, `CheckHostEvent`, `CheckQueuedRanges`, `CheckUnknownRange`, `CheckGuestWriteback`, `CheckActiveRange`, `main` | The eighth C++ file is `src/graphics/host_gpu/renderer/commandScheduler.h`. Its changed function declarations have documented definitions in `commandScheduler.cpp`. **This source audit does not reproduce the check’s classification.** I cannot establish whether the remaining entries are declarations, lambdas, or other extracted functions. Listing any of them as the exact missing 13 would be speculation. The existing comments already describe meaningful contracts: - Unknown ranges remain conservative. - Empty ranges promise no guest-memory access. - Declared ranges must cover all callback guest accesses. - Captured resources must survive callback execution. - The active range remains visible until the callback returns. - Normal callbacks wait for priority callbacks through the same tick. - Deferred completion callbacks cannot initiate an unmap that waits on themselves. I do not recommend duplicate comments or coverage-configuration changes based on this aggregate warning. Please retry the check and share any per-function diagnostic output it exposes. Until that output is available, the exact missing-function list remains unverified. ## Active overlapping-writeback regression My earlier wording was too broad. **The tests already cover active-range retention and writeback-before-unmap-return.** The remaining suggestion concerns their combination. Both functions are in `tests/SchedulerUnmapTests.cpp`: | Test | Existing coverage | Case it does not directly exercise | |:---|:---|:---| | `CheckActiveRange`, Line 204 | Uses semaphores to hold an executing callback. Checks that its overlapping range remains visible. Confirms that an adjacent unmap does not submit more work. Checks range removal after callback completion. | Calls no overlapping unmap while the callback is blocked. Performs no guest writeback. | | `CheckGuestWriteback`, Line 180 | Uses real guest backing. Defers `WriteBacking`, calls an overlapping unmap, then verifies the published value before releasing the kernel mapping. | Does not force the callback to be executing and blocked before unmap starts. | The narrow additional case would: 1. Hold a callback **inside execution**, after its GPU tick completes. 2. Start an unmap of the callback’s overlapping range. 3. Verify that unmap cannot return before callback completion. 4. Release the callback, perform `WriteBacking`, and verify the value after unmap returns. This would directly test the integration between active-range detection and the completion wait. The implementation already retains the active range through callback return and includes the active callback in `WaitPriorityOperations`. This is an optional strengthening of integration coverage, **not evidence of a current ordering defect or missing active-range coverage**. Thanks for the guidance on meaningful documentation. --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: popeee99 URL: https://github.com/KytyPS5/KytyPS5/pull/1263 Timestamp: 2026-10-08T23:19:39.202Z Learning: For KytyPS5/KytyPS5, the user prefers documentation that explains meaningful API, synchronization, and lifetime contracts. Do not recommend redundant comments or coverage-configuration changes merely to satisfy an aggregate docstring-coverage warning. ``` > Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings). </details> _You are interacting with an AI system._
Author
Owner

@⁠popeee99 on GitHub · 2026-10-08 23:20 UTC · original

@⁠coderabbitai review

**@⁠popeee99** on GitHub · 2026-10-08 23:20 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1263#issuecomment-6070984566) @⁠coderabbitai review
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 23:20 UTC · original

⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 23:20 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1263#issuecomment-6070986169) <!-- This is an auto-generated reply by CodeRabbit --> <!-- CodeRabbit review command invocation: v2:92bb4b4ee5304ec3e3d576111d90a3ec5505e8f545cd8348947438787444e63f --> <details> <summary>⚠️ Action not completed</summary> Already reviewed the last commit. Use `@coderabbitai full review` to rerun a review of the entire changeset. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused. </details>
Author
Owner

@⁠popeee99 on GitHub · 2026-10-08 23:22 UTC · original

@⁠coderabbitai full review

**@⁠popeee99** on GitHub · 2026-10-08 23:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1263#issuecomment-6070999161) @⁠coderabbitai full review
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 23:22 UTC · original · edited 2026-10-08 23:26 UTC

✅ Action performed

Full review finished.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 23:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1263#issuecomment-6071000718) · edited 2026-10-08 23:26 UTC <!-- This is an auto-generated reply by CodeRabbit --> <!-- CodeRabbit review command invocation: v2:c5426694c83206238d22557c4a3f87a37dc748a3d8cf83f21b56ead9dbe77147 --> <details> <summary>✅ Action performed</summary> Full review finished. </details>
This pull request has changes conflicting with the target branch.
  • .github/workflows/build.yml
  • src/graphics/guest_gpu/graphicsRun.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/commandScheduler.cpp
  • src/graphics/host_gpu/renderer/commandScheduler.h
  • src/graphics/host_gpu/renderer/sync.cpp
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1263/head:github-bot/gh-1263'
git switch 'github-bot/gh-1263'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1263'
git switch 'github-bot/gh-1263'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1263'
git switch 'github-bot/gh-1263'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1263'
git switch 'main'
git merge --squash 'github-bot/gh-1263'
git switch 'main'
git merge --ff-only 'github-bot/gh-1263'
git switch 'main'
git merge 'github-bot/gh-1263'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.