gpu: sync only logged ranges before BDA draws #1286

Closed
github-bot wants to merge 8 commits from gh-pr/1286/head into gh-pr/1286/base
Owner

@⁠NeySlim on GitHub · 2026-10-09 07:25 UTC · original
NeySlim:perf/bda-incremental-sync → main · +730 −116 · 13 files · 8 commits · closed without merging

Stacked on #1211 (perf/gpu-command-thread): it builds on the CPU-dirty generation added there. Only the last three commits are new.

Problem

Before every draw or dispatch whose shaders address memory directly (about 700 per frame in God of War Ragnarök, PPSA08332, 05.005), RenderContext::PrepareBda uploads the CPU-written pages of every registered buffer. #1211 skips it when the guest CPU wrote nothing since the previous call, but this game writes every frame (about 2000 write faults per frame), so the sweep still runs on most calls: it walks every mapped range and every registered buffer, takes each tracker region lock and scans its dirty bits, to upload a few pages.

Profile of the GPU command thread in the opening cutscene: PrepareBda is 10.4% of its samples, and draws and dispatches run 15.6 SynchronizeBuffer calls each on average, most of them on clean buffers.

Change

  • MemoryTracker logs the page ranges it marks CPU-dirty (InvalidateRegion, MarkRegionAsCpuModified, UntrackMemory, new regions), in a log reserved once (4096 ranges, an adjacent range extends the previous entry, so logging from the fault handler does not allocate). TakeCpuDirtyLog hands them over, or reports a gap on the first call or after an overflow. Until a sweep takes the log, writes skip it and its mutex (an atomic flag, with fences pairing the flag and the dirty bits so a write that skips the log is seen by the full sweep that follows).
  • BufferCache keeps the ranges of buffers registered since the previous sweep (up to 1024).
  • PrepareBda, when the generation or the registration epoch changed, synchronizes only the logged and newly registered ranges that are mapped, with one upload per buffer and mapped span. A gap in either log falls back to the full sweep.
  • RenderContext::MapMemory logs the parts of a range that were not mapped, once they are. This replaces the mapping epoch of #1211, which would force a full sweep.
  • Invariant: a mapped CPU-dirty page of a registered buffer became dirty, was mapped or was registered after the previous sweep took the logs, so it lies in a logged range. The logs are taken before the scan, so a write landing during it stays logged for the next sweep, as the generation already guarantees.

Test

  • MemoryTrackerTests: new TestCpuDirtyLog (new regions, marks, invalidations, untracking and mapped ranges are logged as page ranges, adjacent ones merge, an overflow reports one gap) and TestUntakenLogSkipsItsMutex (before any take, CPU writes complete while the test holds the log mutex; once taken, the next write is logged).

  • New BdaIncrementalSweep (--bda-sweep-only, ctest buffer_cache_bda_sweep, also in the default run). Three buffers in three tracker regions:

    • CPU writes to scattered pages, and a buffer registered after the previous sweep over pages written while no buffer covered them, reach the GPU copies; an unwritten page keeps its contents;
    • a buffer without logged CPU writes is not visited: the test takes the log entry of a write to it, and the page stays CPU-dirty with its old GPU contents after the sweep (a full sweep would upload it);
    • memory unmapped across a sweep, written and mapped again reaches the GPU copy.

    Without the change the idle-buffer check fails (the full sweep uploads the page). The test runs on one thread, like the GPU command thread. Without the mapped-range logging, this test and BdaSweepAfterRemap from #1211 fail at "mapped again".

Validation

Linux, Ryzen AI Max+ 395, Radeon 8060S, Mesa RADV 26.2.3.

  • God of War Ragnarök from a new game, alternating this change and the previous sweep every 5 s within a session, so both see the same scenes (two sessions, about 3 minutes of each scene per setting). Time spent in PrepareBda per frame:
Before After
Cutscene (about 670 calls per frame) 8.5 ms 6.0 ms
Gameplay (about 850 calls per frame) 13.8 ms 9.4 ms

What remains is the work on pages the CPU did write: re-protecting them after the upload and waiting for tracker region locks held by guest threads handling write faults. Draws and dispatches run 6.9 SynchronizeBuffer calls each on average instead of 15.6. Screenshots of the same scenes show no rendering difference.

  • memory_tracker_tests, page_manager_tests, resource_tracking_tests, resource_materialization_tests and the new buffer_cache_bda_sweep pass.
  • shader_recompiler_compute_tests, one case per process: same results as #1211 without these commits, plus the new case (595 of 604 cases pass; the same 9 fail on both on this RADV setup).

Not tested on Windows or macOS. The change adds no platform-specific code (a mutex, an atomic flag and fixed-capacity vectors next to the existing tracker state), and the new check uses the same direct-memory calls as the other buffer cache checks and runs on every platform.

AI use

I used Claude Code (AI agent) to profile the GPU command thread, write the change and the tests, and run the measurements and tests above on my machine. I reviewed the diff and the results before opening this PR.

**@⁠NeySlim** on GitHub · 2026-10-09 07:25 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1286) `NeySlim:perf/bda-incremental-sync` → `main` · +730 −116 · 13 files · 8 commits · closed without merging Stacked on #1211 (`perf/gpu-command-thread`): it builds on the CPU-dirty generation added there. Only the last three commits are new. ## Problem Before every draw or dispatch whose shaders address memory directly (about 700 per frame in God of War Ragnarök, PPSA08332, 05.005), `RenderContext::PrepareBda` uploads the CPU-written pages of every registered buffer. #1211 skips it when the guest CPU wrote nothing since the previous call, but this game writes every frame (about 2000 write faults per frame), so the sweep still runs on most calls: it walks every mapped range and every registered buffer, takes each tracker region lock and scans its dirty bits, to upload a few pages. Profile of the GPU command thread in the opening cutscene: `PrepareBda` is 10.4% of its samples, and draws and dispatches run 15.6 `SynchronizeBuffer` calls each on average, most of them on clean buffers. ## Change - `MemoryTracker` logs the page ranges it marks CPU-dirty (`InvalidateRegion`, `MarkRegionAsCpuModified`, `UntrackMemory`, new regions), in a log reserved once (4096 ranges, an adjacent range extends the previous entry, so logging from the fault handler does not allocate). `TakeCpuDirtyLog` hands them over, or reports a gap on the first call or after an overflow. Until a sweep takes the log, writes skip it and its mutex (an atomic flag, with fences pairing the flag and the dirty bits so a write that skips the log is seen by the full sweep that follows). - `BufferCache` keeps the ranges of buffers registered since the previous sweep (up to 1024). - `PrepareBda`, when the generation or the registration epoch changed, synchronizes only the logged and newly registered ranges that are mapped, with one upload per buffer and mapped span. A gap in either log falls back to the full sweep. - `RenderContext::MapMemory` logs the parts of a range that were not mapped, once they are. This replaces the mapping epoch of #1211, which would force a full sweep. - Invariant: a mapped CPU-dirty page of a registered buffer became dirty, was mapped or was registered after the previous sweep took the logs, so it lies in a logged range. The logs are taken before the scan, so a write landing during it stays logged for the next sweep, as the generation already guarantees. ## Test - `MemoryTrackerTests`: new `TestCpuDirtyLog` (new regions, marks, invalidations, untracking and mapped ranges are logged as page ranges, adjacent ones merge, an overflow reports one gap) and `TestUntakenLogSkipsItsMutex` (before any take, CPU writes complete while the test holds the log mutex; once taken, the next write is logged). - New `BdaIncrementalSweep` (`--bda-sweep-only`, ctest `buffer_cache_bda_sweep`, also in the default run). Three buffers in three tracker regions: - CPU writes to scattered pages, and a buffer registered after the previous sweep over pages written while no buffer covered them, reach the GPU copies; an unwritten page keeps its contents; - a buffer without logged CPU writes is not visited: the test takes the log entry of a write to it, and the page stays CPU-dirty with its old GPU contents after the sweep (a full sweep would upload it); - memory unmapped across a sweep, written and mapped again reaches the GPU copy. Without the change the idle-buffer check fails (the full sweep uploads the page). The test runs on one thread, like the GPU command thread. Without the mapped-range logging, this test and `BdaSweepAfterRemap` from #1211 fail at "mapped again". ## Validation Linux, Ryzen AI Max+ 395, Radeon 8060S, Mesa RADV 26.2.3. - God of War Ragnarök from a new game, alternating this change and the previous sweep every 5 s within a session, so both see the same scenes (two sessions, about 3 minutes of each scene per setting). Time spent in `PrepareBda` per frame: | | Before | After | |---|---|---| | Cutscene (about 670 calls per frame) | 8.5 ms | 6.0 ms | | Gameplay (about 850 calls per frame) | 13.8 ms | 9.4 ms | What remains is the work on pages the CPU did write: re-protecting them after the upload and waiting for tracker region locks held by guest threads handling write faults. Draws and dispatches run 6.9 `SynchronizeBuffer` calls each on average instead of 15.6. Screenshots of the same scenes show no rendering difference. - `memory_tracker_tests`, `page_manager_tests`, `resource_tracking_tests`, `resource_materialization_tests` and the new `buffer_cache_bda_sweep` pass. - `shader_recompiler_compute_tests`, one case per process: same results as #1211 without these commits, plus the new case (595 of 604 cases pass; the same 9 fail on both on this RADV setup). Not tested on Windows or macOS. The change adds no platform-specific code (a mutex, an atomic flag and fixed-capacity vectors next to the existing tracker state), and the new check uses the same direct-memory calls as the other buffer cache checks and runs on every platform. ## AI use I used Claude Code (AI agent) to profile the GPU command thread, write the change and the tests, and run the measurements and tests above on my machine. I reviewed the diff and the results before opening this PR.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:51:30 +00:00
github-bot closed this pull request 2026-11-26 09:51:30 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 07:31 UTC · original · edited 2026-10-16 00:57 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: 52b03462-85ca-40b8-ac4c-472d33240b24
📥 Commits

Reviewing files that changed from the base of the PR and between 61a3310b9166ae863add275c99845720749d925b and aad472588f.

📒 Files selected for processing: 5
  • CMakeLists.txt
  • src/graphics/host_gpu/renderer/cache/bufferCache.cpp
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/shader/recompiler/ir/Value.h
  • tests/ShaderRecompilerComputeTests.cpp

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

📝 Walkthrough

The change adds CPU-dirty tracking and incremental synchronization for mapped addressable buffers. It adds checks for overlap between specialization reads and writable image ranges. Shader IR accessor definitions move into inline definitions. New tests cover dirty tracking, buffer sweeps, and remapping.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Refactor

Merge Risk: ⚪ Minimal · up to aad47

No confirmed synchronization issue prevents merging, subject to normal checks.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 6.12% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 49 functions across 10 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description clearly explains the CPU-dirty range logging, incremental BDA synchronization, performance impact, tests, and validation results.
Title check Passed The title clearly and concisely identifies the main change: synchronizing only logged ranges before BDA draws.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 6.12% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 49 functions across 10 files. (2 skipped: 1 unsupported, 1 too large.)

  • Autofix · 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-09 07:31 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1286#issuecomment-6076525706) · edited 2026-10-16 00:57 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/1286?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary><strong>ℹ️ Recent review info</strong></summary> <dl> <dd> <details> <summary><strong>⚙️ Run configuration</strong></summary> <dl> <dd> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `52b03462-85ca-40b8-ac4c-472d33240b24` </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between 61a3310b9166ae863add275c99845720749d925b and aad472588fcf74246d0ff0bd7ba4c1b5476df167. </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing: 5</strong></summary> <dl> <dd> * `CMakeLists.txt` * `src/graphics/host_gpu/renderer/cache/bufferCache.cpp` * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `src/graphics/shader/recompiler/ir/Value.h` * `tests/ShaderRecompilerComputeTests.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. </dd> </dl> </details> <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> The change adds CPU-dirty tracking and incremental synchronization for mapped addressable buffers. It adds checks for overlap between specialization reads and writable image ranges. Shader IR accessor definitions move into inline definitions. New tests cover dirty tracking, buffer sweeps, and remapping. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"aad472588fcf74246d0ff0bd7ba4c1b5476df167" --> **Change:** Refactor <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>⚪ Minimal</strong> · up to <code>aad47</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `aad47` --> <!-- final_review_risk_coverage:{"sourceCommitId":"aad472588fcf74246d0ff0bd7ba4c1b5476df167","coveredCommitId":"aad472588fcf74246d0ff0bd7ba4c1b5476df167","kind":"reviewed"} --> No confirmed synchronization issue prevents merging, subject to normal checks. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-inconclusive-14-v2.svg" width="14" height="14" align="middle" alt="Inconclusive" title="Inconclusive"></picture></sup> 1</strong></summary> <dl> <dd> <strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 inconclusive</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :--------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Inconclusive](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-inconclusive.svg) | Docstring coverage is 6.12% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 49 functions across 10 files. (2 skipped: … | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> Passed checks: 4 passed</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------ | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description clearly explains the CPU-dirty range logging, incremental BDA synchronization, performance impact, tests, and validation results. | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely identifies the main change: synchronizing only logged ranges before BDA draws. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **Explanation** Docstring coverage is 6.12% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 49 functions across 10 files. (2 skipped: 1 unsupported, 1 too large.) </dd> </dl> </details> </dd> </dl> </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">Autofix</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=1286)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>❤️ Share</strong></summary> <dl> <dd> - [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) </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠NeySlim on GitHub · 2026-10-09 09:43 UTC · original

Updated after an internal review:

  • NoteCpuDirty no longer takes the log mutex while no sweep has taken the log. An atomic flag guards it, and seq_cst fences pair the flag with the dirty bits, so a write that skips the log is seen by the full sweep that follows the take completing it. New test TestUntakenLogSkipsItsMutex.
  • BdaIncrementalSweep no longer relies on a held region lock, which lock-free dirty queries would bypass, and runs on one thread like the GPU command thread: it takes the log entry of a write to the idle buffer and checks that the page is still CPU-dirty with its old GPU contents after the sweep. A full sweep fails it.
  • Removed the note about #1284: its dirty-ahead commit is gone.
**@⁠NeySlim** on GitHub · 2026-10-09 09:43 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1286#issuecomment-6078427508) Updated after an internal review: - `NoteCpuDirty` no longer takes the log mutex while no sweep has taken the log. An atomic flag guards it, and seq_cst fences pair the flag with the dirty bits, so a write that skips the log is seen by the full sweep that follows the take completing it. New test `TestUntakenLogSkipsItsMutex`. - `BdaIncrementalSweep` no longer relies on a held region lock, which lock-free dirty queries would bypass, and runs on one thread like the GPU command thread: it takes the log entry of a write to the idle buffer and checks that the page is still CPU-dirty with its old GPU contents after the sweep. A full sweep fails it. - Removed the note about #1284: its dirty-ahead commit is gone.
Author
Owner

@⁠NeySlim on GitHub · 2026-10-14 05:59 UTC · original

#1391 goes after the same PrepareBda sweep and is based directly on main. The approaches differ a bit:

  • #1391 keeps a hierarchical bitmap of 4 MiB CPU-dirty regions (about 520 KiB per tracker). It never overflows, but a hint covers every buffer in the region.
  • This PR logs exact page ranges in a fixed log (4096 ranges) and falls back to the full sweep on overflow. It needs the CPU-dirty generation from #1211, which is why it is stacked.

Both keep the existing page ownership checks for what actually gets uploaded. In God of War Ragnarök the sweep was about 10% of the GPU thread before this change. If #1391 is preferred I am fine with closing this one; otherwise I can make it standalone on main.

**@⁠NeySlim** on GitHub · 2026-10-14 05:59 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1286#issuecomment-6161979568) #1391 goes after the same `PrepareBda` sweep and is based directly on main. The approaches differ a bit: - #1391 keeps a hierarchical bitmap of 4 MiB CPU-dirty regions (about 520 KiB per tracker). It never overflows, but a hint covers every buffer in the region. - This PR logs exact page ranges in a fixed log (4096 ranges) and falls back to the full sweep on overflow. It needs the CPU-dirty generation from #1211, which is why it is stacked. Both keep the existing page ownership checks for what actually gets uploaded. In God of War Ragnarök the sweep was about 10% of the GPU thread before this change. If #1391 is preferred I am fine with closing this one; otherwise I can make it standalone on main.
Author
Owner

@⁠NeySlim on GitHub · 2026-10-16 17:17 UTC · original

Closing this: d58aefde4 landed the same idea on main (QueueBdaSync/TakeBdaSync with SynchronizeBda), covering CPU writes, invalidations, untracking, new registrations and remapped memory, with tests for each. I went through the remaining differences and didn't find a case main misses, so there's nothing left here worth keeping.

**@⁠NeySlim** on GitHub · 2026-10-16 17:17 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1286#issuecomment-6220856978) Closing this: d58aefde4 landed the same idea on main (QueueBdaSync/TakeBdaSync with SynchronizeBda), covering CPU writes, invalidations, untracking, new registrations and remapped memory, with tests for each. I went through the remaining differences and didn't find a case main misses, so there's nothing left here worth keeping.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.