gpu: avoid masked bitset copies in CPU dirty-page checks #2103

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

@⁠tikD1337 on GitHub · 2026-11-04 08:40 UTC · original
tikD1337:codex/bounded-dirty-range → main · +107 −1 · 3 files · 2 commits · closed without merging

Change

RegionManager::ChangeState<DirtySource::Cpu, true> checks for overlapping GPU-dirty pages by constructing a masked 1024-bit RegionBits temporary and calling Any(). This replaces that predicate with BitArray::AnyInRange(start, end), which checks the requested words directly and stops at the first set bit.

The new predicate uses half-open ranges. Empty, reversed and out-of-bounds ranges return false, matching the masked constructor. The CPU/GPU conflict condition, locking, dirty-state updates and page-protection operations are unchanged.

Draft: no game-level benefit has been established. I understand the contribution rules require a concrete game-related result. This is a tested CPU-only candidate awaiting integration and title validation, not a claim of improved FPS or a fix for a reported game bug.

Checked locally

Host: Windows, Intel Core i7-1185G7. Compiler: portable Zig 0.15.2 C++ toolchain, C++20.

  • Existing and expanded BitArrayTests.cpp built and passed with both -O2 and -O0 -g, using -Wall -Wextra -Werror. These were direct standalone compilations, not full CMake builds or CTest runs.
  • 12,857,892 range/pattern comparisons against an independent prefix-count oracle over 64-, 128- and 1024-bit arrays. Covers isolated boundary bits, cross-word ranges, full/empty states, sparse and alternating states, and reversed ranges.
  • 32,768 randomized tracker-sized queries after bitset changes, checked against a boolean-array oracle and the previous masked-copy predicate.
  • constexpr checks and oversized endpoints, including SIZE_MAX.
  • Three deliberate mutations were rejected: inclusive end and missing start mask by static_assert; skipped interior words by the runtime oracle.
  • git diff --check passed.

Synthetic timing only

Same process and machine; C++20 -O3 -DNDEBUG; 4096 query records; 4,194,304 calls per sample; warmup plus nine samples per implementation with rotated order. Medians in ns/call:

Workload Masked copy + Any (before) AnyInRange (after)
Single clean page 9.013 2.451
Single page, full dirty region 8.433 2.547
Short sparse range 8.154 3.631
Mixed ranges 9.680 3.029
Full clean region 10.502 7.630
Full dirty region 10.322 2.569
Full region, late hit 11.685 8.096

These measure standalone predicates in noinline wrappers, not the inlined ChangeState call site, lock contention, uploads, or frame time. Positive conflict results would terminate the production tracker operation; those workloads exercise the predicate, not representative successful game execution. The actual game benefit may be negligible. Laptop power state and background activity can affect these small timings.

Exact standalone benchmark source and command

Save as range-benchmark.cpp outside the source tree and compile from the repository root:

zig c++ -std=c++20 -O3 -DNDEBUG -Wall -Wextra -Werror -I src /path/to/range-benchmark.cpp -o range-benchmark
./range-benchmark

Only masked_ns and bounded_ns correspond to this PR's production change. old_ns is a separate FirstRangeFrom comparison; its production callers are unchanged.

#include "common/bitArray.h"
#include <algorithm>
#include <array>
#include <chrono>
#include <cstdio>
#include <cstdint>
#include <vector>

using Bits = Common::BitArray<1024>;
struct Query { Bits bits; size_t begin, end; };
using Fn = bool (*)(const Query&);
__attribute__((noinline)) bool Old(const Query& q) {
  return q.bits.FirstRangeFrom(q.begin).first < q.end;
}
__attribute__((noinline)) bool Masked(const Query& q) {
  return Bits(q.bits, q.begin, q.end).Any();
}
__attribute__((noinline)) bool Bounded(const Query& q) {
  return q.bits.AnyInRange(q.begin, q.end);
}
volatile uint64_t sink;
double Measure(const std::vector<Query>& queries, Fn fn) {
  constexpr size_t count = 4 * 1024 * 1024;
  uint64_t sum = 0;
  const auto start = std::chrono::steady_clock::now();
  for (size_t i = 0; i < count; i++) sum += fn(queries[i % queries.size()]);
  const auto stop = std::chrono::steady_clock::now();
  sink = sum;
  return std::chrono::duration<double, std::nano>(stop - start).count() / count;
}
int main() {
  const char* names[] = {"single-clean", "single-full", "short-sparse",
                         "mixed-ranges", "full-clean", "full-dense", "full-late-hit"};
  uint64_t seed = 123456789;
  auto next = [&] { seed ^= seed << 13; seed ^= seed >> 7; seed ^= seed << 17; return seed; };
  std::puts("case,old_ns,masked_ns,bounded_ns,old_over_bounded");
  for (int scenario = 0; scenario < 7; scenario++) {
    std::vector<Query> queries(4096);
    for (auto& q : queries) {
      q.begin = next() % 1024;
      q.end = q.begin + 1;
      if (scenario == 1 || scenario == 5) q.bits.Fill();
      if (scenario == 2 || scenario == 3) {
        for (int i = 0; i < 16; i++) q.bits.Set(next() % 1024);
        q.end = std::min<size_t>(1024, q.begin + 1 + next() % (scenario == 2 ? 16 : 1024));
      }
      if (scenario >= 4) { q.begin = 0; q.end = 1024; }
      if (scenario == 6) q.bits.Set(960 + next() % 64);
      if (Old(q) != Bounded(q) || Masked(q) != Bounded(q)) return 1;
    }
    std::array<Fn, 3> functions = {Old, Masked, Bounded};
    std::array<std::array<double, 9>, 3> times{};
    for (auto fn : functions) Measure(queries, fn);
    for (size_t round = 0; round < 9; round++) {
      for (size_t j = 0; j < 3; j++) {
        const auto which = (round + j) % 3;
        times[which][round] = Measure(queries, functions[which]);
      }
    }
    for (auto& values : times) std::sort(values.begin(), values.end());
    std::printf("%s,%.3f,%.3f,%.3f,%.3f\n", names[scenario],
                times[0][4], times[1][4], times[2][4], times[0][4] / times[2][4]);
  }
}

Still needs testing

  • Full Windows build with the project's supported clang-cl toolchain.
  • Full Linux build and the focused bit_array, memory_tracker and page_manager CTests on both platforms.
  • A real game or captured tracker workload: measure the frequency and cost of this exact conflict check; confirm unchanged upload/protection results and no new failures.
  • Before/after frame-time measurements on the same hardware and scene, if any game-performance claim is made.

No emulator executable, game, GPU correctness test or tracker integration suite has been run locally for this change. No specific title is claimed fixed or accelerated. Related memory-tracker work is already open in #1284 and #1886; this PR does not implement their atomic snapshots, locking changes or upload-generation cache.

AI assistance

AI-assisted: yes. Codex wrote the patch, tests, benchmark and this description, and ran the listed local checks on this PC. A human code review and the unchecked validation above are still needed.

**@⁠tikD1337** on GitHub · 2026-11-04 08:40 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2103) `tikD1337:codex/bounded-dirty-range` → `main` · +107 −1 · 3 files · 2 commits · closed without merging ## Change `RegionManager::ChangeState<DirtySource::Cpu, true>` checks for overlapping GPU-dirty pages by constructing a masked 1024-bit `RegionBits` temporary and calling `Any()`. This replaces that predicate with `BitArray::AnyInRange(start, end)`, which checks the requested words directly and stops at the first set bit. The new predicate uses half-open ranges. Empty, reversed and out-of-bounds ranges return false, matching the masked constructor. The CPU/GPU conflict condition, locking, dirty-state updates and page-protection operations are unchanged. **Draft: no game-level benefit has been established.** I understand the contribution rules require a concrete game-related result. This is a tested CPU-only candidate awaiting integration and title validation, not a claim of improved FPS or a fix for a reported game bug. ## Checked locally Host: Windows, Intel Core i7-1185G7. Compiler: portable Zig 0.15.2 C++ toolchain, C++20. - Existing and expanded `BitArrayTests.cpp` built and passed with both `-O2` and `-O0 -g`, using `-Wall -Wextra -Werror`. These were direct standalone compilations, **not full CMake builds or CTest runs**. - 12,857,892 range/pattern comparisons against an independent prefix-count oracle over 64-, 128- and 1024-bit arrays. Covers isolated boundary bits, cross-word ranges, full/empty states, sparse and alternating states, and reversed ranges. - 32,768 randomized tracker-sized queries after bitset changes, checked against a boolean-array oracle and the previous masked-copy predicate. - `constexpr` checks and oversized endpoints, including `SIZE_MAX`. - Three deliberate mutations were rejected: inclusive end and missing start mask by `static_assert`; skipped interior words by the runtime oracle. - `git diff --check` passed. ## Synthetic timing only Same process and machine; C++20 `-O3 -DNDEBUG`; 4096 query records; 4,194,304 calls per sample; warmup plus nine samples per implementation with rotated order. Medians in ns/call: | Workload | Masked copy + Any (before) | AnyInRange (after) | | --- | ---: | ---: | | Single clean page | 9.013 | 2.451 | | Single page, full dirty region | 8.433 | 2.547 | | Short sparse range | 8.154 | 3.631 | | Mixed ranges | 9.680 | 3.029 | | Full clean region | 10.502 | 7.630 | | Full dirty region | 10.322 | 2.569 | | Full region, late hit | 11.685 | 8.096 | These measure standalone predicates in `noinline` wrappers, not the inlined `ChangeState` call site, lock contention, uploads, or frame time. Positive conflict results would terminate the production tracker operation; those workloads exercise the predicate, not representative successful game execution. The actual game benefit may be negligible. Laptop power state and background activity can affect these small timings. <details> <summary>Exact standalone benchmark source and command</summary> Save as `range-benchmark.cpp` outside the source tree and compile from the repository root: ```sh zig c++ -std=c++20 -O3 -DNDEBUG -Wall -Wextra -Werror -I src /path/to/range-benchmark.cpp -o range-benchmark ./range-benchmark ``` Only `masked_ns` and `bounded_ns` correspond to this PR's production change. `old_ns` is a separate `FirstRangeFrom` comparison; its production callers are unchanged. ```cpp #include "common/bitArray.h" #include <algorithm> #include <array> #include <chrono> #include <cstdio> #include <cstdint> #include <vector> using Bits = Common::BitArray<1024>; struct Query { Bits bits; size_t begin, end; }; using Fn = bool (*)(const Query&); __attribute__((noinline)) bool Old(const Query& q) { return q.bits.FirstRangeFrom(q.begin).first < q.end; } __attribute__((noinline)) bool Masked(const Query& q) { return Bits(q.bits, q.begin, q.end).Any(); } __attribute__((noinline)) bool Bounded(const Query& q) { return q.bits.AnyInRange(q.begin, q.end); } volatile uint64_t sink; double Measure(const std::vector<Query>& queries, Fn fn) { constexpr size_t count = 4 * 1024 * 1024; uint64_t sum = 0; const auto start = std::chrono::steady_clock::now(); for (size_t i = 0; i < count; i++) sum += fn(queries[i % queries.size()]); const auto stop = std::chrono::steady_clock::now(); sink = sum; return std::chrono::duration<double, std::nano>(stop - start).count() / count; } int main() { const char* names[] = {"single-clean", "single-full", "short-sparse", "mixed-ranges", "full-clean", "full-dense", "full-late-hit"}; uint64_t seed = 123456789; auto next = [&] { seed ^= seed << 13; seed ^= seed >> 7; seed ^= seed << 17; return seed; }; std::puts("case,old_ns,masked_ns,bounded_ns,old_over_bounded"); for (int scenario = 0; scenario < 7; scenario++) { std::vector<Query> queries(4096); for (auto& q : queries) { q.begin = next() % 1024; q.end = q.begin + 1; if (scenario == 1 || scenario == 5) q.bits.Fill(); if (scenario == 2 || scenario == 3) { for (int i = 0; i < 16; i++) q.bits.Set(next() % 1024); q.end = std::min<size_t>(1024, q.begin + 1 + next() % (scenario == 2 ? 16 : 1024)); } if (scenario >= 4) { q.begin = 0; q.end = 1024; } if (scenario == 6) q.bits.Set(960 + next() % 64); if (Old(q) != Bounded(q) || Masked(q) != Bounded(q)) return 1; } std::array<Fn, 3> functions = {Old, Masked, Bounded}; std::array<std::array<double, 9>, 3> times{}; for (auto fn : functions) Measure(queries, fn); for (size_t round = 0; round < 9; round++) { for (size_t j = 0; j < 3; j++) { const auto which = (round + j) % 3; times[which][round] = Measure(queries, functions[which]); } } for (auto& values : times) std::sort(values.begin(), values.end()); std::printf("%s,%.3f,%.3f,%.3f,%.3f\n", names[scenario], times[0][4], times[1][4], times[2][4], times[0][4] / times[2][4]); } } ``` </details> ## Still needs testing - [ ] Full Windows build with the project's supported `clang-cl` toolchain. - [ ] Full Linux build and the focused `bit_array`, `memory_tracker` and `page_manager` CTests on both platforms. - [ ] A real game or captured tracker workload: measure the frequency and cost of this exact conflict check; confirm unchanged upload/protection results and no new failures. - [ ] Before/after frame-time measurements on the same hardware and scene, if any game-performance claim is made. No emulator executable, game, GPU correctness test or tracker integration suite has been run locally for this change. No specific title is claimed fixed or accelerated. Related memory-tracker work is already open in #1284 and #1886; this PR does not implement their atomic snapshots, locking changes or upload-generation cache. ## AI assistance AI-assisted: yes. Codex wrote the patch, tests, benchmark and this description, and ran the listed local checks on this PC. A human code review and the unchecked validation above are still needed.
Add a bounded BitArray predicate and use it for CPU/GPU dirty-page
conflict detection. Cover word boundaries, invalid ranges and randomized
tracker-sized states against independent and previous-predicate oracles.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:14:19 +00:00
github-bot closed this pull request 2026-11-26 10:14:19 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-04 09:05 UTC · original · edited 2026-11-04 09:08 UTC

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T09:08:23.961150Z 43ac010 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-04 09:05 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2103#issuecomment-6626977325) · edited 2026-11-04 09:08 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"43ac010b0c424c5bb298958631478dd733eba4e7","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> ## Codex Review Summary This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-04T09:08:23.961150Z">2026-11-04T09:08:23.961150Z</relative-time> | `43ac010` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details>
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-04 09:08 UTC · original · edited 2026-11-04 09:14 UTC

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

BitArray<N> adds AnyInRange(start, end) to check for set bits in a half-open range. RegionManager::ChangeState uses this method to check GPU dirty bits in the requested page range. Tests cover randomized and exhaustive ranges, invalid bounds, and constexpr behavior across 64-, 128-, and 1024-bit arrays.

Suggested reviewers: nmzik

Change: Refactor

Merge Risk: Minimal · up to 6c393

The change is mergeable with normal platform and game-level validation follow-up; no actionable code-level risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title names the main change: CPU dirty-page checks in the GPU region manager now avoid a masked bitset copy. The raw summary and objectives confirm that RegionManager::ChangeState swaps the masked…
Description check Passed The description is related to the changeset. It explains that RegionManager::ChangeState<DirtySource::Cpu, true> now uses BitArray::AnyInRange(start, end) instead of a masked RegionBits temporary with…
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: Title check

Explanation

The title names the main change: CPU dirty-page checks in the GPU region manager now avoid a masked bitset copy. The raw summary and objectives confirm that RegionManager::ChangeState swaps the masked RegionBits temporary and Any() call for BitArray::AnyInRange. The title is specific and accurate, and it is a single short sentence.

Full details: Description check

Explanation

The description is related to the changeset. It explains that RegionManager::ChangeState<DirtySource::Cpu, true> now uses BitArray::AnyInRange(start, end) instead of a masked RegionBits temporary with Any(). It also covers half-open range semantics, the local tests and benchmarks, and the validation still pending. The description is detailed and on-topic, so it passes this lenient check.

Full details: Docstring Coverage

Explanation

Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 3 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 43ac010b0c and 6c393d7f9a.

Files selected for processing: 3
  • src/common/bitArray.h
  • src/graphics/host_gpu/regionManager.h
  • tests/BitArrayTests.cpp
Files skipped from review as they are similar to previous changes: 2
  • src/common/bitArray.h
  • tests/BitArrayTests.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-11-04 09:08 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2103#issuecomment-6627039560) · edited 2026-11-04 09:14 UTC <!-- coderabbit-ai-generated:v1 --> <!-- 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/2103?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-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_status_start --> No actionable comments were generated in the recent review. <!-- recent_review_status_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> `BitArray<N>` adds `AnyInRange(start, end)` to check for set bits in a half-open range. `RegionManager::ChangeState` uses this method to check GPU dirty bits in the requested page range. Tests cover randomized and exhaustive ranges, invalid bounds, and constexpr behavior across 64-, 128-, and 1024-bit arrays. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"6c393d7f9acd403f39140cf41d2f5062174802e9" --> <!-- change_assessment_priority:{"version":1,"urgency":"p3","manual":false} --> **Change:** Refactor <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>6c393</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `6c393` --> <!-- final_review_risk_coverage:{"sourceCommitId":"6c393d7f9acd403f39140cf41d2f5062174802e9","coveredCommitId":"6c393d7f9acd403f39140cf41d2f5062174802e9","kind":"reviewed"} --> The change is mergeable with normal platform and game-level validation follow-up; no actionable code-level risk was identified. <!-- 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-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></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 warning</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… | 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 | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title names the main change: CPU dirty-page checks in the GPU region manager now avoid a masked bitset copy. The raw summary and objectives confirm that RegionManager::ChangeState swaps the masked… | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description is related to the changeset. It explains that RegionManager::ChangeState<DirtySource::Cpu, true> now uses BitArray::AnyInRange(start, end) instead of a masked RegionBits temporary with… | | 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. | <details> <summary><strong>Full details: Title check</strong></summary> <dl> <dd> **Explanation** The title names the main change: CPU dirty-page checks in the GPU region manager now avoid a masked bitset copy. The raw summary and objectives confirm that RegionManager::ChangeState swaps the masked RegionBits temporary and Any() call for BitArray::AnyInRange. The title is specific and accurate, and it is a single short sentence. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> **Explanation** The description is related to the changeset. It explains that RegionManager::ChangeState&lt;DirtySource::Cpu, true&gt; now uses BitArray::AnyInRange(start, end) instead of a masked RegionBits temporary with Any(). It also covers half-open range semantics, the local tests and benchmarks, and the validation still pending. The description is detailed and on-topic, so it passes this lenient check. </dd> </dl> </details> </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **Explanation** Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 3 files. **Resolution** Write docstrings for the functions missing them to satisfy the coverage threshold. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- announcements_start --> > [!TIP] > <details> > <summary><strong>🎯 Customize your risk assessments</strong></summary> > <dl> > <dd> > > Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using **Merge Risk Instructions** and **Security Risk Instructions** in your review settings. Security architecture risk assessments require the **Advanced plan or above**. > > </dd> > </dl> > </details> > > <details> > <summary><strong>✅ Automatic approvals, with your rules</strong></summary> > <dl> > <dd> > > Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable **Automatic approvals** in review settings, with overrides for teams or file paths. > > </dd> > </dl> > </details> <!-- announcements_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2103)! 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> <!-- tips_end --> <!-- recent_review_start --> <h6> <details> <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary> <dl> <dd> <!-- review_info_content --> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary> <dl> <dd> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/65fd1f61b9ed4604b9fe17f72ad4e1639d81df8b/.coderabbit.yaml>) - **Commit**: [65fd1f6](<https://github.com/KytyPS5/KytyPS5/commit/65fd1f61b9ed4604b9fe17f72ad4e1639d81df8b>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `08276a99-7d5a-4ff2-8f8a-7186120ba86f` </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between 43ac010b0c424c5bb298958631478dd733eba4e7 and 6c393d7f9acd403f39140cf41d2f5062174802e9. </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 3</strong></summary> <dl> <dd> * `src/common/bitArray.h` * `src/graphics/host_gpu/regionManager.h` * `tests/BitArrayTests.cpp` </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-similar-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-similar.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files skipped from review as they are similar to previous changes: 2</strong></summary> <dl> <dd> * src/common/bitArray.h * tests/BitArrayTests.cpp </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. </dd> </dl> </details> </h6> <!-- recent_review_end -->
Author
Owner

@⁠Nmzik on GitHub · 2026-11-04 22:23 UTC · original

@⁠tikD1337 credited

**@⁠Nmzik** on GitHub · 2026-11-04 22:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2103#issuecomment-6643660591) @⁠tikD1337 credited

Pull request closed

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