tests: check that V_CMPX leaves VCC unchanged #1251

Closed
github-bot wants to merge 1 commit from gh-pr/1251/head into gh-pr/1251/base
Owner

@⁠Nawid3333 on GitHub · 2026-10-08 20:00 UTC · original
Nawid3333:tests/cmpx-preserves-vcc → main · +26 −0 · 1 files · 1 commits · closed without merging

Problem

On RDNA2 every V_CMPX_* writes its result to EXEC only: the ISA guide says "All V_CMPX instructions write the
result of their comparison (one bit per thread) the EXEC mask", and the per-opcode pseudo-code is
EXEC[threadId] = (S0 < S1) with no VCC term. No test checks that VCC survives a V_CMPX: a translation that also
writes VCC passed every test I could run (the CPU tests, the GPU case list and the focused modes that pass on my
host).

Change

VectorCmpxPreservesVcc sets VCC with V_CMP_GT_U32 (true), saves EXEC, runs V_CMPX_LT_U32 (false), saves the
resulting EXEC, restores EXEC and reads VCC through V_CNDMASK_B32. It expects VCC still true and EXEC zero after
the V_CMPX. It runs in the default list and with --cmpx-lt-u16-only, which already runs the 32-bit V_CMPX EXEC
cases (VectorVop3CmpxWritesExecMask, VectorVopcSdwaCmpxWritesExecMask); happy to use a new mode instead.

Testing

Windows 11, clang-cl 19.1.5, Release, AMD RX 9070 XT (Vulkan driver 2.0.395, Adrenalin 26.8.1), on 2f4b8a33:

  • shader_recompiler_compute_tests --cmpx-lt-u16-only passes.
  • With the V_CMPX path in Compare.cpp also writing VCC (ir.SetVcc(masked)), it fails.
  • shader_cfg, resource_tracking, resource_materialization, scalar_provenance and shader_vertex_metadata
    pass.
  • The default run stops earlier on this host (D24S8, #930), so the case was run through its focused mode.
  • CI on my fork builds it on Linux, Windows and macOS; CI has no GPU, so it does not run this case: https://github.com/Nawid3333/KytyPS5/actions/runs/37831819681

AI use (per the README's AI policy): Claude (Anthropic) found the gap with a mutation run, wrote the test and
this description, and ran the checks above on my machine.

**@⁠Nawid3333** on GitHub · 2026-10-08 20:00 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1251) `Nawid3333:tests/cmpx-preserves-vcc` → `main` · +26 −0 · 1 files · 1 commits · closed without merging ## Problem On RDNA2 every `V_CMPX_*` writes its result to EXEC only: the ISA guide says "All V_CMPX instructions write the result of their comparison (one bit per thread) the EXEC mask", and the per-opcode pseudo-code is `EXEC[threadId] = (S0 < S1)` with no VCC term. No test checks that VCC survives a V_CMPX: a translation that also writes VCC passed every test I could run (the CPU tests, the GPU case list and the focused modes that pass on my host). ## Change `VectorCmpxPreservesVcc` sets VCC with `V_CMP_GT_U32` (true), saves EXEC, runs `V_CMPX_LT_U32` (false), saves the resulting EXEC, restores EXEC and reads VCC through `V_CNDMASK_B32`. It expects VCC still true and EXEC zero after the V_CMPX. It runs in the default list and with `--cmpx-lt-u16-only`, which already runs the 32-bit V_CMPX EXEC cases (`VectorVop3CmpxWritesExecMask`, `VectorVopcSdwaCmpxWritesExecMask`); happy to use a new mode instead. ## Testing Windows 11, clang-cl 19.1.5, Release, AMD RX 9070 XT (Vulkan driver 2.0.395, Adrenalin 26.8.1), on `2f4b8a33`: - `shader_recompiler_compute_tests --cmpx-lt-u16-only` passes. - With the V_CMPX path in `Compare.cpp` also writing VCC (`ir.SetVcc(masked)`), it fails. - `shader_cfg`, `resource_tracking`, `resource_materialization`, `scalar_provenance` and `shader_vertex_metadata` pass. - The default run stops earlier on this host (D24S8, #930), so the case was run through its focused mode. - CI on my fork builds it on Linux, Windows and macOS; CI has no GPU, so it does not run this case: https://github.com/Nawid3333/KytyPS5/actions/runs/37831819681 **AI use** (per the README's AI policy): Claude (Anthropic) found the gap with a mutation run, wrote the test and this description, and ran the checks above on my machine.
On RDNA2 every V_CMPX writes its result to EXEC only; V_CMP writes VCC or an
SGPR pair. Nothing checked that VCC survives a V_CMPX, so a translation that
also wrote VCC (as GCN did) passed every test. VectorCmpxPreservesVcc sets VCC
with V_CMP_GT_U32 (true), runs V_CMPX_LT_U32 (false), restores EXEC and reads
VCC through V_CNDMASK_B32; it also stores the EXEC mask the V_CMPX left. It
runs in the default list and with --cmpx-lt-u16-only next to the other V_CMPX
EXEC cases.

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

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

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: 755c1111-afd9-4af2-aa46-136bb18f639d
📥 Commits

Reviewing files that changed from the base of the PR and between 2f4b8a335d and b7aec02e63.

📒 Files selected for processing (1)
  • tests/ShaderRecompilerComputeTests.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

Walkthrough

Adds VectorCmpxPreservesVcc, a regression test for a vector comparison followed by CMPX. The test checks that CMPX updates EXEC without replacing the earlier VCC result, then verifies the expected output after EXEC is restored. The test is registered in the full case list and the --cmpx-lt-u16-only selector.

Suggested reviewers: nmzik

Priority: ⬇️ Low

Change: Other

Merge Risk: ⚪ Minimal · up to b7aec

The regression test distinguishes preserved VCC from an overwrite and checks the result. No actionable merge-blocking risk remains beyond normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a test that verifies V_CMPX does not modify VCC.
Description check ✅ Passed The description directly explains the V_CMPX and VCC behavior, the new regression test, registration details, and validation results.
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 0…
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.
  • Autopilot · 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-08 20:05 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1251#issuecomment-6068083123) <!-- 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/1251?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `755c1111-afd9-4af2-aa46-136bb18f639d` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 2f4b8a335d5e27a5153bdea670bd877a061e37b1 and b7aec02e6393c33ef5f53bf988dce706ab4585a2. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `tests/ShaderRecompilerComputeTests.cpp` </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. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough Adds `VectorCmpxPreservesVcc`, a regression test for a vector comparison followed by CMPX. The test checks that CMPX updates EXEC without replacing the earlier VCC result, then verifies the expected output after EXEC is restored. The test is registered in the full case list and the `--cmpx-lt-u16-only` selector. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⬇️ Low <!-- change_assessment_commit:"b7aec02e6393c33ef5f53bf988dce706ab4585a2" --> **Change:** Other <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **⚪ Minimal** · up to `b7aec` <!-- final_review_risk_coverage:{"sourceCommitId":"b7aec02e6393c33ef5f53bf988dce706ab4585a2","coveredCommitId":"b7aec02e6393c33ef5f53bf988dce706ab4585a2","kind":"reviewed"} --> The regression test distinguishes preserved VCC from an overwrite and checks the result. No actionable merge-blocking risk remains beyond normal checks. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 5</summary> <details> <summary>✅ Passed checks (5 passed)</summary> | Check name | Status | Explanation | | :------------------------ | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly summarizes the main change: adding a test that verifies V_CMPX does not modify VCC. | | Description check | ✅ Passed | The description directly explains the V_CMPX and VCC behavior, the new regression test, registration details, and validation results. | | 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 0… | | 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. | </details> </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">Autopilot</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=1251)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [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) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->

Pull request closed

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