gpu: prove indexed buffer writes disjoint from scalar reads #1747

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

@⁠kewalker on GitHub · 2026-10-20 03:19 UTC · original
kewalker:codex/demons-souls-indexed-write-overlap → main · +270 −2 · 6 files · 4 commits · closed without merging

Fixes #1660.

Demon's Souls (PPSA01342) stops at scalar resource reads overlap a shader buffer write because the renderer treats the complete writable buffer binding as a write footprint. In shader 72c9c6d90df9ab3d, a scalar loop count is read from bytes 0–3 while BUFFER_ATOMIC_ADD writes a four-byte field at 64 * index + 24. Those accesses are disjoint even when the 32-bit index arithmetic wraps.

Track constant byte offsets and widths for raw DWORD stores and 32-bit integer-add atomics. For aligned, direct, unswizzled buffers with power-of-two strides, check scalar reads against the possible write residues. Unknown offsets, unsupported operations, formatting, lane addition, indirect aliases, and unsupported strides retain the conservative full-buffer check. Existing invalid-range, image-write, and address-write checks remain active. Buffer ownership and synchronization still cover the full binding.

I reviewed the code and the fix and tested it locally. The startup crash previously stopped after 111 compute shaders. With the fix, I passed that crash and reached gameplay in Demon’s Souls. This confirms startup-to-gameplay progress on my setup.

Validation:

  • Built and passed resource_tracking_tests and resource_materialization_tests against this isolated main-based branch.
  • Passed the renderer compilation check.
  • Added regression coverage for the captured atomic/header layout, enumerated byte-range comparisons, wrapped offsets, multiple writers, and conservative fallbacks.
  • Built and passed the caller-level scalar_buffer_write_bindings regression through RenderExecutor::CommitBindings: the disjoint header read succeeds, while a read of the atomic field retains the fatal overlap guard. Registered it with CTest.
  • Verified the regression catches the original bug: a temporary build restoring the old full-buffer caller gate fails the header case with the expected overlap diagnostic. The mutation is excluded from the PR.
  • Runtime testing used Windows, an Intel Core i7-10700, and an RTX 3060 Ti on the local integration build with main merged through 0cad4672. The standalone PR excludes the unrelated integration/FPS changes.

I also merged upstream main through 4644c529. The resolution preserves upstream�s fixed-offset write_extent bound alongside the indexed-write proof. After rebuilding the merged branch, the caller regression passes for disjoint fixed and indexed writes, and both overlapping cases retain the fatal guard. Removing the indexed proof still reproduces the header-read failure. Both resource suites and the renderer compilation check pass. Gameplay validation above was performed before this merge; I have not repeated the game run on the merged branch.

Related: #1403. This change retains the same-dispatch overlap guard and permits accesses only when their byte ranges can be proven disjoint.

**@⁠kewalker** on GitHub · 2026-10-20 03:19 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1747) `kewalker:codex/demons-souls-indexed-write-overlap` → `main` · +270 −2 · 6 files · 4 commits · closed without merging Fixes #1660. Demon's Souls (PPSA01342) stops at `scalar resource reads overlap a shader buffer write` because the renderer treats the complete writable buffer binding as a write footprint. In shader `72c9c6d90df9ab3d`, a scalar loop count is read from bytes 0–3 while `BUFFER_ATOMIC_ADD` writes a four-byte field at `64 * index + 24`. Those accesses are disjoint even when the 32-bit index arithmetic wraps. Track constant byte offsets and widths for raw DWORD stores and 32-bit integer-add atomics. For aligned, direct, unswizzled buffers with power-of-two strides, check scalar reads against the possible write residues. Unknown offsets, unsupported operations, formatting, lane addition, indirect aliases, and unsupported strides retain the conservative full-buffer check. Existing invalid-range, image-write, and address-write checks remain active. Buffer ownership and synchronization still cover the full binding. I reviewed the code and the fix and tested it locally. The startup crash previously stopped after 111 compute shaders. With the fix, I passed that crash and reached gameplay in Demon’s Souls. This confirms startup-to-gameplay progress on my setup. Validation: - Built and passed `resource_tracking_tests` and `resource_materialization_tests` against this isolated main-based branch. - Passed the renderer compilation check. - Added regression coverage for the captured atomic/header layout, enumerated byte-range comparisons, wrapped offsets, multiple writers, and conservative fallbacks. - Built and passed the caller-level `scalar_buffer_write_bindings` regression through `RenderExecutor::CommitBindings`: the disjoint header read succeeds, while a read of the atomic field retains the fatal overlap guard. Registered it with CTest. - Verified the regression catches the original bug: a temporary build restoring the old full-buffer caller gate fails the header case with the expected overlap diagnostic. The mutation is excluded from the PR. - Runtime testing used Windows, an Intel Core i7-10700, and an RTX 3060 Ti on the local integration build with main merged through `0cad4672`. The standalone PR excludes the unrelated integration/FPS changes. I also merged upstream `main` through `4644c529`. The resolution preserves upstream�s fixed-offset `write_extent` bound alongside the indexed-write proof. After rebuilding the merged branch, the caller regression passes for disjoint fixed and indexed writes, and both overlapping cases retain the fatal guard. Removing the indexed proof still reproduces the header-read failure. Both resource suites and the renderer compilation check pass. Gameplay validation above was performed before this merge; I have not repeated the game run on the merged branch. Related: #1403. This change retains the same-dispatch overlap guard and permits accesses only when their byte ranges can be proven disjoint.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:04:33 +00:00
github-bot closed this pull request 2026-11-26 10:04:33 +00:00
Author
Owner

@⁠kewalker on GitHub · 2026-10-20 03:23 UTC · original

@⁠Nmzik could you review this fix when you have a chance? I tested it locally and reached gameplay in Demon's Souls.

**@⁠kewalker** on GitHub · 2026-10-20 03:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1747#issuecomment-6282584400) @⁠Nmzik could you review this fix when you have a chance? I tested it locally and reached gameplay in Demon's Souls.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-20 03:27 UTC · original · edited 2026-10-21 10:30 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: a750bd5a-b1c8-4c91-b5cb-4d6c22dabc48
📥 Commits

Reviewing files that changed from the base of the PR and between 29d7b557cb and 930d50b208.

📒 Files selected for processing: 6
  • CMakeLists.txt
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/shader/recompiler/ir/ShaderIR.h
  • src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp
  • tests/ResourceTrackingTests.cpp
  • tests/ShaderRecompilerComputeTests.cpp

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

📝 Walkthrough

Buffer resources now store supported indexed write patterns and unknown-pattern state. BufferResource::WritesOverlap checks queried reads conservatively. CommitBindings reports scalar-resource read overlap only when both bounded ranges and recorded write patterns overlap. Tests cover indexed footprints, unsupported modes, aliases, disjoint reads, overlapping reads, and subprocess failure cases. CTest now runs the scalar-buffer overlap contract.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 930d5

The change lets disjoint scalar reads proceed past indexed buffer writes while keeping the conservative overlap check for unproven cases. Tests exercise the real commit path, and no concrete merge-blocking risk remains.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 53.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 4 files. (2 skipped: … 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 clearly and concisely summarizes the main change: proving that indexed buffer writes are disjoint from scalar reads.
Description check Passed The description is directly related to the changeset. It explains the Demon’s Souls failure, the indexed-write overlap analysis, conservative fallbacks, validation, and regression coverage.
Linked Issues check Passed Issue #1660 identifies the scalar-read versus shader-buffer-write failure. The PR adds indexed write-pattern tracking for supported raw DWORD stores and 32-bit integer-add atomics. `RenderExecutor::Co…
Out of Scope Changes check Passed The changes are limited to indexed buffer write tracking, descriptor overlap validation, focused documentation, regression tests, and CTest registration. These changes directly support issue #1660. No…
Full details: Linked Issues check

Explanation

Issue #1660 identifies the scalar-read versus shader-buffer-write failure. The PR adds indexed write-pattern tracking for supported raw DWORD stores and 32-bit integer-add atomics. RenderExecutor::CommitBindings applies the bounded-range and WritesOverlap checks. Unsupported cases retain conservative checking. Existing safety checks remain active. ResourceTrackingTests and ShaderRecompilerComputeTests cover disjoint, overlapping, wrapped, multiple-writer, and fallback cases. The reported gameplay run uses PPSA01342, while issue #1660 lists PPSA01341, so that runtime report does not independently verify the issue's exact serial. The coding requirements are implemented and tested.

Full details: Out of Scope Changes check

Explanation

The changes are limited to indexed buffer write tracking, descriptor overlap validation, focused documentation, regression tests, and CTest registration. These changes directly support issue #1660. No unrelated feature or behavior change is demonstrated.

Full details: Docstring Coverage

Explanation

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

Resolution

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

  • 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-20 03:27 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1747#issuecomment-6282632392) · edited 2026-10-21 10:30 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/1747?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**: `a750bd5a-b1c8-4c91-b5cb-4d6c22dabc48` </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between 29d7b557cb2d1ad7e8995785a7bdae7b585d9d1a and 930d50b208427417630849a5d2e23c6da7e22776. </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing: 6</strong></summary> <dl> <dd> * `CMakeLists.txt` * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `src/graphics/shader/recompiler/ir/ShaderIR.h` * `src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp` * `tests/ResourceTrackingTests.cpp` * `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; 7 remain after this review. </dd> </dl> </details> <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> Buffer resources now store supported indexed write patterns and unknown-pattern state. `BufferResource::WritesOverlap` checks queried reads conservatively. `CommitBindings` reports scalar-resource read overlap only when both bounded ranges and recorded write patterns overlap. Tests cover indexed footprints, unsupported modes, aliases, disjoint reads, overlapping reads, and subprocess failure cases. CTest now runs the scalar-buffer overlap contract. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"930d50b208427417630849a5d2e23c6da7e22776" --> **Change:** Bug fix · **Severity of issue fixed:** Medium <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>⚪ Minimal</strong> · up to <code>930d5</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `930d5` --> <!-- final_review_risk_coverage:{"sourceCommitId":"930d50b208427417630849a5d2e23c6da7e22776","coveredCommitId":"930d50b208427417630849a5d2e23c6da7e22776","kind":"reviewed"} --> The change lets disjoint scalar reads proceed past indexed buffer writes while keeping the conservative overlap check for unproven cases. Tests exercise the real commit path, and no concrete merge-blocking risk remains. <!-- 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 53.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 4 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 | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely summarizes the main change: proving that indexed buffer writes are disjoint from scalar reads. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description is directly related to the changeset. It explains the Demon’s Souls failure, the indexed-write overlap analysis, conservative fallbacks, validation, and regression coverage. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Issue `#1660` identifies the scalar-read versus shader-buffer-write failure. The PR adds indexed write-pattern tracking for supported raw DWORD stores and 32-bit integer-add atomics. `RenderExecutor::Co… | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The changes are limited to indexed buffer write tracking, descriptor overlap validation, focused documentation, regression tests, and CTest registration. These changes directly support issue `#1660`. No… | <details> <summary><strong>Full details: Linked Issues check</strong></summary> <dl> <dd> **Explanation** Issue `#1660` identifies the scalar-read versus shader-buffer-write failure. The PR adds indexed write-pattern tracking for supported raw DWORD stores and 32-bit integer-add atomics. `RenderExecutor::CommitBindings` applies the bounded-range and `WritesOverlap` checks. Unsupported cases retain conservative checking. Existing safety checks remain active. `ResourceTrackingTests` and `ShaderRecompilerComputeTests` cover disjoint, overlapping, wrapped, multiple-writer, and fallback cases. The reported gameplay run uses PPSA01342, while issue `#1660` lists PPSA01341, so that runtime report does not independently verify the issue's exact serial. The coding requirements are implemented and tested. </dd> </dl> </details> <details> <summary><strong>Full details: Out of Scope Changes check</strong></summary> <dl> <dd> **Explanation** The changes are limited to indexed buffer write tracking, descriptor overlap validation, focused documentation, regression tests, and CTest registration. These changes directly support issue `#1660`. No unrelated feature or behavior change is demonstrated. </dd> </dl> </details> </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **Explanation** Docstring coverage is 53.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 4 files. (2 skipped: 1 unsupported, 1 too large.) **Resolution** Write docstrings for the functions missing them to satisfy the coverage threshold. </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=1747)! 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

@⁠coderabbitai[bot] on GitHub · 2026-10-20 03:37 UTC · original · reviewed

🧹 Nitpick comments: 1
tests/ResourceTrackingTests.cpp: 1

5005-5033: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a CommitBindings regression test.

TestIndexedWriteFootprints tests ResourceInfo::WritesOverlap directly. It does not call RenderExecutor::CommitBindings with scalar reads and buffer writes. Reverting the caller to the previous gate would still pass this test while rejecting the disjoint header read that the new proof must allow. Existing CommitBindings tests cover other binding and layout cases.

Add an integration-level case that passes a disjoint scalar read and an indexed buffer write through CommitBindings, then verifies that an overlapping scalar read still fails.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2452ab62-1418-4ef4-84b5-06a45446035e
📥 Commits

Reviewing files that changed from the base of the PR and between dfeb99f97d and c2529858ff.

📒 Files selected for processing: 4
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/shader/recompiler/ir/ShaderIR.h
  • src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp
  • tests/ResourceTrackingTests.cpp
🚧 Files skipped from review as they are similar to previous changes: 4
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • tests/ResourceTrackingTests.cpp
  • src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp
  • src/graphics/shader/recompiler/ir/ShaderIR.h

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-20 03:37 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1747#pullrequestreview-5580476938) · **reviewed** <details> <summary>🧹 Nitpick comments: 1</summary><blockquote> <details> <summary>tests/ResourceTrackingTests.cpp: 1</summary><blockquote> `5005-5033`: **📐 Maintainability & Code Quality** | **🔵 Trivial** | **⚡ Quick win** **Add a `CommitBindings` regression test.** `TestIndexedWriteFootprints` tests `ResourceInfo::WritesOverlap` directly. It does not call `RenderExecutor::CommitBindings` with scalar reads and buffer writes. Reverting the caller to the previous gate would still pass this test while rejecting the disjoint header read that the new proof must allow. Existing `CommitBindings` tests cover other binding and layout cases. Add an integration-level case that passes a disjoint scalar read and an indexed buffer write through `CommitBindings`, then verifies that an overlapping scalar read still fails. <!-- cr-comment:v1:ef711a7d70bf47bf7b646f22 --> </blockquote></details> </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**: `2452ab62-1418-4ef4-84b5-06a45446035e` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between dfeb99f97d98fbb0c8b56f1d77103f1ca9ccaa3f and c2529858ff769b16ce80d0bffaa683bcf02f8ac4. </details> <details> <summary>📒 Files selected for processing: 4</summary> * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `src/graphics/shader/recompiler/ir/ShaderIR.h` * `src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp` * `tests/ResourceTrackingTests.cpp` </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes: 4</summary> * src/graphics/host_gpu/renderer/pipeline/descriptors.cpp * tests/ResourceTrackingTests.cpp * src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp * src/graphics/shader/recompiler/ir/ShaderIR.h </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=df895536-a29f-4c4e-b566-3253d3529c30 attempt=406fa907-dd1b-49fc-8475-be8d36718afc batch=1/1 -->
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-20 14:17 UTC · original

@⁠kewalker @⁠Nmzik both this PR and my #1630 say "Fixes #1660" (Demon's Souls, scalar resource reads overlap a shader buffer write), so I compared them on the shader from kavg13's #1591 log (CS 0x02632cb15eb8128d, PPSA01341). Its shape looks like the one described here: a count read from bytes 0-3 of a buffer that the same dispatch updates with BUFFER_ATOMIC_ADD at record * stride + 24. The log has no buffer descriptor, so the stride of that buffer is unknown.

I rebuilt the shader from the log's listing and ran Kyty's recompiler on it on the CPU, then applied CommitBindings' overlap rule (with this PR's BufferResource::WritesOverlap when applied), all on 0cad4672:

stride 48 stride 64
0cad4672 EXIT EXIT
+ #1747 EXIT no EXIT
+ #1630 no EXIT no EXIT

So the two take different routes: this PR keeps the captured read and proves the written bytes disjoint, which needs a power-of-two stride; #1630 stops capturing a read of a value the shader itself writes when it only decides a branch. This PR also covers reads that are not branch decisions, which #1630 does not touch (like UFC 6's record count in #1738). For PPSA01341 the result depends on the real stride, so both may be needed.

Game runs so far: volan3 got past the error on PPSA01341 with #1630 (#821), and you got past it on PPSA01342 with this PR. I can share the reconstruction test if it helps.

**@⁠Nawid3333** on GitHub · 2026-10-20 14:17 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1747#issuecomment-6292998133) @⁠kewalker @⁠Nmzik both this PR and my #1630 say "Fixes #1660" (Demon's Souls, `scalar resource reads overlap a shader buffer write`), so I compared them on the shader from kavg13's #1591 log (CS 0x02632cb15eb8128d, PPSA01341). Its shape looks like the one described here: a count read from bytes 0-3 of a buffer that the same dispatch updates with `BUFFER_ATOMIC_ADD` at record * stride + 24. The log has no buffer descriptor, so the stride of that buffer is unknown. I rebuilt the shader from the log's listing and ran Kyty's recompiler on it on the CPU, then applied CommitBindings' overlap rule (with this PR's `BufferResource::WritesOverlap` when applied), all on 0cad4672: | | stride 48 | stride 64 | |---|---|---| | 0cad4672 | EXIT | EXIT | | + #1747 | EXIT | no EXIT | | + #1630 | no EXIT | no EXIT | So the two take different routes: this PR keeps the captured read and proves the written bytes disjoint, which needs a power-of-two stride; #1630 stops capturing a read of a value the shader itself writes when it only decides a branch. This PR also covers reads that are not branch decisions, which #1630 does not touch (like UFC 6's record count in #1738). For PPSA01341 the result depends on the real stride, so both may be needed. Game runs so far: volan3 got past the error on PPSA01341 with #1630 (#821), and you got past it on PPSA01342 with this PR. I can share the reconstruction test if it helps.

Pull request closed

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