Keep wave32 votes and reductions inside the caller's half #2136

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

@⁠theantipopau on GitHub · 2026-11-06 09:31 UTC · original
theantipopau:fix/wave32-vote-reduce → main · +165 −19 · 7 files · 2 commits · closed without merging

Summary

A wave32 guest wave occupies one half of a 64-lane native subgroup, but its votes and reductions were subgroup-wide, so the wave sharing that subgroup contributed its own EXEC and values.

  • Votes (s_cbranch_execz/vccz/sccz/nz) now compare the caller's ballot word; All tests that word against its own active lanes.
  • OpGroupNonUniformUMin/UMax/BitwiseOr lower to a five-step OpGroupNonUniformShuffleXor butterfly over the five lane bits of the caller's half instead of a subgroup-wide reduction, so the wave never reads the other half.
  • Wave64 waves, 32-lane host subgroups, and the emulated wave64-on-32 path keep their existing lowering.
  • The wide path no longer appends the subgroup-wide reduction after the butterfly.

Tests

  • shader_recompiler_compute_tests: 997/997, including the new VectorBranchVoteStaysInsideWave32 (wave0 takes the branch, wave1 does not) and the updated ScalarBranchRestoresInactiveWave32, which now requires the ballot-word vote and forbids OpGroupNonUniformAny.
  • shader_cfg_tests: new TestSpirvWave32HalfReductions requires 15 OpGroupNonUniformShuffleXor and no subgroup-wide arithmetic on a 64-lane host, and keeps one native op per reduction on a 32-lane host.
  • ctest in _Build/windows: 82/82. kyty_emulator builds.
**@⁠theantipopau** on GitHub · 2026-11-06 09:31 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2136) `theantipopau:fix/wave32-vote-reduce` → `main` · +165 −19 · 7 files · 2 commits · closed without merging ## Summary A wave32 guest wave occupies one half of a 64-lane native subgroup, but its votes and reductions were subgroup-wide, so the wave sharing that subgroup contributed its own EXEC and values. - Votes (`s_cbranch_execz/vccz/sccz/nz`) now compare the caller's ballot word; `All` tests that word against its own active lanes. - `OpGroupNonUniformUMin/UMax/BitwiseOr` lower to a five-step `OpGroupNonUniformShuffleXor` butterfly over the five lane bits of the caller's half instead of a subgroup-wide reduction, so the wave never reads the other half. - Wave64 waves, 32-lane host subgroups, and the emulated wave64-on-32 path keep their existing lowering. - The wide path no longer appends the subgroup-wide reduction after the butterfly. ## Tests - `shader_recompiler_compute_tests`: 997/997, including the new `VectorBranchVoteStaysInsideWave32` (wave0 takes the branch, wave1 does not) and the updated `ScalarBranchRestoresInactiveWave32`, which now requires the ballot-word vote and forbids `OpGroupNonUniformAny`. - `shader_cfg_tests`: new `TestSpirvWave32HalfReductions` requires 15 `OpGroupNonUniformShuffleXor` and no subgroup-wide arithmetic on a 64-lane host, and keeps one native op per reduction on a 32-lane host. - `ctest` in `_Build/windows`: 82/82. `kyty_emulator` builds.
A wave32 guest wave occupies one half of a 64-lane native subgroup, so
subgroup-wide Any/All and UMin/UMax/BitwiseOr also saw the neighbouring
wave's EXEC and values. Votes now compare the caller's ballot word (All
against that word's active lanes), and reductions lower to a five-step
shuffle-xor butterfly over the half's lane bits. Wave64 waves and 32-lane
host subgroups keep their existing paths.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <[email protected]>
The wave32 vote cases asserted the ballot-word lowering even when the harness compiles at the device's own subgroup size, so a 32-lane host was required to emit the opcode it must not. Split the contract into plain and wide lists chosen from the compiled host size, and cover both ConditionRef lowerings in the CPU vote test.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:15:45 +00:00
github-bot closed this pull request 2026-11-26 10:15:45 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-06 09:41 UTC · original · edited 2026-11-06 22:05 UTC

Explain Change →

Walkthrough

The SPIR-V emitter now distinguishes wave32 execution on a host subgroup of a different size. In that configuration, it limits vote evaluation and subgroup reductions to the caller’s half. Other configurations retain their existing paths. Tests check generated SPIR-V expectations for wide-host and native subgroup handling.

Suggested reviewers: nmzik

Change: Bug fix

Merge Risk: Moderate · up to 4120f

Wave32 reductions on 64-lane hosts may produce undefined results when the host subgroup is only partly populated. Resolve or explicitly accept that risk before merging. The new tests also do not check ballot-word selection or shuffle masks, so they would miss some future regressions.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 50.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. Documenta… 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 describes the wave32 vote and reduction changes.
Description check Passed The description matches the wave32 vote and reduction changes and related tests.
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 50.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 6 functions across 5 files. (2 skipped: 2 too large.)

Resolution

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

Warning

Some tools did not complete. Review the errors below.

Cppcheck (2.22.0)

tests/shaderCfgTests.cpp

Cppcheck timed out; analysis of this file is incomplete

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-11-06 09:41 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2136#issuecomment-6681881426) · edited 2026-11-06 22:05 UTC <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/2136?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-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> <br> The SPIR-V emitter now distinguishes wave32 execution on a host subgroup of a different size. In that configuration, it limits vote evaluation and subgroup reductions to the caller’s half. Other configurations retain their existing paths. Tests check generated SPIR-V expectations for wide-host and native subgroup handling. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"4120ffc001f3f9eeac81f693cf6be377ce0a0916" --> <!-- 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-normal-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Moderate</strong> · up to <code>4120f</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🟡 Moderate** · up to `4120f` --> <!-- final_review_risk_coverage:{"sourceCommitId":"4120ffc001f3f9eeac81f693cf6be377ce0a0916","coveredCommitId":"4120ffc001f3f9eeac81f693cf6be377ce0a0916","kind":"reviewed"} --> Wave32 reductions on 64-lane hosts may produce undefined results when the host subgroup is only partly populated. Resolve or explicitly accept that risk before merging. The new tests also do not check ballot-word selection or shuffle masks, so they would miss some future regressions. <!-- 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> <br> <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 50.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. Documenta… | 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> <br> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly describes the wave32 vote and reduction changes. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description matches the wave32 vote and reduction changes and related tests. | | 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> <br> **Explanation** Docstring coverage is 50.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 6 functions across 5 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 --> <!-- operational_warnings_start --> <!-- This is an auto-generated comment: all tool run failures by coderabbit.ai --> > [!WARNING] > Some tools did not complete. Review the errors below. > > <details> > <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/wrench-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/wrench.svg" width="16" height="16" align="absmiddle" alt=""></picture> Cppcheck (2.22.0)</strong></summary> > <dl> > <dd> > <br> > > <details> > <summary><strong>tests/shaderCfgTests.cpp</strong></summary> > <dl> > <dd> > <br> > > Cppcheck timed out; analysis of this file is incomplete > > </dd> > </dl> > </details> > > </dd> > </dl> > </details> <!-- end of auto-generated comment: all tool run failures by coderabbit.ai --> <!-- operational_warnings_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2136)! 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> <br> - [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 -->
@ -822,0 +829,4 @@
}
const auto active = ctx.HalfBallotWord(ctx.Ballot(IR::Value(true)));
const auto yes = EmitBinaryU32(ctx.state, spv::OpBitwiseAnd, word, active);
return EmitNative<spv::OpIEqual, IR::Type::U1>(ctx.state, yes, active);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-06 09:41 UTC · original

Major · Functional Correctness · Heavy lift

Supported by static analysis

Script executed:

#!/bin/bash
# Check where host_subgroup_size is set and how wave32 workgroups are laid out.
rg -n -C3 'host_subgroup_size' --type=cpp --type=h

Repository: KytyPS5/KytyPS5

Length of output: 21840


Script executed:

#!/bin/bash
rg -n -F -e 'HalfBallotWord' -e 'SubgroupLocalInvocationId' -e 'SubgroupLocalInvocationID' -e 'LocalInvocationIndex' -e 'SubgroupId' -e 'SubgroupID' -- src/graphics/shader/recompiler/backend/spirv src/graphics/shader/recompiler/frontend
rg -n -F -e 'DefineModule(' -e 'lane_count' -e 'LocalSize' -- src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp
rg -n -F -e 'requiredSubgroupSize' -e 'REQUIRE_FULL_SUBGROUPS' -e 'RequireFullSubgroups' -e 'SupportsComputeWave64' -e 'subgroup_size' -- src/graphics/host_gpu/renderer/pipeline src/graphics/host_gpu/graphics
git diff b6cc1fff27c8ee68c14f6eb99d719922335e1358 fc907239637c09f791939334e065d008fe05b964 -- src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp

Repository: KytyPS5/KytyPS5

Length of output: 9793


Script executed:

#!/bin/bash
for spec in \
 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp:485:540' \
 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp:1:55' \
 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp:710:750' \
 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp:795:845' \
 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterHelpers.cpp:45:120' \
 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp:850:888' \
 'src/graphics/host_gpu/renderer/pipeline/shaders.cpp:335:390' \
 'src/graphics/shader/recompiler/frontend/translate/Translate.cpp:1105:1145' \
 'src/graphics/shader/recompiler/frontend/translate/Translate.cpp:1160:1225'; do
  IFS=: read -r file start end <<< "$spec"
  echo "----- $file:$start-$end -----"
  nl -ba "$file" | sed -n "${start},${end}p"
done
rg -n -F -e 'SupportsComputeWave64' -e 'compute_subgroup_size_control_enabled' -e 'subgroup_size =' -e 'SubgroupLocalInvocationId' -- src/graphics/host_gpu src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp

Repository: KytyPS5/KytyPS5

Length of output: 29273


Web query:

Vulkan specification compute shader SubgroupLocalInvocationId LocalInvocationIndex mapping implementation dependent subgroup invocation order guarantee

Result:

Sources consulted:
- Shader Interfaces :: Vulkan Documentation Project — https://docs.vulkan.org/spec/latest/chapters/interfaces.html
- Vulkan® 1.4.351 - A Specification (with all ratified extensions) — https://registry.khronos.org/vulkan/specs/latest-ratified/pdf/vkspec.pdf
- Vulkan® 1.4.349 - A Specification (with all registered extensions) — https://registry.khronos.org/vulkan/specs/latest/pdf/vkspec.pdf
- Vulkan® SC 1.0.21 - A Specification (with all ratified Vulkan SC extensions) : Based on Vulkan 1.2.344 — https://registry.khronos.org/VulkanSC/specs/latest-ratified/pdf/vkspec.pdf
- SubgroupLocalInvocationId(3) — https://registry.khronos.org/VulkanSC/specs/1.0-extensions/man/html/SubgroupLocalInvocationId.html
- …and 25 more

Script executed:

#!/bin/bash
for spec in \
 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp:455:496' \
 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp:560:590' \
 'src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp:20:48' \
 'src/graphics/host_gpu/graphicContext.h:90:102' \
 'src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp:865:880'; do
  IFS=: read -r file start end <<< "$spec"
  echo "----- $file:$start-$end -----"
  nl -ba "$file" | sed -n "${start},${end}p"
done
rg -n -F -e 'VectorBranchVoteStaysInsideWave32' -e 'ScalarBranchRestoresInactiveWave32' -- tests/ShaderRecompilerComputeTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 7686


Keep the vote within the guest wave.

On a 64-lane subgroup, Vulkan can assign local invocation indices to subgroup lanes in a different order. In that case, the selected ballot word can contain lanes from different guest waves and omit lanes from the caller’s wave. The vote can then produce an incorrect branch decision.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-06 09:41 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2136#discussion_r4491051281) <!-- coderabbit-ai-generated:v1 --> **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/major-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Major** · **Functional Correctness** · **Heavy lift** <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/review-details-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/review-details.svg" width="16" height="16" align="absmiddle" alt=""></picture> Supported by static analysis</summary> <dl> <dd> <br> Script executed: ```bash #!/bin/bash # Check where host_subgroup_size is set and how wave32 workgroups are laid out. rg -n -C3 'host_subgroup_size' --type=cpp --type=h ``` Repository: KytyPS5/KytyPS5 Length of output: 21840 --- Script executed: ```bash #!/bin/bash rg -n -F -e 'HalfBallotWord' -e 'SubgroupLocalInvocationId' -e 'SubgroupLocalInvocationID' -e 'LocalInvocationIndex' -e 'SubgroupId' -e 'SubgroupID' -- src/graphics/shader/recompiler/backend/spirv src/graphics/shader/recompiler/frontend rg -n -F -e 'DefineModule(' -e 'lane_count' -e 'LocalSize' -- src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp rg -n -F -e 'requiredSubgroupSize' -e 'REQUIRE_FULL_SUBGROUPS' -e 'RequireFullSubgroups' -e 'SupportsComputeWave64' -e 'subgroup_size' -- src/graphics/host_gpu/renderer/pipeline src/graphics/host_gpu/graphics git diff b6cc1fff27c8ee68c14f6eb99d719922335e1358 fc907239637c09f791939334e065d008fe05b964 -- src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 9793 --- Script executed: ```bash #!/bin/bash for spec in \ 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp:485:540' \ 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp:1:55' \ 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp:710:750' \ 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp:795:845' \ 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterHelpers.cpp:45:120' \ 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp:850:888' \ 'src/graphics/host_gpu/renderer/pipeline/shaders.cpp:335:390' \ 'src/graphics/shader/recompiler/frontend/translate/Translate.cpp:1105:1145' \ 'src/graphics/shader/recompiler/frontend/translate/Translate.cpp:1160:1225'; do IFS=: read -r file start end <<< "$spec" echo "----- $file:$start-$end -----" nl -ba "$file" | sed -n "${start},${end}p" done rg -n -F -e 'SupportsComputeWave64' -e 'compute_subgroup_size_control_enabled' -e 'subgroup_size =' -e 'SubgroupLocalInvocationId' -- src/graphics/host_gpu src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 29273 --- Web query: `Vulkan specification compute shader SubgroupLocalInvocationId LocalInvocationIndex mapping implementation dependent subgroup invocation order guarantee` Result: ``` Sources consulted: - Shader Interfaces :: Vulkan Documentation Project — https://docs.vulkan.org/spec/latest/chapters/interfaces.html - Vulkan® 1.4.351 - A Specification (with all ratified extensions) — https://registry.khronos.org/vulkan/specs/latest-ratified/pdf/vkspec.pdf - Vulkan® 1.4.349 - A Specification (with all registered extensions) — https://registry.khronos.org/vulkan/specs/latest/pdf/vkspec.pdf - Vulkan® SC 1.0.21 - A Specification (with all ratified Vulkan SC extensions) : Based on Vulkan 1.2.344 — https://registry.khronos.org/VulkanSC/specs/latest-ratified/pdf/vkspec.pdf - SubgroupLocalInvocationId(3) — https://registry.khronos.org/VulkanSC/specs/1.0-extensions/man/html/SubgroupLocalInvocationId.html - …and 25 more ``` --- Script executed: ```bash #!/bin/bash for spec in \ 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp:455:496' \ 'src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp:560:590' \ 'src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp:20:48' \ 'src/graphics/host_gpu/graphicContext.h:90:102' \ 'src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp:865:880'; do IFS=: read -r file start end <<< "$spec" echo "----- $file:$start-$end -----" nl -ba "$file" | sed -n "${start},${end}p" done rg -n -F -e 'VectorBranchVoteStaysInsideWave32' -e 'ScalarBranchRestoresInactiveWave32' -- tests/ShaderRecompilerComputeTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 7686 --- </dd> </dl> </details> **Keep the vote within the guest wave.** On a 64-lane subgroup, Vulkan can assign local invocation indices to subgroup lanes in a different order. In that case, the selected ballot word can contain lanes from different guest waves and omit lanes from the caller’s wave. The vote can then produce an incorrect branch decision. <!-- fingerprinting:phantom:poseidon:beignet55 --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:7c4d4f3557cbccef4cc62e7c --> <!-- This is an auto-generated comment by CodeRabbit -->
@ -857,0 +874,4 @@
state, scope, value, ConstantU32(state, mask));
value = Combine(state, value, shuffled);
}
return value;
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-06 09:41 UTC · original

Major · Functional Correctness · Heavy lift

Supported by static analysis

Script executed:

#!/bin/bash
# Find producers of the subgroup reduction opcodes and check for EXEC masking.
rg -n -C6 'SubgroupUMinU32|SubgroupUMaxU32|SubgroupOrU32' --type=cpp --type=h --type=inc -g '!tests/**'

Repository: KytyPS5/KytyPS5

Length of output: 185


Script executed:

#!/bin/bash
git diff b6cc1fff27c8ee68c14f6eb99d719922335e1358 fc907239637c09f791939334e065d008fe05b964 -- src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp
rg -n -C 5 'SubgroupUMinU32|SubgroupUMaxU32|SubgroupOrU32' src --glob '*.{cpp,h,inc}' || test "$?" -eq 1
nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp | sed -n '780,910p'

Repository: KytyPS5/KytyPS5

Length of output: 19527


Script executed:

#!/bin/bash
nl -ba src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp | sed -n '1,360p'
rg -n -C 5 'ReadLaneElimination|WaveReduction|TestSpirvWave32HalfReductions|SubgroupUMin|SubgroupUMax|SubgroupOr' tests src/graphics/shader/recompiler --glob '*.{cpp,h,inc}' || test "$?" -eq 1
rg -n -C 4 'LocalSize|local_size|workgroup_size|SubgroupSize|host_subgroup_size' src/graphics/shader/recompiler/backend/spirv src/graphics/shader/recompiler/ShaderRecompiler.cpp --glob '*.{cpp,h}' || test "$?" -eq 1

Repository: KytyPS5/KytyPS5

Length of output: 43229


Web query:

SPIR-V specification OpGroupNonUniformShuffleXor inactive invocation result undefined OpGroupNonUniformUMin active invocations

Result:

Sources consulted:
- SPIR-V Specification — https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html
- SPIR-V Specification — https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.pdf
- SPIR-V Specification — https://registry.khronos.org/SPIR-V/specs/1.2/SPIRV.html
- SPIR-V Specification Provisional — https://registry.khronos.org/SPIR-V/specs/1.1/SPIRV.mobile.html
- …and 24 more

Script executed:

#!/bin/bash
nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp | sed -n '842,885p'
nl -ba src/graphics/shader/recompiler/ShaderRecompiler.cpp | sed -n '35,180p'
nl -ba tests/ScalarProvenanceTests.cpp | sed -n '692,813p'
nl -ba tests/ShaderRecompilerComputeTests.cpp | sed -n '46765,46895p'
rg -n -C 3 'wave_size\s*=\s*32|wave_size|local_size' src/graphics/shader/recompiler/ShaderRecompiler.cpp src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp src/graphics/shader/shader.h | sed -n '1,180p'

Repository: KytyPS5/KytyPS5

Length of output: 37601


Handle inactive host invocations in wave32 reductions.

A partial host subgroup can make the butterfly read an inactive invocation and produce an undefined reduction result. Full guest EXEC does not guarantee that all 32 host invocations exist.

Reduce all active invocations in the caller’s half. Masking guest EXEC-disabled inputs alone does not fix shuffles from missing host invocations.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-06 09:41 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2136#discussion_r4491051301) <!-- coderabbit-ai-generated:v1 --> **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/major-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Major** · **Functional Correctness** · **Heavy lift** <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/review-details-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/review-details.svg" width="16" height="16" align="absmiddle" alt=""></picture> Supported by static analysis</summary> <dl> <dd> <br> Script executed: ```bash #!/bin/bash # Find producers of the subgroup reduction opcodes and check for EXEC masking. rg -n -C6 'SubgroupUMinU32|SubgroupUMaxU32|SubgroupOrU32' --type=cpp --type=h --type=inc -g '!tests/**' ``` Repository: KytyPS5/KytyPS5 Length of output: 185 --- Script executed: ```bash #!/bin/bash git diff b6cc1fff27c8ee68c14f6eb99d719922335e1358 fc907239637c09f791939334e065d008fe05b964 -- src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp rg -n -C 5 'SubgroupUMinU32|SubgroupUMaxU32|SubgroupOrU32' src --glob '*.{cpp,h,inc}' || test "$?" -eq 1 nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp | sed -n '780,910p' ``` Repository: KytyPS5/KytyPS5 Length of output: 19527 --- Script executed: ```bash #!/bin/bash nl -ba src/graphics/shader/recompiler/ir/passes/ReadLaneElimination.cpp | sed -n '1,360p' rg -n -C 5 'ReadLaneElimination|WaveReduction|TestSpirvWave32HalfReductions|SubgroupUMin|SubgroupUMax|SubgroupOr' tests src/graphics/shader/recompiler --glob '*.{cpp,h,inc}' || test "$?" -eq 1 rg -n -C 4 'LocalSize|local_size|workgroup_size|SubgroupSize|host_subgroup_size' src/graphics/shader/recompiler/backend/spirv src/graphics/shader/recompiler/ShaderRecompiler.cpp --glob '*.{cpp,h}' || test "$?" -eq 1 ``` Repository: KytyPS5/KytyPS5 Length of output: 43229 --- Web query: `SPIR-V specification OpGroupNonUniformShuffleXor inactive invocation result undefined OpGroupNonUniformUMin active invocations` Result: ``` Sources consulted: - SPIR-V Specification — https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html - SPIR-V Specification — https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.pdf - SPIR-V Specification — https://registry.khronos.org/SPIR-V/specs/1.2/SPIRV.html - SPIR-V Specification Provisional — https://registry.khronos.org/SPIR-V/specs/1.1/SPIRV.mobile.html - …and 24 more ``` --- Script executed: ```bash #!/bin/bash nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp | sed -n '842,885p' nl -ba src/graphics/shader/recompiler/ShaderRecompiler.cpp | sed -n '35,180p' nl -ba tests/ScalarProvenanceTests.cpp | sed -n '692,813p' nl -ba tests/ShaderRecompilerComputeTests.cpp | sed -n '46765,46895p' rg -n -C 3 'wave_size\s*=\s*32|wave_size|local_size' src/graphics/shader/recompiler/ShaderRecompiler.cpp src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp src/graphics/shader/shader.h | sed -n '1,180p' ``` Repository: KytyPS5/KytyPS5 Length of output: 37601 --- </dd> </dl> </details> **Handle inactive host invocations in wave32 reductions.** A partial host subgroup can make the butterfly read an inactive invocation and produce an undefined reduction result. Full guest EXEC does not guarantee that all 32 host invocations exist. Reduce all active invocations in the caller’s half. Masking guest EXEC-disabled inputs alone does not fix shuffles from missing host invocations. <!-- fingerprinting:phantom:poseidon:beignet55 --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:9debd98880a8ee3dd542c356 --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-06 09:41 UTC · original
On tests/ShaderRecompilerComputeTests.cpp line 29855 (outdated):

@@ -29833,6 +29833,35 @@ TestCase VectorLaneWave32RuntimeSelectorWraps() {
   return test;
 }
 
+TestCase VectorBranchVoteStaysInsideWave32() {
+  using O = ShaderOpcode;
+
+  std::vector<u32> code;
+  AppendVMovU32(&code, 1, 0);
+  AppendVMovU32(&code, 2, 32);
+  code.push_back(EncodeVopc(0xc1, Vgpr(0), 2)); // v_cmp_lt_u32 vcc, v0, v2
+  code.push_back(EncodeSopp(0x07, 1));                     // s_cbranch_vccnz over the marker
+  AppendVMovU32(&code, 1, 7);
+  AppendStoreVgprAtLaneDwordOffset(&code, 1, 0, 0);
+  AppendEnd(&code);
+
+  TestCase test;
+  test.name = "VectorBranchVoteStaysInsideWave32";
+  test.code = code;
+  test.expected.assign(32, 0);  // Only the wave whose lanes compare true takes the branch.
+  test.expected.resize(64, 7u);
+  test.opcodes = {O::V_MOV_B32, O::V_CMP_LT_U32, O::S_CBRANCH_VCCNZ,
+                  O::V_LSHLREV_B32, O::BUFFER_STORE_DWORD, O::S_ENDPGM};
+  test.forbidden_spirv = {"OpGroupNonUniformAny", "OpGroupNonUniformAll"};

Major · Functional Correctness · Quick win

Supported by static analysis

Script executed:

rg -n 'host_subgroup_size' src tests | head -60
sed -n '29833,29867p' tests/ShaderRecompilerComputeTests.cpp
sed -n '34160,34182p' tests/ShaderRecompilerComputeTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 6061


Script executed:

rg -n -F -e 'CompileCase(' -e 'VectorBranchVoteStaysInsideWave32' -e 'required_spirv' -e 'forbidden_spirv' tests/ShaderRecompilerComputeTests.cpp
sed -n '1710,1820p' tests/ShaderRecompilerComputeTests.cpp
sed -n '800,900p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp
sed -n '25,55p' src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp
sed -n '34100,34185p' tests/ShaderRecompilerComputeTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 35309


Script executed:

rg -n -F -e 'CheckSpirvEmission(test' -e 'RunCase(' -e 'ScalarBranchRestoresInactiveLanes(' -e 'SubgroupSize() const' -e 'subgroupSize' tests/ShaderRecompilerComputeTests.cpp
sed -n '23320,23490p' tests/ShaderRecompilerComputeTests.cpp
sed -n '47735,47775p' tests/ShaderRecompilerComputeTests.cpp
rg -n -C 4 -F 'ScalarBranchRestoresInactiveLanes(' tests/ShaderRecompilerComputeTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 36163


Script executed:

sed -n '2140,2170p' tests/ShaderRecompilerComputeTests.cpp
sed -n '1835,1860p' tests/ShaderRecompilerComputeTests.cpp
sed -n '55840,55905p' tests/ShaderRecompilerComputeTests.cpp
rg -n -F -e 'S_CBRANCH_VCCNZ' -e 'S_CBRANCH_EXECNZ' src/graphics/shader/recompiler
rg -n -F -e 'EmitLiveMask(' -e 'EmitConditionRef(' -e 'HalfBallotWord(' src/graphics/shader/recompiler/backend/spirv

Repository: KytyPS5/KytyPS5

Length of output: 7407


Script executed:

sed -n '48,72p' src/graphics/shader/recompiler/frontend/cfg/ShaderCFG.cpp
rg -n -F -e 'BranchCondition::VccNonZero' -e 'BranchCondition::ExecNonZero' -e 'ConditionRef' src/graphics/shader/recompiler/frontend src/graphics/shader/recompiler/backend/spirv
rg -n -F -e 'EmitLiveMask' -e 'OpGroupNonUniformBallot' -e 'IR::Opcode::LiveMask' src/graphics/shader/recompiler/backend/spirv src/graphics/shader/recompiler/frontend

Repository: KytyPS5/KytyPS5

Length of output: 3661


Make wave32 instruction checks depend on the host subgroup size.

On a 32-lane host, the emitter uses OpGroupNonUniformAny for these nonzero branches, but the wave32 checks forbid it. The tests can fail before comparing shader output. Apply the ballot-specific checks only when wave32 shares a wider host subgroup.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-06 09:41 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2136#discussion_r4491051311) On `tests/ShaderRecompilerComputeTests.cpp` line 29855 (outdated): ```diff @@ -29833,6 +29833,35 @@ TestCase VectorLaneWave32RuntimeSelectorWraps() { return test; } +TestCase VectorBranchVoteStaysInsideWave32() { + using O = ShaderOpcode; + + std::vector<u32> code; + AppendVMovU32(&code, 1, 0); + AppendVMovU32(&code, 2, 32); + code.push_back(EncodeVopc(0xc1, Vgpr(0), 2)); // v_cmp_lt_u32 vcc, v0, v2 + code.push_back(EncodeSopp(0x07, 1)); // s_cbranch_vccnz over the marker + AppendVMovU32(&code, 1, 7); + AppendStoreVgprAtLaneDwordOffset(&code, 1, 0, 0); + AppendEnd(&code); + + TestCase test; + test.name = "VectorBranchVoteStaysInsideWave32"; + test.code = code; + test.expected.assign(32, 0); // Only the wave whose lanes compare true takes the branch. + test.expected.resize(64, 7u); + test.opcodes = {O::V_MOV_B32, O::V_CMP_LT_U32, O::S_CBRANCH_VCCNZ, + O::V_LSHLREV_B32, O::BUFFER_STORE_DWORD, O::S_ENDPGM}; + test.forbidden_spirv = {"OpGroupNonUniformAny", "OpGroupNonUniformAll"}; ``` <!-- coderabbit-ai-generated:v1 --> **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/major-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Major** · **Functional Correctness** · **Quick win** <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/review-details-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/review-details.svg" width="16" height="16" align="absmiddle" alt=""></picture> Supported by static analysis</summary> <dl> <dd> <br> Script executed: ```bash rg -n 'host_subgroup_size' src tests | head -60 sed -n '29833,29867p' tests/ShaderRecompilerComputeTests.cpp sed -n '34160,34182p' tests/ShaderRecompilerComputeTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 6061 --- Script executed: ```bash rg -n -F -e 'CompileCase(' -e 'VectorBranchVoteStaysInsideWave32' -e 'required_spirv' -e 'forbidden_spirv' tests/ShaderRecompilerComputeTests.cpp sed -n '1710,1820p' tests/ShaderRecompilerComputeTests.cpp sed -n '800,900p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp sed -n '25,55p' src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp sed -n '34100,34185p' tests/ShaderRecompilerComputeTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 35309 --- Script executed: ```bash rg -n -F -e 'CheckSpirvEmission(test' -e 'RunCase(' -e 'ScalarBranchRestoresInactiveLanes(' -e 'SubgroupSize() const' -e 'subgroupSize' tests/ShaderRecompilerComputeTests.cpp sed -n '23320,23490p' tests/ShaderRecompilerComputeTests.cpp sed -n '47735,47775p' tests/ShaderRecompilerComputeTests.cpp rg -n -C 4 -F 'ScalarBranchRestoresInactiveLanes(' tests/ShaderRecompilerComputeTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 36163 --- Script executed: ```bash sed -n '2140,2170p' tests/ShaderRecompilerComputeTests.cpp sed -n '1835,1860p' tests/ShaderRecompilerComputeTests.cpp sed -n '55840,55905p' tests/ShaderRecompilerComputeTests.cpp rg -n -F -e 'S_CBRANCH_VCCNZ' -e 'S_CBRANCH_EXECNZ' src/graphics/shader/recompiler rg -n -F -e 'EmitLiveMask(' -e 'EmitConditionRef(' -e 'HalfBallotWord(' src/graphics/shader/recompiler/backend/spirv ``` Repository: KytyPS5/KytyPS5 Length of output: 7407 --- Script executed: ```bash sed -n '48,72p' src/graphics/shader/recompiler/frontend/cfg/ShaderCFG.cpp rg -n -F -e 'BranchCondition::VccNonZero' -e 'BranchCondition::ExecNonZero' -e 'ConditionRef' src/graphics/shader/recompiler/frontend src/graphics/shader/recompiler/backend/spirv rg -n -F -e 'EmitLiveMask' -e 'OpGroupNonUniformBallot' -e 'IR::Opcode::LiveMask' src/graphics/shader/recompiler/backend/spirv src/graphics/shader/recompiler/frontend ``` Repository: KytyPS5/KytyPS5 Length of output: 3661 --- </dd> </dl> </details> **Make wave32 instruction checks depend on the host subgroup size.** On a 32-lane host, the emitter uses `OpGroupNonUniformAny` for these nonzero branches, but the wave32 checks forbid it. The tests can fail before comparing shader output. Apply the ballot-specific checks only when wave32 shares a wider host subgroup. <!-- fingerprinting:phantom:medusa:beignet55 --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:49317fa61d528e1e4212763f --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-06 09:41 UTC · original · reviewed

Actionable comments posted: 3

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b6cc1fff27 and fc907239637c09f791939334e065d008fe05b964.

Files selected for processing: 7

  • src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.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; 9 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-06 09:41 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2136#pullrequestreview-5798344166) · **reviewed** <!-- coderabbit-ai-generated:v1 --> **Actionable comments posted: 3** <h6> <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <br> <details> <summary><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</summary> <dl> <dd> <br> - **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/b6cc1fff27c8ee68c14f6eb99d719922335e1358/.coderabbit.yaml>) - **Commit**: [b6cc1ff](<https://github.com/KytyPS5/KytyPS5/commit/b6cc1fff27c8ee68c14f6eb99d719922335e1358>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `6965f39d-267c-431c-b0f5-46d024e3d321` </dd> </dl> </details> <details> <summary><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</summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between b6cc1fff27c8ee68c14f6eb99d719922335e1358 and fc907239637c09f791939334e065d008fe05b964. </dd> </dl> </details> <details> <summary><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: 7</summary> <dl> <dd> <br> * `src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.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; 9 remain after this review. </dd> </dl> </details> </h6> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=db7e448f-3258-4b55-bc1f-1a5681991209 attempt=e7e9ffbe-9280-48e5-95b0-410efd527c5f batch=1/1 -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-06 22:05 UTC · original · reviewed

Nitpick comments: 2

tests/shaderCfgTests.cpp: 2

13194-13198: Trivial · Functional Correctness · Quick win

Assert the reduction shuffle masks.

The test should inspect the five OpGroupNonUniformShuffleXor mask operands for each reduction and require the sequence 1, 2, 4, 8, 16. A mask of 32 could cross into the other guest wave while preserving the current opcode counts.


13135-13138: Trivial · Functional Correctness · Quick win

Assert the selected ballot word and active lanes.

The count check can pass if the upper half extracts word 0. Check the OpVectorExtractDynamic index and its lane-ID source. Also check that All compares against the selected half’s active lanes.

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between fc907239637c09f791939334e065d008fe05b964 and 4120ffc001.

Files selected for processing: 2

  • 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; 9 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-06 22:05 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2136#pullrequestreview-5807657055) · **reviewed** <!-- coderabbit-ai-generated:v1 --> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/brush-cleaning-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/brush-cleaning.svg" width="16" height="16" align="absmiddle" alt=""></picture> Nitpick comments: 2</summary><blockquote> <dl> <dd> <br> <details> <summary>tests/shaderCfgTests.cpp: 2</summary><blockquote> <dl> <dd> <br> `13194-13198`: **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/neutral-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Trivial** · **Functional Correctness** · **Quick win** **Assert the reduction shuffle masks.** The test should inspect the five `OpGroupNonUniformShuffleXor` mask operands for each reduction and require the sequence `1, 2, 4, 8, 16`. A mask of 32 could cross into the other guest wave while preserving the current opcode counts. <!-- cr-comment:v1:c6473d97a1710c0c0e440dc0 --> --- `13135-13138`: **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/neutral-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Trivial** · **Functional Correctness** · **Quick win** **Assert the selected ballot word and active lanes.** The count check can pass if the upper half extracts word 0. Check the `OpVectorExtractDynamic` index and its lane-ID source. Also check that `All` compares against the selected half’s active lanes. <!-- cr-comment:v1:468634a93884a43c65b23c0b --> </dd> </dl> </blockquote></details> </dd> </dl> </blockquote></details> <h6> <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <br> <details> <summary><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</summary> <dl> <dd> <br> - **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/182161eb3e31439d97433607a8aa95463c56a9cc/.coderabbit.yaml>) - **Commit**: [182161e](<https://github.com/KytyPS5/KytyPS5/commit/182161eb3e31439d97433607a8aa95463c56a9cc>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `6861293a-d256-4482-aca2-a5e640882ba6` </dd> </dl> </details> <details> <summary><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</summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between fc907239637c09f791939334e065d008fe05b964 and 4120ffc001f3f9eeac81f693cf6be377ce0a0916. </dd> </dl> </details> <details> <summary><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: 2</summary> <dl> <dd> <br> * `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; 9 remain after this review. </dd> </dl> </details> </h6> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=4a06a6b5-c847-4763-8e6a-ba86450b2791 attempt=50c56005-b869-4ad1-977f-1ca19956b2f7 batch=1/1 -->

Pull request closed

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