fix(gpu): correct SPIR-V reductions, BDA safety and texture mip views #1693

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

@⁠herrMirto on GitHub · 2026-10-19 09:10 UTC · original
herrMirto:fix/spirv-shader-and-texture-fixes → main · +567 −44 · 18 files · 2 commits · closed without merging

A "small" PR containing changes made during some tests with EA FC27. Going from not rendering the main menus at all, until having a full match played, with pretty much everything being correctly rendered. Also, there was some improvements on FPSs, as on the first tries they were around 3fps and on latest around 10fps.

Tested on Linux(SteamOS) Ryzen 7 9800X3D + RX 9070 XT 16 GB + 32 GB RAM

  • Support UMax and bitwise OR subgroup reductions across split waves.
  • Preserve reused selectors in S_SETPC dword jump tables.
  • Reject invalid guest BDA addresses and initialize page-table and fault storage.
  • Fall back to supported image flags for compressed 3D textures.
  • Preserve physical layouts when rebasing extra guest mip levels.
  • Distinguish rebased mip chains in the texture cache.
  • Add regression coverage for shader reductions, BDA access and mip cache identity.

The regression tests are based on shader and texture scenarios encountered while testing EA FC27.

**@⁠herrMirto** on GitHub · 2026-10-19 09:10 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1693) `herrMirto:fix/spirv-shader-and-texture-fixes` → `main` · +567 −44 · 18 files · 2 commits · closed without merging A "small" PR containing changes made during some tests with EA FC27. Going from not rendering the main menus at all, until having a full match played, with pretty much everything being correctly rendered. Also, there was some improvements on FPSs, as on the first tries they were around 3fps and on latest around 10fps. Tested on Linux(SteamOS) Ryzen 7 9800X3D + RX 9070 XT 16 GB + 32 GB RAM - Support UMax and bitwise OR subgroup reductions across split waves. - Preserve reused selectors in S_SETPC dword jump tables. - Reject invalid guest BDA addresses and initialize page-table and fault storage. - Fall back to supported image flags for compressed 3D textures. - Preserve physical layouts when rebasing extra guest mip levels. - Distinguish rebased mip chains in the texture cache. - Add regression coverage for shader reductions, BDA access and mip cache identity. The regression tests are based on shader and texture scenarios encountered while testing EA FC27.
- Support UMax and bitwise OR subgroup reductions across split waves.
- Preserve reused selectors in S_SETPC dword jump tables.
- Reject invalid guest BDA addresses and initialize page-table and fault storage.
- Fall back to supported image flags for compressed 3D textures.
- Preserve physical layouts when rebasing extra guest mip levels.
- Distinguish rebased mip chains in the texture cache.
- Add regression coverage for shader reductions, BDA access and mip cache identity.

The regression tests are based on shader and texture scenarios encountered
while testing EA FC27.
Do not bypass the masked-seed check when a full-EXEC proof uses literal
true and has no saved symbolic execution mask. Reject non-neutral
fallbacks before replacing the prefix scan with a subgroup reduction.

Add the literal-execution negative case for UMin, UMax and bitwise OR.
Document the affected shader, BDA, mip-view and regression-test contracts.

Validation:
- The new negative case failed before the matcher correction.
- scalar_provenance_tests passed after the correction.
- shader_cfg_tests passed.
- git diff --check passed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:03:28 +00:00
github-bot closed this pull request 2026-11-26 10:03:28 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-19 09:58 UTC · original · edited 2026-10-19 12: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: c076434d-d9e8-4559-9a68-c6bbc4781ebe
📥 Commits

Reviewing files that changed from the base of the PR and between cdb803a98d and 8a71ab106f.

📒 Files selected for processing: 17
  • src/graphics/host_gpu/renderer/cache/bufferCache.cpp
  • src/graphics/host_gpu/renderer/cache/bufferCache.h
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/image/image.cpp
  • src/graphics/host_gpu/renderer/image/imageInfo.cpp
  • src/graphics/host_gpu/renderer/image/imageInfo.h
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp
  • src/graphics/shader/recompiler/frontend/cfg/ShaderCFG.cpp
  • src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp
  • src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp
  • tests/ScalarProvenanceTests.cpp
  • tests/ShaderRecompilerComputeTests.cpp
  • tests/shaderCfgTests.cpp
🚧 Files skipped from review as they are similar to previous changes: 14
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp
  • src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp
  • src/graphics/host_gpu/renderer/image/image.cpp
  • src/graphics/host_gpu/renderer/image/imageInfo.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/shader/recompiler/frontend/cfg/ShaderCFG.cpp
  • src/graphics/host_gpu/renderer/image/imageInfo.cpp
  • src/graphics/host_gpu/renderer/cache/bufferCache.cpp
  • tests/shaderCfgTests.cpp
  • tests/ShaderRecompilerComputeTests.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.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

The changes add one-time BDA buffer initialization and validate flat BDA addresses. Image handling normalizes oversized guest mip views and includes guest mip metadata in cache identity. The shader recompiler adds unsigned-maximum and bitwise-OR subgroup reductions, adjusts jump-table selector handling, and probes usage flags for block-compressed volume images. Tests cover these paths, including mip layouts and cached contents.

Suggested reviewers: nmzik

Priority: ⬆️ High

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 8a71a

No confirmed issue prevents merging after 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 61.70% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 47 functions across 15 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 is concise and accurately identifies the main GPU fixes: SPIR-V reductions, BDA safety, and texture mip views. It is specific enough for repository history.
Description check Passed The description directly explains the GPU fixes, testing results, affected areas, and regression coverage. It is clearly related to the changeset.
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 61.70% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 47 functions across 15 files. (2 skipped: 2 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-19 09:58 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1693#issuecomment-6264585964) · edited 2026-10-19 12: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/1693?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**: `c076434d-d9e8-4559-9a68-c6bbc4781ebe` </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between cdb803a98dd06fed4e9e3984f5c5032b7bdef5a0 and 8a71ab106f6c417aa105d74e5b39b656def16a63. </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing: 17</strong></summary> <dl> <dd> * `src/graphics/host_gpu/renderer/cache/bufferCache.cpp` * `src/graphics/host_gpu/renderer/cache/bufferCache.h` * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/image/image.cpp` * `src/graphics/host_gpu/renderer/image/imageInfo.cpp` * `src/graphics/host_gpu/renderer/image/imageInfo.h` * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp` * `src/graphics/shader/recompiler/frontend/cfg/ShaderCFG.cpp` * `src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp` * `src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp` * `tests/ScalarProvenanceTests.cpp` * `tests/ShaderRecompilerComputeTests.cpp` * `tests/shaderCfgTests.cpp` </dd> </dl> </details> <details> <summary><strong>🚧 Files skipped from review as they are similar to previous changes: 14</strong></summary> <dl> <dd> * src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp * src/graphics/host_gpu/renderer/cache/textureCache.cpp * src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp * src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp * src/graphics/host_gpu/renderer/image/image.cpp * src/graphics/host_gpu/renderer/image/imageInfo.h * src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h * src/graphics/host_gpu/renderer/pipeline/descriptors.cpp * src/graphics/shader/recompiler/frontend/cfg/ShaderCFG.cpp * src/graphics/host_gpu/renderer/image/imageInfo.cpp * src/graphics/host_gpu/renderer/cache/bufferCache.cpp * tests/shaderCfgTests.cpp * tests/ShaderRecompilerComputeTests.cpp * src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.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> The changes add one-time BDA buffer initialization and validate flat BDA addresses. Image handling normalizes oversized guest mip views and includes guest mip metadata in cache identity. The shader recompiler adds unsigned-maximum and bitwise-OR subgroup reductions, adjusts jump-table selector handling, and probes usage flags for block-compressed volume images. Tests cover these paths, including mip layouts and cached contents. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⬆️ High <!-- change_assessment_commit:"8a71ab106f6c417aa105d74e5b39b656def16a63" --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>⚪ Minimal</strong> · up to <code>8a71a</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `8a71a` --> <!-- final_review_risk_coverage:{"sourceCommitId":"8a71ab106f6c417aa105d74e5b39b656def16a63","coveredCommitId":"8a71ab106f6c417aa105d74e5b39b656def16a63","kind":"reviewed"} --> No confirmed issue prevents merging after 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 61.70% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 47 functions across 15 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 is concise and accurately identifies the main GPU fixes: SPIR-V reductions, BDA safety, and texture mip views. It is specific enough for repository history. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description directly explains the GPU fixes, testing results, affected areas, and regression coverage. It is clearly related to the changeset. | | 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 61.70% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 47 functions across 15 files. (2 skipped: 2 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=1693)! 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 -->
@ -144,0 +148,4 @@
if (seed == nullptr || seed->Arg(2).Resolve() == Value(neutral)) return prefix;
continue;
}
if (seed != nullptr && seed->Arg(2).Resolve() == Value(neutral)) {
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-19 09:58 UTC · original · edited 2026-10-19 12:18 UTC

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Check how saved_exec is set and where the early return at line 141 applies.
rg -n -C4 'saved_exec' src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp

Repository: KytyPS5/KytyPS5

Length of output: 1567


🏁 Script executed:

sed -n '90,220p' src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp
printf '\n--- callers and tests ---\n'
rg -n -C5 -F -- 'WaveReductionMatcher' src tests || test "$?" -eq 1
rg -n -C5 -e 'SubgroupUMinU32' -e 'SubgroupUMaxU32' -e 'SubgroupOrU32' -e 'ReadLane' src/graphics/shader/recompiler/ir/passes tests || test "$?" -eq 1

Repository: KytyPS5/KytyPS5

Length of output: 40222


🏁 Script executed:

sed -n '622,745p' tests/ScalarProvenanceTests.cpp
printf '\n--- changed-file diff ---\n'
git diff e5f0ee7fc2fb4ce88c6abb2fa02296404e2fe2a cdb803a98dd06fed4e9e3984f5c5032b7bdef5a0 -- src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp tests/ScalarProvenanceTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 18758


🏁 Script executed:

rg -n -C4 -F -- 'SubgroupUMinU32' src/graphics src | head -n 160
printf '\n--- DPP/update semantics references ---\n'
rg -n -C4 -e 'DppUpdateU32' -e 'DppMoveU32' src/graphics/shader/recompiler | head -n 220

Repository: KytyPS5/KytyPS5

Length of output: 24185


🏁 Script executed:

sed -n '725,825p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp

Repository: KytyPS5/KytyPS5

Length of output: 4830


Preserve the neutral-seed check when saved_exec is empty.

FullExec(Value(true)) does not set saved_exec. In Case::LiteralMasked, the execution controls are literal true, but the retained seed is still a SelectU32 with a masked false branch. Line 141 returns before checking that branch. A wrong fallback can therefore reach the subgroup reduction for all three operations. Case::Literal covers only the unmasked seed path.

🐛 Suggested fix
--- "a/src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp"
+++ "b/src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp"
@@ -137,11 +137,15 @@
 			for (const uint32_t shift: {8u, 4u, 2u, 1u}) {
 				prefix = attempt.MatchRow(prefix, shift);
 			}
 			prefix = attempt.Unwrap(prefix);
-			if (prefix.IsEmpty() || attempt.saved_exec.IsEmpty()) return prefix;
+			if (prefix.IsEmpty()) return prefix;
 			const auto* seed = attempt.Get(prefix, ValueOpcode::SelectU32);
 			const auto neutral = operation == ValueOpcode::UMin32 ? UINT32_MAX : 0u;
+			if (attempt.saved_exec.IsEmpty()) {
+				if (seed == nullptr || seed->Arg(2).Resolve() == Value(neutral)) return prefix;
+				continue;
+			}
 			if (seed != nullptr && seed->Arg(2).Resolve() == Value(neutral)) {
 				const auto predicate = seed->Arg(0).Resolve();
 				const auto* subset = attempt.Get(predicate, ValueOpcode::LogicalAnd);
 				if (predicate == attempt.saved_exec ||

Add a regression case with literal execution controls and a non-neutral masked seed.

✅ Addressed in commit 8a71ab1

**@⁠coderabbitai[bot]** on GitHub · 2026-10-19 09:58 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1693#discussion_r4312490652) · edited 2026-10-19 12:18 UTC **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash # Check how saved_exec is set and where the early return at line 141 applies. rg -n -C4 'saved_exec' src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 1567 --- 🏁 Script executed: ```bash sed -n '90,220p' src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp printf '\n--- callers and tests ---\n' rg -n -C5 -F -- 'WaveReductionMatcher' src tests || test "$?" -eq 1 rg -n -C5 -e 'SubgroupUMinU32' -e 'SubgroupUMaxU32' -e 'SubgroupOrU32' -e 'ReadLane' src/graphics/shader/recompiler/ir/passes tests || test "$?" -eq 1 ``` Repository: KytyPS5/KytyPS5 Length of output: 40222 --- 🏁 Script executed: ```bash sed -n '622,745p' tests/ScalarProvenanceTests.cpp printf '\n--- changed-file diff ---\n' git diff e5f0ee7fc2fb4ce88c6abb2fa02296404e2fe2a cdb803a98dd06fed4e9e3984f5c5032b7bdef5a0 -- src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp tests/ScalarProvenanceTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 18758 --- 🏁 Script executed: ```bash rg -n -C4 -F -- 'SubgroupUMinU32' src/graphics src | head -n 160 printf '\n--- DPP/update semantics references ---\n' rg -n -C4 -e 'DppUpdateU32' -e 'DppMoveU32' src/graphics/shader/recompiler | head -n 220 ``` Repository: KytyPS5/KytyPS5 Length of output: 24185 --- 🏁 Script executed: ```bash sed -n '725,825p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 4830 --- </details> **Preserve the neutral-seed check when `saved_exec` is empty.** `FullExec(Value(true))` does not set `saved_exec`. In `Case::LiteralMasked`, the execution controls are literal `true`, but the retained seed is still a `SelectU32` with a masked false branch. Line 141 returns before checking that branch. A wrong fallback can therefore reach the subgroup reduction for all three operations. `Case::Literal` covers only the unmasked seed path. <details> <summary>🐛 Suggested fix</summary> ```diff --- "a/src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp" +++ "b/src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp" @@ -137,11 +137,15 @@ for (const uint32_t shift: {8u, 4u, 2u, 1u}) { prefix = attempt.MatchRow(prefix, shift); } prefix = attempt.Unwrap(prefix); - if (prefix.IsEmpty() || attempt.saved_exec.IsEmpty()) return prefix; + if (prefix.IsEmpty()) return prefix; const auto* seed = attempt.Get(prefix, ValueOpcode::SelectU32); const auto neutral = operation == ValueOpcode::UMin32 ? UINT32_MAX : 0u; + if (attempt.saved_exec.IsEmpty()) { + if (seed == nullptr || seed->Arg(2).Resolve() == Value(neutral)) return prefix; + continue; + } if (seed != nullptr && seed->Arg(2).Resolve() == Value(neutral)) { const auto predicate = seed->Arg(0).Resolve(); const auto* subset = attempt.Get(predicate, ValueOpcode::LogicalAnd); if (predicate == attempt.saved_exec || ``` Add a regression case with literal execution controls and a non-neutral masked seed. </details> <!-- fingerprinting:phantom:poseidon:beignet55 --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:5702d3b36c296552b30f095a --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 8a71ab1
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-19 09:58 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1f050349-8a96-4cb8-9857-3806f9c577b5
📥 Commits

Reviewing files that changed from the base of the PR and between e5f0ee7fc2 and cdb803a98d.

📒 Files selected for processing: 18
  • src/graphics/host_gpu/renderer/cache/bufferCache.cpp
  • src/graphics/host_gpu/renderer/cache/bufferCache.h
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/image/image.cpp
  • src/graphics/host_gpu/renderer/image/imageInfo.cpp
  • src/graphics/host_gpu/renderer/image/imageInfo.h
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp
  • src/graphics/shader/recompiler/frontend/cfg/ShaderCFG.cpp
  • src/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.inc
  • src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp
  • src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp
  • tests/ScalarProvenanceTests.cpp
  • tests/ShaderRecompilerComputeTests.cpp
  • tests/shaderCfgTests.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.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-19 09:58 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1693#pullrequestreview-5569850070) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `1f050349-8a96-4cb8-9857-3806f9c577b5` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between e5f0ee7fc2fb4ce88c6abb2fa02296404e2fe2a6 and cdb803a98dd06fed4e9e3984f5c5032b7bdef5a0. </details> <details> <summary>📒 Files selected for processing: 18</summary> * `src/graphics/host_gpu/renderer/cache/bufferCache.cpp` * `src/graphics/host_gpu/renderer/cache/bufferCache.h` * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/image/image.cpp` * `src/graphics/host_gpu/renderer/image/imageInfo.cpp` * `src/graphics/host_gpu/renderer/image/imageInfo.h` * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp` * `src/graphics/shader/recompiler/frontend/cfg/ShaderCFG.cpp` * `src/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.inc` * `src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp` * `src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp` * `tests/ScalarProvenanceTests.cpp` * `tests/ShaderRecompilerComputeTests.cpp` * `tests/shaderCfgTests.cpp` </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. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=d253ac8a-c50f-4c55-b457-da6db4e5a7e2 attempt=663551fa-bbbd-49f0-89d0-290443dc252b batch=1/1 -->
Author
Owner

@⁠theantipopau on GitHub · 2026-10-20 00:50 UTC · original

Heads-up on process, not content: only the CodeRabbit check has reported here — no platform builds ran, so the +567/-44 across 18 files (including shader CFG, SPIR-V emitters, and mip-view paths) is currently unverified by CI. A rebase onto current main plus a push should trigger the build matrix. Note the base has moved a lot underneath this (VR #1726, EQAA handling, CopyImage clamping at 440245f6); worth a fresh conflict check too.

**@⁠theantipopau** on GitHub · 2026-10-20 00:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1693#issuecomment-6280694382) Heads-up on process, not content: only the CodeRabbit check has reported here — no platform builds ran, so the +567/-44 across 18 files (including shader CFG, SPIR-V emitters, and mip-view paths) is currently unverified by CI. A rebase onto current main plus a push should trigger the build matrix. Note the base has moved a lot underneath this (VR #1726, EQAA handling, CopyImage clamping at 440245f6); worth a fresh conflict check too.
Author
Owner

@⁠Nmzik on GitHub · 2026-10-20 02:48 UTC · original

@⁠herrMirto Hi! Can you explain the other commits you made and how you came up with those fixes?
For me, the game goes into a match after the “Preserve reused selectors in S_SETPC dword jump tables” fix

**@⁠Nmzik** on GitHub · 2026-10-20 02:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1693#issuecomment-6282165909) @⁠herrMirto Hi! Can you explain the other commits you made and how you came up with those fixes? For me, the game goes into a match after the “Preserve reused selectors in S_SETPC dword jump tables” fix
Author
Owner

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

Screenshot_20261020_043338
**@⁠Nmzik** on GitHub · 2026-10-20 03:03 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1693#issuecomment-6282343173) <img width="1601" height="901" alt="Screenshot_20261020_043338" src="https://github.com/user-attachments/assets/c0340c08-93dd-46b0-aa6e-37e3175b8869" />
Author
Owner

@⁠herrMirto on GitHub · 2026-10-20 06:57 UTC · original

@⁠herrMirto Hi! Can you explain the other commits you made and how you came up with those fixes? For me, the game goes into a match after the “Preserve reused selectors in S_SETPC dword jump tables” fix

Hi, I might have done my fork and my last pull on the wrong moment. But basically, the majority of the changes were related to not rendering the initial menu, where you can select "Kick off" and then the others one. The fixes were focused mostly on adjusting the shaders.

I will try again with the main branch and see how it goes!

**@⁠herrMirto** on GitHub · 2026-10-20 06:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1693#issuecomment-6285275355) > @⁠herrMirto Hi! Can you explain the other commits you made and how you came up with those fixes? For me, the game goes into a match after the “Preserve reused selectors in S_SETPC dword jump tables” fix Hi, I might have done my fork and my last pull on the wrong moment. But basically, the majority of the changes were related to not rendering the initial menu, where you can select "Kick off" and then the others one. The fixes were focused mostly on adjusting the shaders. I will try again with the main branch and see how it goes!
Author
Owner

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

@⁠herrMirto a note on the reduction part, so it doesn't get done twice: my open #1570 generalizes the same UMinReductionMatcher (302240da) and conflicts with this PR in six files. It covers UMax and bitwise OR as well (plus add, UMin, SMin, SMax, AND and XOR, and the row_xmask butterfly shape next to the row_shr scan), with 32 graphics cases.

One difference: this PR also rejects a match with a literal full EXEC when the seed select's fallback isn't the operation's neutral value; #1570 keeps main's behaviour there. If that check came from an FC27 shader, I'd like to look at it.

If you split the PR when you retry on main, the reduction part could rest on #1570, or the other way round, whichever @⁠Nmzik prefers.

**@⁠Nawid3333** on GitHub · 2026-10-20 16:17 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1693#issuecomment-6295597646) @⁠herrMirto a note on the reduction part, so it doesn't get done twice: my open #1570 generalizes the same `UMinReductionMatcher` (302240da) and conflicts with this PR in six files. It covers UMax and bitwise OR as well (plus add, UMin, SMin, SMax, AND and XOR, and the row_xmask butterfly shape next to the row_shr scan), with 32 graphics cases. One difference: this PR also rejects a match with a literal full EXEC when the seed select's fallback isn't the operation's neutral value; #1570 keeps main's behaviour there. If that check came from an FC27 shader, I'd like to look at it. If you split the PR when you retry on main, the reduction part could rest on #1570, or the other way round, whichever @⁠Nmzik prefers.
Author
Owner

@⁠Nmzik on GitHub · 2026-10-20 19:18 UTC · original

@⁠herrMirto I'm willing to accept your other changes if you can explain them (or at least tell me which mode/options you used and what graphical artifacts you noticed and where). For now, as far as I can see, your other changes arent necessary. Thanks for understanding!

**@⁠Nmzik** on GitHub · 2026-10-20 19:18 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1693#issuecomment-6299225042) @⁠herrMirto I'm willing to accept your other changes if you can explain them (or at least tell me which mode/options you used and what graphical artifacts you noticed and where). For now, as far as I can see, your other changes arent necessary. Thanks for understanding!
Author
Owner

@⁠Nmzik on GitHub · 2026-10-20 19:18 UTC · original

@⁠herrMirto Preserve reused selectors in S_SETPC dword jump tables. credited to you in main branch

**@⁠Nmzik** on GitHub · 2026-10-20 19:18 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1693#issuecomment-6299237989) @⁠herrMirto Preserve reused selectors in S_SETPC dword jump tables. credited to you in main branch
Author
Owner

@⁠herrMirto on GitHub · 2026-10-21 07:51 UTC · original

Hi everyone, sorry for the delay. My earlier explanation wasn't detailed enough.

I was testing the Kick Off mode on EA FC27 on SteamOS.
After selecting Kick Off and trying to enter the mode, the game would close. During the investigation I also encountered problems with the main menu rendering, the pre-match events and so on.

The changes accumulated while investigating those failures. With the combined changes, I eventually played a full match, but I can't claim that every remaining change is necessary.

Here is the reasoning behind the changes:

  • S_SETPC selector reuse: the shader translation rejected a jump-table pattern where the table load overwrites its selector register. After that fix, the previously failing shader completed SPIR-V emission. Thanks @⁠Nmzik for integrating it and crediting me.

  • UMax and OR reductions: I extended the existing UMin matcher to cover the equivalent maximum and OR sequences, avoiding dependence on endpoint lanes that may be absent during fragment execution. At that stage of the investigation, the branch progressed past the previously hanging pipelines and then encountered a separate mip-count validation error involving a 64×64 texture. (This was mainly happening after clicking on "Kick-Off", during the loading of the next menus)

  • Mip views: the change represents selected guest mip levels within Vulkan's limits while preserving their original memory offsets, array strides and mip-tail layout.(This was happening mainly before the rendering of the match or right after the teams were selected)

  • Texture-cache identity: this concerns cached texture images, rather than the shader cache. While reviewing the mip-view changes, I added a regression where two different extra mips become 1×1 host images. The cache considered them interchangeable despite their different physical layouts. That test failed before the fix and passed afterward, but I haven't demonstrated that this collision caused the Kick Off crash.

  • BDA handling: these changes reject invalid guest addresses before page-table lookup and initialize the page-table and fault storage before GPU use. They address memory-handling cases found during the investigation, but I haven't isolated their individual effect on FC27.

  • Compressed 3D textures: this adds a fallback when a driver supports sampled compressed volumes without extended usage. This also needs an isolated reproduction against current main before I can justify it as an FC27 requirement.

@⁠Nawid3333, thanks for pointing out the overlap with #1570. I'm fine with separating the reduction changes and using your broader implementation if that's preferred.

I am far from being a C++ developer, but I am curious enough to try to put some code together, test and compare between the attempts.

Let me know if you need more clarification.

**@⁠herrMirto** on GitHub · 2026-10-21 07:51 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1693#issuecomment-6310921574) Hi everyone, sorry for the delay. My earlier explanation wasn't detailed enough. I was testing the Kick Off mode on EA FC27 on SteamOS. After selecting Kick Off and trying to enter the mode, the game would close. During the investigation I also encountered problems with the main menu rendering, the pre-match events and so on. The changes accumulated while investigating those failures. With the combined changes, I eventually played a full match, but I can't claim that every remaining change is necessary. Here is the reasoning behind the changes: * S_SETPC selector reuse: the shader translation rejected a jump-table pattern where the table load overwrites its selector register. After that fix, the previously failing shader completed SPIR-V emission. Thanks @⁠Nmzik for integrating it and crediting me. * UMax and OR reductions: I extended the existing UMin matcher to cover the equivalent maximum and OR sequences, avoiding dependence on endpoint lanes that may be absent during fragment execution. At that stage of the investigation, the branch progressed past the previously hanging pipelines and then encountered a separate mip-count validation error involving a 64×64 texture. (This was mainly happening after clicking on "Kick-Off", during the loading of the next menus) * Mip views: the change represents selected guest mip levels within Vulkan's limits while preserving their original memory offsets, array strides and mip-tail layout.(This was happening mainly before the rendering of the match or right after the teams were selected) * Texture-cache identity: this concerns cached texture images, rather than the shader cache. While reviewing the mip-view changes, I added a regression where two different extra mips become 1×1 host images. The cache considered them interchangeable despite their different physical layouts. That test failed before the fix and passed afterward, but I haven't demonstrated that this collision caused the Kick Off crash. * BDA handling: these changes reject invalid guest addresses before page-table lookup and initialize the page-table and fault storage before GPU use. They address memory-handling cases found during the investigation, but I haven't isolated their individual effect on FC27. * Compressed 3D textures: this adds a fallback when a driver supports sampled compressed volumes without extended usage. This also needs an isolated reproduction against current main before I can justify it as an FC27 requirement. @⁠Nawid3333, thanks for pointing out the overlap with #1570. I'm fine with separating the reduction changes and using your broader implementation if that's preferred. I am far from being a C++ developer, but I am curious enough to try to put some code together, test and compare between the attempts. Let me know if you need more clarification.

Pull request closed

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