shader: skip selection constructs whose condition is constant true #1566

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

@⁠Nawid3333 on GitHub · 2026-10-16 18:46 UTC · original
Nawid3333:shader/skip-constant-true-selections → main · +14 −0 · 2 files · 3 commits · closed without merging

Another one for nmzik's idea in #1534. EmitIfCondition and EmitValueOrDefaultIfCondition emitted a selection (OpSelectionMerge, OpBranchConditional, two labels, OpBranch, and OpPhi for a value) also when the condition is the constant true, as it is for memory accesses whose EXEC condition folds to true. With this change the body is emitted in the current block instead.

Size (compute suite at 3ff6606f, 680 modules)

before after
SPIR-V function-body instructions, all 680 suite modules 514,215 447,117 (-13%)
StoreBufferU32 / LoadBufferU32 per op 19.1 / 21.1 15.7 / 16.3
LoadSharedU32 / WriteSharedU32 per op 16.9 / 14.9 11.2 / 10.2

AMD's compiler already removes these branches: compiled with the driver (26.8.1), the ISA of 8 suite modules on an RX 9070 XT and 7 on a Ryzen 7600X iGPU is identical instruction for instruction (other vendors not tested). So this makes the SPIR-V smaller (e.g. 59,480 -> 46,940 bytes for DsIncReturnGdsBoundaries), not the GPU code faster.

Same results

  • At 3ff6606f on both GPUs: all 698 compute-suite entries, also with the harness forced to 32-wide subgroups (a local switch), and the 26 graphics cases plus 16 production raster checks give the same status and first mismatch as before.
  • The compute suite under the Khronos validation layer (RX 9070 XT): same results as before, no validation messages.
  • Fork CI (build and tests on Windows, Linux and macOS) passes.

If you'd like this done differently, tell me and I'll change it.

Written with Claude Code (AI): it wrote the change and ran the tests and measurements on my PC (driver 26.8.1, Windows 11). I reviewed the diff and this description before opening the PR.

🤖 Generated with Claude Code

**@⁠Nawid3333** on GitHub · 2026-10-16 18:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1566) `Nawid3333:shader/skip-constant-true-selections` → `main` · +14 −0 · 2 files · 3 commits · closed without merging Another one for nmzik's idea in #1534. `EmitIfCondition` and `EmitValueOrDefaultIfCondition` emitted a selection (`OpSelectionMerge`, `OpBranchConditional`, two labels, `OpBranch`, and `OpPhi` for a value) also when the condition is the constant true, as it is for memory accesses whose EXEC condition folds to true. With this change the body is emitted in the current block instead. **Size** (compute suite at 3ff6606f, 680 modules) | | before | after | |---|---|---| | SPIR-V function-body instructions, all 680 suite modules | 514,215 | 447,117 (-13%) | | StoreBufferU32 / LoadBufferU32 per op | 19.1 / 21.1 | 15.7 / 16.3 | | LoadSharedU32 / WriteSharedU32 per op | 16.9 / 14.9 | 11.2 / 10.2 | AMD's compiler already removes these branches: compiled with the driver (26.8.1), the ISA of 8 suite modules on an RX 9070 XT and 7 on a Ryzen 7600X iGPU is identical instruction for instruction (other vendors not tested). So this makes the SPIR-V smaller (e.g. 59,480 -> 46,940 bytes for `DsIncReturnGdsBoundaries`), not the GPU code faster. **Same results** - At 3ff6606f on both GPUs: all 698 compute-suite entries, also with the harness forced to 32-wide subgroups (a local switch), and the 26 graphics cases plus 16 production raster checks give the same status and first mismatch as before. - The compute suite under the Khronos validation layer (RX 9070 XT): same results as before, no validation messages. - Fork CI (build and tests on Windows, Linux and macOS) passes. If you'd like this done differently, tell me and I'll change it. Written with Claude Code (AI): it wrote the change and ran the tests and measurements on my PC (driver 26.8.1, Windows 11). I reviewed the diff and this description before opening the PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
EmitIfCondition and EmitValueOrDefaultIfCondition emitted a selection
(OpSelectionMerge, OpBranchConditional, two labels, OpBranch and, for a
value, OpPhi) also when the condition is the constant true, which is the
case for most memory accesses that are not predicated. Emit the body in
the current block instead.

The compute suite goes from 514,215 to 447,117 SPIR-V instructions (-13%);
e.g. StoreBufferU32 19.1 -> 15.7 and LoadBufferU32 21.1 -> 16.3 per op.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
TestNewShaderRecompilerBufferLoadsGuardedByExec expected the first branch before the bounds
check to be the EXEC guard. Its load is unpredicated, so the guard condition is the constant true
and the selection is no longer emitted. Write EXEC with v_cmpx first so the load has a real guard
and the test still checks that the bounds check sits inside it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The untouched v3 and v2 start as 0, so v_cmpx_gt_u32 v3, v2 gave a constant false EXEC. Set v3 to
the lane index with v_mbcnt_lo_u32_b32 first, and check that the guard condition is not a
constant (the check fails without the v_mbcnt).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:59:49 +00:00
github-bot closed this pull request 2026-11-26 09:59:49 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-16 18:51 UTC · original · edited 2026-10-17 12:51 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: f6eac878-ac71-4255-b60d-74b0fc1072f0
📥 Commits

Reviewing files that changed from the base of the PR and between d785298dd6 and b6491be831.

📒 Files selected for processing: 1
  • tests/shaderCfgTests.cpp
🚧 Files skipped from review as they are similar to previous changes: 1
  • tests/shaderCfgTests.cpp

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

📝 Walkthrough

EmitIfCondition and EmitValueOrDefaultIfCondition invoke their callbacks directly when the condition equals constant true. Other conditions retain their existing conditional branch paths. The shader test sets a lane-dependent EXEC mask before a buffer load and checks that the emitted guard condition is neither constant true nor constant false.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Refactor

Merge Risk: ⚪ Minimal · up to b6491

The condition-handling change and its guarded-load test have no identified issue that needs resolution before merge.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: skipping selection constructs when the condition is constant true.
Description check Passed The description directly explains the implementation, motivation, measured SPIR-V reduction, validation results, and test coverage.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 too large.)

  • 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-16 18:51 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1566#issuecomment-6222490823) · edited 2026-10-17 12:51 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/1566?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**: `f6eac878-ac71-4255-b60d-74b0fc1072f0` </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between d785298dd64e083da0d801436d8a27540f5ff91c and b6491be83158866b8ac525755b2a803301c69792. </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing: 1</strong></summary> <dl> <dd> * `tests/shaderCfgTests.cpp` </dd> </dl> </details> <details> <summary><strong>🚧 Files skipped from review as they are similar to previous changes: 1</strong></summary> <dl> <dd> * tests/shaderCfgTests.cpp </dd> </dl> </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. </dd> </dl> </details> <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> `EmitIfCondition` and `EmitValueOrDefaultIfCondition` invoke their callbacks directly when the condition equals constant `true`. Other conditions retain their existing conditional branch paths. The shader test sets a lane-dependent EXEC mask before a buffer load and checks that the emitted guard condition is neither constant `true` nor constant `false`. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"b6491be83158866b8ac525755b2a803301c69792" --> **Change:** Refactor <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>⚪ Minimal</strong> · up to <code>b6491</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `b6491` --> <!-- final_review_risk_coverage:{"sourceCommitId":"b6491be83158866b8ac525755b2a803301c69792","coveredCommitId":"b6491be83158866b8ac525755b2a803301c69792","kind":"reviewed"} --> The condition-handling change and its guarded-load test have no identified issue that needs resolution before merge. <!-- 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> 5</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 describes the main change: skipping selection constructs when the condition is constant true. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description directly explains the implementation, motivation, measured SPIR-V reduction, validation results, and test coverage. | | Docstring Coverage | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1… | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **Explanation** No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 too large.) </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=1566)! 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-17 12:40 UTC · original · edited 2026-10-17 12:52 UTC
On tests/shaderCfgTests.cpp line 10450 (outdated):

@@ -10447,6 +10447,7 @@ void TestComputeDispatchWaveSize() {
 
 void TestNewShaderRecompilerBufferLoadsGuardedByExec() {
   const uint32_t shader[] = {
+      EncodeVopc(0xd4, 3 + 256, 2), // v_cmpx_gt_u32 v3, v2: EXEC is not constant

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect how the compiler seeds VGPRs at shader entry.
rg -n -C 4 'Initial.*Register|initial.*register|ZeroInitialRegister|GetVectorRegister|SetVectorRegister' --glob '*.{cpp,h}'

Repository: KytyPS5/KytyPS5

Length of output: 11253


🏁 Script executed:

set -euo pipefail
printf '%s\n' '--- comparison test ---'
nl -ba tests/shaderCfgTests.cpp | sed -n '10420,10475p'
printf '%s\n' '--- zero-initialization test ---'
nl -ba tests/shaderCfgTests.cpp | sed -n '13220,13250p'
printf '%s\n' '--- test registration and nearby setup ---'
nl -ba tests/shaderCfgTests.cpp | sed -n '16355,16385p'
printf '%s\n' '--- SSA register read/write handling ---'
nl -ba src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp | sed -n '270,340p'

Repository: KytyPS5/KytyPS5

Length of output: 9595


🏁 Script executed:

set -euo pipefail
printf '%s\n' '--- SSA pass initialization ---'
nl -ba src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp | sed -n '1,130p'
printf '%s\n' '--- complete guarded-load test ---'
nl -ba tests/shaderCfgTests.cpp | sed -n '10448,10515p'
printf '%s\n' '--- initial-state declarations and callers ---'
rg -n -F --glob '*.{cpp,h}' -e 'SsaRewrite' -e 'ZeroInitialRegisterState' -e 'initial_value' src tests

Repository: KytyPS5/KytyPS5

Length of output: 10700


🏁 Script executed:

set -euo pipefail
nl -ba src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp | sed -n '120,190p'
nl -ba src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp | sed -n '340,430p'
nl -ba src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp | tail -n 80

Repository: KytyPS5/KytyPS5

Length of output: 7026


🏁 Script executed:

set -euo pipefail
nl -ba src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp | sed -n '124,155p'

Repository: KytyPS5/KytyPS5

Length of output: 937


Use a runtime-dependent VGPR comparison.

v3 and v2 are untouched before v_cmpx_gt_u32 v3, v2. The SSA pass initializes an untouched VectorReg to zero, so this comparison is constant false. The test does not exercise a runtime-dependent EXEC mask.

Use a runtime-dependent VGPR value and assert that the EXEC branch condition is nonconstant.

✅ Addressed in commit b6491be

**@⁠coderabbitai[bot]** on GitHub · 2026-10-17 12:40 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1566#discussion_r4302687072) · edited 2026-10-17 12:52 UTC On `tests/shaderCfgTests.cpp` line 10450 (outdated): ```diff @@ -10447,6 +10447,7 @@ void TestComputeDispatchWaveSize() { void TestNewShaderRecompilerBufferLoadsGuardedByExec() { const uint32_t shader[] = { + EncodeVopc(0xd4, 3 + 256, 2), // v_cmpx_gt_u32 v3, v2: EXEC is not constant ``` **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash set -euo pipefail # Inspect how the compiler seeds VGPRs at shader entry. rg -n -C 4 'Initial.*Register|initial.*register|ZeroInitialRegister|GetVectorRegister|SetVectorRegister' --glob '*.{cpp,h}' ``` Repository: KytyPS5/KytyPS5 Length of output: 11253 --- 🏁 Script executed: ```bash set -euo pipefail printf '%s\n' '--- comparison test ---' nl -ba tests/shaderCfgTests.cpp | sed -n '10420,10475p' printf '%s\n' '--- zero-initialization test ---' nl -ba tests/shaderCfgTests.cpp | sed -n '13220,13250p' printf '%s\n' '--- test registration and nearby setup ---' nl -ba tests/shaderCfgTests.cpp | sed -n '16355,16385p' printf '%s\n' '--- SSA register read/write handling ---' nl -ba src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp | sed -n '270,340p' ``` Repository: KytyPS5/KytyPS5 Length of output: 9595 --- 🏁 Script executed: ```bash set -euo pipefail printf '%s\n' '--- SSA pass initialization ---' nl -ba src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp | sed -n '1,130p' printf '%s\n' '--- complete guarded-load test ---' nl -ba tests/shaderCfgTests.cpp | sed -n '10448,10515p' printf '%s\n' '--- initial-state declarations and callers ---' rg -n -F --glob '*.{cpp,h}' -e 'SsaRewrite' -e 'ZeroInitialRegisterState' -e 'initial_value' src tests ``` Repository: KytyPS5/KytyPS5 Length of output: 10700 --- 🏁 Script executed: ```bash set -euo pipefail nl -ba src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp | sed -n '120,190p' nl -ba src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp | sed -n '340,430p' nl -ba src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp | tail -n 80 ``` Repository: KytyPS5/KytyPS5 Length of output: 7026 --- 🏁 Script executed: ```bash set -euo pipefail nl -ba src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp | sed -n '124,155p' ``` Repository: KytyPS5/KytyPS5 Length of output: 937 --- </details> **Use a runtime-dependent VGPR comparison.** `v3` and `v2` are untouched before `v_cmpx_gt_u32 v3, v2`. The SSA pass initializes an untouched `VectorReg` to zero, so this comparison is constant false. The test does not exercise a runtime-dependent EXEC mask. Use a runtime-dependent VGPR value and assert that the EXEC branch condition is nonconstant. <!-- fingerprinting:phantom:triton:serval --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:31a82cf0d984a5a6d452c2b3 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commit b6491be
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-17 12:40 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: 4a24e7e5-14be-4e82-aa8b-1906c28402d6
📥 Commits

Reviewing files that changed from the base of the PR and between c92b067e66 and d785298dd6.

📒 Files selected for processing: 1
  • 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-17 12:40 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1566#pullrequestreview-5557794311) · **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**: `4a24e7e5-14be-4e82-aa8b-1906c28402d6` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between c92b067e669b400c966d48ddbd4b6dd8da260987 and d785298dd64e083da0d801436d8a27540f5ff91c. </details> <details> <summary>📒 Files selected for processing: 1</summary> * `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=609d5a8d-1853-4b31-8572-4d60e07d46e8 attempt=ac98d2d1-7b26-4b3b-892b-f7f8dde1c89c batch=1/1 -->
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-17 12:43 UTC · original
On tests/shaderCfgTests.cpp line 10450 (outdated):

@@ -10447,6 +10447,7 @@ void TestComputeDispatchWaveSize() {
 
 void TestNewShaderRecompilerBufferLoadsGuardedByExec() {
   const uint32_t shader[] = {
+      EncodeVopc(0xd4, 3 + 256, 2), // v_cmpx_gt_u32 v3, v2: EXEC is not constant

Right, both start as 0, so EXEC was a constant false. Fixed in b6491be8: v3 is now the lane index (v_mbcnt_lo_u32_b32 v3, -1, v2), and the test checks that the guard condition is not a constant. That check fails without the v_mbcnt.

**@⁠Nawid3333** on GitHub · 2026-10-17 12:43 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1566#discussion_r4302695053) On `tests/shaderCfgTests.cpp` line 10450 (outdated): ```diff @@ -10447,6 +10447,7 @@ void TestComputeDispatchWaveSize() { void TestNewShaderRecompilerBufferLoadsGuardedByExec() { const uint32_t shader[] = { + EncodeVopc(0xd4, 3 + 256, 2), // v_cmpx_gt_u32 v3, v2: EXEC is not constant ``` Right, both start as 0, so EXEC was a constant false. Fixed in b6491be8: v3 is now the lane index (`v_mbcnt_lo_u32_b32 v3, -1, v2`), and the test checks that the guard condition is not a constant. That check fails without the `v_mbcnt`.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-17 12:52 UTC · original
On tests/shaderCfgTests.cpp line 10450 (outdated):

@@ -10447,6 +10447,7 @@ void TestComputeDispatchWaveSize() {
 
 void TestNewShaderRecompilerBufferLoadsGuardedByExec() {
   const uint32_t shader[] = {
+      EncodeVopc(0xd4, 3 + 256, 2), // v_cmpx_gt_u32 v3, v2: EXEC is not constant

@⁠Nawid3333 Thanks for the fix. The supplied code now makes the EXEC condition lane-dependent and checks that the guard condition is nonconstant. This addresses the finding.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-17 12:52 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1566#discussion_r4302719469) On `tests/shaderCfgTests.cpp` line 10450 (outdated): ```diff @@ -10447,6 +10447,7 @@ void TestComputeDispatchWaveSize() { void TestNewShaderRecompilerBufferLoadsGuardedByExec() { const uint32_t shader[] = { + EncodeVopc(0xd4, 3 + 256, 2), // v_cmpx_gt_u32 v3, v2: EXEC is not constant ``` @⁠Nawid3333 Thanks for the fix. The supplied code now makes the EXEC condition lane-dependent and checks that the guard condition is nonconstant. This addresses the finding. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Untouched%20VGPRs%20were%20zero%2C%20making%20the%20EXEC%20comparison%20constant%20false.%20%40coderabbitai%20caught%20it%3A%20seed%20%60v3%60%20with%20lane%20indices%20and%20assert%20a%20nonconstant%20guard.%20Try%20it%20for%20sharper%20code%20reviews!%20%F0%9F%90%87&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1566%23discussion_r4302687072)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-24 18:36 UTC · original

Closing: main has this since 0f7d1125 ("emit constant-true guarded blocks inline and fold immediate constant-buffer indices"), which adds the same constant-true early returns.

**@⁠Nawid3333** on GitHub · 2026-10-24 18:36 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1566#issuecomment-6388015887) Closing: `main` has this since 0f7d1125 ("emit constant-true guarded blocks inline and fold immediate constant-buffer indices"), which adds the same constant-true early returns.

Pull request closed

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