shader: decode S_CLAUSE as a no-op hint #2032

Manually merged
github merged 1 commit from gh-pr/2032/head into gh-pr/2032/base 2026-11-26 10:12:19 +00:00
Owner

@⁠MrBigBritches on GitHub · 2026-10-31 20:28 UTC · original
MrBigBritches:shader-s-clause → main · +5 −1 · 4 files · 1 commits · merged 2026-10-31 22:30 UTC

Summary

The decoder marked S_CLAUSE (SOPP 0x21) unsupported, so any shader containing it failed to build its CFG. S_CLAUSE only asks the hardware to issue the following memory instructions together. It changes no registers, memory or observable ordering, because s_waitcnt still orders them.

  • It now decodes as a one-word SOPP instruction with its immediate.
  • The translator emits nothing for it, the same as S_INST_PREFETCH.
  • The opcode number comes from LLVM's gfx10 SOPP table.

Tests

  • TestSoppClauseHint in shader_cfg compares a program with and without an S_CLAUSE word (0xbfa10001) at five levels:
    • the decode
    • the CFG
    • the translator's operation count before optimisation
    • the final IR
    • the SPIR-V

Note

This touches the same spots as the V_SWAP_B32 PR (a new test after TestNggVertexEntryState in shaderCfgTests.cpp and its call in main()). Whichever lands second needs a trivial rebase that keeps both sides.

**@⁠MrBigBritches** on GitHub · 2026-10-31 20:28 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2032) `MrBigBritches:shader-s-clause` → `main` · +5 −1 · 4 files · 1 commits · merged 2026-10-31 22:30 UTC ## Summary The decoder marked `S_CLAUSE` (SOPP 0x21) unsupported, so any shader containing it failed to build its CFG. `S_CLAUSE` only asks the hardware to issue the following memory instructions together. It changes no registers, memory or observable ordering, because `s_waitcnt` still orders them. - It now decodes as a one-word SOPP instruction with its immediate. - The translator emits nothing for it, the same as `S_INST_PREFETCH`. - The opcode number comes from LLVM's gfx10 SOPP table. ## Tests - `TestSoppClauseHint` in `shader_cfg` compares a program with and without an `S_CLAUSE` word (`0xbfa10001`) at five levels: - the decode - the CFG - the translator's operation count before optimisation - the final IR - the SPIR-V ## Note This touches the same spots as the V_SWAP_B32 PR (a new test after `TestNggVertexEntryState` in `shaderCfgTests.cpp` and its call in `main()`). Whichever lands second needs a trivial rebase that keeps both sides.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:12:17 +00:00
github manually merged commit d2601fe075 into gh-pr/2032/base 2026-11-26 10:12:19 +00:00
Author
Owner

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

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between bbf96a5e9f and 6efb7c4c13739453e884e0e4d5e19d03e95db093.

Files selected for processing: 6
  • 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/translate/Scalar.cpp
  • tests/ShaderRecompilerComputeTests.cpp
  • tests/shaderCfgTests.cpp

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

Walkthrough

The decoder now recognizes SOPP opcode 0x21 as S_CLAUSE and decodes its immediate operand. Instruction formatting includes the opcode and operand. Scalar translation handles S_CLAUSE without emitting IR operations. Regression tests check decoding, CFG behavior, translated IR, and emitted SPIR-V against a shader without the hint.

Suggested reviewers: nmzik

Change: Bug fix

Merge Risk: Minimal · up to 6efb7

The change accepts S_CLAUSE as a hint without emitting shader operations. No merge-blocking issue is identified; run the normal checks before merging.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… 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 identifies decoding S_CLAUSE as a no-op hint, which matches the main change.
Description check Passed The description directly explains the S_CLAUSE decoding, translation behavior, rationale, and tests included in 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 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 4 files. (2 skipped: 2 too large.)

Resolution

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

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
**@⁠coderabbitai[bot]** on GitHub · 2026-10-31 20:35 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2032#issuecomment-6548807501) <!-- 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/2032?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><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="16" height="16" align="absmiddle" alt=""></picture> Recent review info</strong></summary> <dl> <dd> <!-- review_info_content --> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary> <dl> <dd> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/bbf96a5e9f69cad84b99791d6418c81d01913e75/.coderabbit.yaml>) - **Commit**: [bbf96a5](<https://github.com/KytyPS5/KytyPS5/commit/bbf96a5e9f69cad84b99791d6418c81d01913e75>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `5dac5573-244c-44dc-8862-1bef0b5b4f51` </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between bbf96a5e9f69cad84b99791d6418c81d01913e75 and 6efb7c4c13739453e884e0e4d5e19d03e95db093. </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 6</strong></summary> <dl> <dd> * `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/translate/Scalar.cpp` * `tests/ShaderRecompilerComputeTests.cpp` * `tests/shaderCfgTests.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. </dd> </dl> </details> <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> The decoder now recognizes SOPP opcode `0x21` as `S_CLAUSE` and decodes its immediate operand. Instruction formatting includes the opcode and operand. Scalar translation handles `S_CLAUSE` without emitting IR operations. Regression tests check decoding, CFG behavior, translated IR, and emitted SPIR-V against a shader without the hint. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"6efb7c4c13739453e884e0e4d5e19d03e95db093" --> <!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>6efb7</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `6efb7` --> <!-- final_review_risk_coverage:{"sourceCommitId":"6efb7c4c13739453e884e0e4d5e19d03e95db093","coveredCommitId":"6efb7c4c13739453e884e0e4d5e19d03e95db093","kind":"reviewed"} --> The change accepts S_CLAUSE as a hint without emitting shader operations. No merge-blocking issue is identified; run the normal checks before merging. <!-- 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 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… | 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 identifies decoding S_CLAUSE as a no-op hint, which matches the main change. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description directly explains the S_CLAUSE decoding, translation behavior, rationale, and tests included in 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 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 4 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 --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2032)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>Share</strong></summary> <dl> <dd> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <!-- tips_end -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.