shader: mark unsupported scalar operands instead of aborting #1331

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

@⁠HamsterCL on GitHub · 2026-10-09 20:44 UTC · original
HamsterCL:fix/shader-decoder-unsupported-operands → main · +99 −64 · 8 files · 2 commits · closed without merging

Split out of #1313 (closed); F64 VOPC is already in main and not part of this PR.

  • DecodeScalarSource/DecodeScalarDestination take the Instruction and call SetUnsupported for reserved operand codes (e.g. trap temporaries) instead of EXIT-ing the emulator.
  • ResolveSetpc*JumpTable accepts the smallest valid setpc index.
  • Sendmsg is treated as having side effects so it is not removed as dead code.

Built and ran all 53 ctest tests locally (Windows, clang-cl).

**@⁠HamsterCL** on GitHub · 2026-10-09 20:44 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1331) `HamsterCL:fix/shader-decoder-unsupported-operands` → `main` · +99 −64 · 8 files · 2 commits · closed without merging Split out of #1313 (closed); F64 VOPC is already in main and not part of this PR. - `DecodeScalarSource`/`DecodeScalarDestination` take the `Instruction` and call `SetUnsupported` for reserved operand codes (e.g. trap temporaries) instead of `EXIT`-ing the emulator. - `ResolveSetpc*JumpTable` accepts the smallest valid setpc index. - `Sendmsg` is treated as having side effects so it is not removed as dead code. Built and ran all 53 ctest tests locally (Windows, clang-cl).
DecodeScalarSource/DecodeScalarDestination now take the Instruction and call
SetUnsupported for reserved operand codes (e.g. trap temporaries) instead of
EXIT-ing the emulator. ResolveSetpc*JumpTable accepts the smallest valid
setpc index, and Sendmsg is treated as having side effects so it is not
removed as dead code.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:53:25 +00:00
github-bot closed this pull request 2026-11-26 09:53:25 +00:00
Author
Owner

@⁠HamsterCL on GitHub · 2026-10-09 20:45 UTC · original

@⁠coderabbitai review

**@⁠HamsterCL** on GitHub · 2026-10-09 20:45 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1331#issuecomment-6088957137) @⁠coderabbitai review
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 20:49 UTC · original · edited 2026-10-10 02:38 UTC

Review in Change Stack →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: a76c4212-9c9a-4a51-9581-943730681c98


📥 Commits

Reviewing files that changed from the base of the PR and between df3043326bf5fa77c398963687a447deb037cd1b and 8660208c71.



📒 Files selected for processing (2)
  • src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h
  • src/graphics/shader/recompiler/frontend/decode/VectorAluOps.cpp


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




📝 Walkthrough
📝 Walkthrough

Walkthrough

Scalar operand decoders now receive the containing instruction and mark unsupported codes on that instruction instead of aborting. Image and memory decode paths also pass the program counter to scalar operand decoders. The jump-table recognizers accept lower minimum indices for their predecessor patterns. HasSideEffects now classifies Sendmsg as side-effecting.

Suggested reviewers: nmzik




Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 86602

Unsupported shader operands are reported with their instruction context, and Sendmsg is classified as side-effecting. No material merge risk is established.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 48.39% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check Passed The title clearly and concisely describes the primary change: marking unsupported scalar operands instead of aborting.
Description check Passed The description accurately summarizes the scalar operand handling, jump-table changes, Sendmsg side effects, and test results.


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

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

❤️ Share

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 20:49 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1331#issuecomment-6089012078) · edited 2026-10-10 02:38 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/1331?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3#gh-light-mode-only" alt="Review in Change Stack →" height="32"></a><a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1331?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3#gh-dark-mode-only" alt="Review in Change Stack →" height="32"></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> <dl> <dd> <details> <summary><strong>⚙️ Run configuration</strong></summary> <dl> <dd> <dl> <dd> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `a76c4212-9c9a-4a51-9581-943730681c98` <hr> </dd> </dl> <hr> </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> <dl> <dd> Reviewing files that changed from the base of the PR and between df3043326bf5fa77c398963687a447deb037cd1b and 8660208c7145697e4acccbfa238cc76a254c1e03. <hr> </dd> </dl> <hr> </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing (2)</strong></summary> <dl> <dd> <dl> <dd> * `src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h` * `src/graphics/shader/recompiler/frontend/decode/VectorAluOps.cpp` <hr> </dd> </dl> <hr> </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review. <hr> </dd> </dl> <hr> </dd> </dl> </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> <dl> <dd> ## Walkthrough Scalar operand decoders now receive the containing instruction and mark unsupported codes on that instruction instead of aborting. Image and memory decode paths also pass the program counter to scalar operand decoders. The jump-table recognizers accept lower minimum indices for their predecessor patterns. `HasSideEffects` now classifies `Sendmsg` as side-effecting. **Suggested reviewers:** `nmzik` <hr> </dd> </dl> <hr> </dd> </dl> </details> <hr> </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"8660208c7145697e4acccbfa238cc76a254c1e03" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **⚪ Minimal** · up to `86602` <!-- final_review_risk_coverage:{"sourceCommitId":"8660208c7145697e4acccbfa238cc76a254c1e03","coveredCommitId":"8660208c7145697e4acccbfa238cc76a254c1e03","kind":"reviewed"} --> Unsupported shader operands are reported with their instruction context, and Sendmsg is classified as side-effecting. No material merge risk is established. <!-- final_review_risk_end --> <!-- 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-v1.svg" width="14" height="17" 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-v1.svg" width="14" height="17" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary> <dl> <dd> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 48.39% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 8 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong>✅ Passed checks (4 passed)</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------- | | 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. | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely describes the primary change: marking unsupported scalar operands instead of aborting. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description accurately summarizes the scalar operand handling, jump-table changes, Sendmsg side effects, and test results. | <hr> </dd> </dl> </details> <hr> </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=1331)! 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) <hr> </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-09 20:49 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: ee406d6f-844e-47d4-b0a0-b86f629b7a85
📥 Commits

Reviewing files that changed from the base of the PR and between 59183dbfa8 and e8edd840dd3aaa99871d46b12536f9c3da61fa64.

📒 Files selected for processing (8)
  • src/graphics/shader/recompiler/frontend/cfg/ShaderCFG.cpp
  • src/graphics/shader/recompiler/frontend/decode/ImageOps.cpp
  • src/graphics/shader/recompiler/frontend/decode/MemoryOps.cpp
  • src/graphics/shader/recompiler/frontend/decode/ScalarAluOps.cpp
  • src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.cpp
  • src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h
  • src/graphics/shader/recompiler/frontend/decode/VectorAluOps.cpp
  • src/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 20:49 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1331#pullrequestreview-5475216578) · **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**: `ee406d6f-844e-47d4-b0a0-b86f629b7a85` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 59183dbfa81ed7efdff6069177fed50de0552725 and e8edd840dd3aaa99871d46b12536f9c3da61fa64. </details> <details> <summary>📒 Files selected for processing (8)</summary> * `src/graphics/shader/recompiler/frontend/cfg/ShaderCFG.cpp` * `src/graphics/shader/recompiler/frontend/decode/ImageOps.cpp` * `src/graphics/shader/recompiler/frontend/decode/MemoryOps.cpp` * `src/graphics/shader/recompiler/frontend/decode/ScalarAluOps.cpp` * `src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.cpp` * `src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h` * `src/graphics/shader/recompiler/frontend/decode/VectorAluOps.cpp` * `src/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=7efd7df7-c20b-41b6-bbda-9809924633d7 attempt=b963a841-296b-4a5e-a2c8-f765abfffac4 batch=1/1 -->
@ -269,0 +273,4 @@
// decoded. Mark the whole instruction unsupported right away: an
// Unknown operand left unchecked would otherwise reach a reader that
// aborts the emulator instead of degrading gracefully.
SetUnsupported(inst, inst.family, inst.opcode_id, "unsupported scalar source operand");
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 20:49 UTC · original · edited 2026-10-09 20:55 UTC

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Preserve graceful failure for an unsupported front-program S_SETPC_B64 source.

If a front program ends with S_SETPC_B64 and its source uses a reserved scalar code, SetUnsupported changes the opcode to UNSUPPORTED. DecodeFrontProgram then misses its S_SETPC_B64 break and can reach its fatal final check instead of reporting an unsupported shader. Handle the unsupported terminator in DecodeFrontProgram before that check.

✅ Addressed in commit df30433

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 20:49 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1331#discussion_r4234430359) · edited 2026-10-09 20:55 UTC **🩺 Stability & Availability** | **🟠 Major** | **⚡ Quick win** **Preserve graceful failure for an unsupported front-program `S_SETPC_B64` source.** If a front program ends with `S_SETPC_B64` and its source uses a reserved scalar code, `SetUnsupported` changes the opcode to `UNSUPPORTED`. `DecodeFrontProgram` then misses its `S_SETPC_B64` break and can reach its fatal final check instead of reporting an unsupported shader. Handle the unsupported terminator in `DecodeFrontProgram` before that check. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:ca29c5ce45f746a63eb7dcae --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit df30433
Author
Owner

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

⚠️ Action not completed

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

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

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

@⁠HamsterCL on GitHub · 2026-10-09 20:58 UTC · original

@⁠coderabbitai review

**@⁠HamsterCL** on GitHub · 2026-10-09 20:58 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1331#issuecomment-6089140823) @⁠coderabbitai review
Author
Owner

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

⚠️ Action not completed

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

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

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

@⁠HamsterCL on GitHub · 2026-10-10 02:30 UTC · original

Rebased onto current main. @⁠coderabbitai review

**@⁠HamsterCL** on GitHub · 2026-10-10 02:30 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1331#issuecomment-6092763257) Rebased onto current main. @⁠coderabbitai review
Author
Owner

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

@HamsterCL, I’ll request a review of the rebased changes.

⚠️ Action not completed

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

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-10 02:37 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1331#issuecomment-6092853293) <!-- This is an auto-generated reply by CodeRabbit --> <!-- CodeRabbit review command invocation: v2:530ba0b06c637c782d5e2bbc6846362ddb3f4fc56bd9be3ce982ac67b87c6ab7 --> `@HamsterCL`, I’ll request a review of the rebased changes. <details> <summary>⚠️ Action not completed</summary> Already reviewed the last commit. Use `@coderabbitai full review` to rerun a review of the entire changeset. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused. </details>

Pull request closed

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