shader: implement V_CMP(X)_GT_I64 and V_CMP(X)_GE_I64 #1222

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

@⁠TheCruZ on GitHub · 2026-10-08 18:46 UTC · original
pr/cmp-gt-ge-i64 → main · +455 −27 · 8 files · 1 commits · closed without merging

Summary

Adds the last missing 64-bit integer compares, V_CMP_GT_I64, V_CMP_GE_I64, V_CMPX_GT_I64 and V_CMPX_GE_I64. Grand Theft Auto V (PPSA04264 v1.005) aborted entering Story Mode on unsupported 64-bit integer compares (V_CMP_NE_I64 in cs 0x8395e43f382309df). Upstream has since added all the other I64/U64 compares (bb98f264); this completes the family.

The change was written by @⁠At0mC3 as a PR to my GTA V fork (commit authorship kept), and adapted to upstream. Its V_FRACT_F64 clamp part is left out because #1212 covers it.

Problem

  • The signed greater-than compares (VOPC 0xa4, 0xa6, 0xb4, 0xb6 and their VOP3 forms) were not decoded, so a shader using them was unsupported.
  • SupportsVopcSdwa only excluded V_CMP_NE_I64 among the 64-bit integer compares, so the others could still be decoded as VOPC SDWA, which has no 64-bit operands.
  • IncludeInstructionVectorRegisters did not list the F and T variants as 64-bit operands.

Change

  • The four opcodes are decoded and translated. The IR has no signed 64-bit greater-than, so a > b is emitted as b < a and a >= b as b <= a (EmitIntegerCompare gets a swap_operands flag).
  • The 64-bit integer compares are contiguous in the opcode enum (V_CMP_F_I64 .. V_CMPX_T_U64, kept in hardware order), and every one of them stays out of VOPC SDWA decoding.
  • Vector-register inclusion covers all of them, F and T included.

Testing

  • Grand Theft Auto V: the fork has run with this change since the PR above; I play PPSA04263, which did not hit these opcodes.
  • shader_recompiler_compute_tests: new --cmp-i64-only selector with VectorCompareInteger64Family (wave32 and wave64, every relation of the I64/U64 families over INT64_MIN, -1, 0, 1, INT64_MAX and the unsigned edge values) and VectorVop3CompareNeI64CapturedScalarSource, both also in the default run. --cmp-i64-only, --integer64-compare-only and the default run pass.
  • shader_cfg_tests: TestNewShaderRecompilerRejectsDppOn64BitCompares now covers every 64-bit integer compare; passes.
  • Tested on Windows 11 with AMD Ryzen 5900x and RTX 3090.

AI usage

The original change is by @⁠At0mC3. AI (Claude Opus 5.5) was used to adapt it to upstream. I reviewed the code, understand it, tested it as described above, and wrote this description myself, in general fully tested the game while doing few missions and playing in-game with my GTA V fork, i will be bringing PRs here after test them enough.

**@⁠TheCruZ** on GitHub · 2026-10-08 18:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1222) `pr/cmp-gt-ge-i64` → `main` · +455 −27 · 8 files · 1 commits · closed without merging ## Summary Adds the last missing 64-bit integer compares, `V_CMP_GT_I64`, `V_CMP_GE_I64`, `V_CMPX_GT_I64` and `V_CMPX_GE_I64`. Grand Theft Auto V (PPSA04264 v1.005) aborted entering Story Mode on unsupported 64-bit integer compares (`V_CMP_NE_I64` in `cs 0x8395e43f382309df`). Upstream has since added all the other I64/U64 compares (bb98f264); this completes the family. The change was written by @⁠At0mC3 as a PR to my [GTA V fork](https://github.com/TheCruZ/KytyPS5-GTA/pull/1) (commit authorship kept), and adapted to upstream. Its V_FRACT_F64 clamp part is left out because #1212 covers it. ## Problem - The signed greater-than compares (VOPC `0xa4`, `0xa6`, `0xb4`, `0xb6` and their VOP3 forms) were not decoded, so a shader using them was unsupported. - `SupportsVopcSdwa` only excluded `V_CMP_NE_I64` among the 64-bit integer compares, so the others could still be decoded as VOPC SDWA, which has no 64-bit operands. - `IncludeInstructionVectorRegisters` did not list the `F` and `T` variants as 64-bit operands. ## Change - The four opcodes are decoded and translated. The IR has no signed 64-bit greater-than, so `a > b` is emitted as `b < a` and `a >= b` as `b <= a` (`EmitIntegerCompare` gets a `swap_operands` flag). - The 64-bit integer compares are contiguous in the opcode enum (`V_CMP_F_I64` .. `V_CMPX_T_U64`, kept in hardware order), and every one of them stays out of VOPC SDWA decoding. - Vector-register inclusion covers all of them, `F` and `T` included. ## Testing - Grand Theft Auto V: the fork has run with this change since the PR above; I play PPSA04263, which did not hit these opcodes. - `shader_recompiler_compute_tests`: new `--cmp-i64-only` selector with `VectorCompareInteger64Family` (wave32 and wave64, every relation of the I64/U64 families over INT64_MIN, -1, 0, 1, INT64_MAX and the unsigned edge values) and `VectorVop3CompareNeI64CapturedScalarSource`, both also in the default run. `--cmp-i64-only`, `--integer64-compare-only` and the default run pass. - `shader_cfg_tests`: `TestNewShaderRecompilerRejectsDppOn64BitCompares` now covers every 64-bit integer compare; passes. - Tested on Windows 11 with AMD Ryzen 5900x and RTX 3090. ## AI usage The original change is by @⁠At0mC3. AI (Claude Opus 5.5) was used to adapt it to upstream. I reviewed the code, understand it, tested it as described above, and wrote this description myself, in general fully tested the game while doing few missions and playing in-game with my [GTA V fork](https://github.com/TheCruZ/KytyPS5-GTA), i will be bringing PRs here after test them enough.
GTA V (PPSA04264 v1.005) aborted entering Story Mode on unsupported
64-bit integer compares (V_CMP_NE_I64 in cs 0x8395e43f382309df). Upstream
has since added the I64/U64 compares except the signed greater-than ones
(bb98f264); this adds V_CMP_GT_I64, V_CMP_GE_I64, V_CMPX_GT_I64 and
V_CMPX_GE_I64 (VOPC and VOP3). The IR has no signed 64-bit greater-than,
so a > b is emitted as b < a and a >= b as b <= a.

The 64-bit integer compares are now contiguous in the opcode enum and
all of them stay out of VOPC SDWA decoding, which still accepted most of
them; the vector-register inclusion covers the F and T variants too.

Tests: --cmp-i64-only (VectorCompareInteger64Family for wave32 and
wave64, VectorVop3CompareNeI64CapturedScalarSource);
TestNewShaderRecompilerRejectsDppOn64BitCompares covers every 64-bit
integer compare.

From https://github.com/TheCruZ/KytyPS5-GTA/pull/1
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:48:42 +00:00
github-bot closed this pull request 2026-11-26 09:48:42 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 18:50 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: 91a39d2f-b743-40f6-b80a-55ed7325d31c
📥 Commits

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

📒 Files selected for processing (8)
  • src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h
  • src/graphics/shader/recompiler/frontend/decode/VectorAluOps.cpp
  • src/graphics/shader/recompiler/frontend/translate/Compare.cpp
  • src/graphics/shader/recompiler/frontend/translate/Translate.cpp
  • src/graphics/shader/recompiler/frontend/translate/Translator.h
  • src/graphics/shader/recompiler/frontend/translate/Vector.cpp
  • tests/ShaderRecompilerComputeTests.cpp
  • tests/shaderCfgTests.cpp

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


📝 Walkthrough

Walkthrough

The decoder now recognizes 64-bit vector comparison encodings and rejects unsupported DPP and SDWA forms. The translator adds signed 64-bit greater-than and greater-than-or-equal comparisons using reversed operands, and updates VGPR accounting. Tests cover the comparison families, operand forms, wave sizes, and mask behavior.

Suggested reviewers: nmzik

Priority: ⬇️ Low

Change: Bug fix

Merge Risk: ⚪ Minimal · up to b5482

No actionable merge-blocking issue is established for the 64-bit comparison changes. Normal validation remains appropriate.

🚥 Pre-merge checks | ✅ 4 | ❓ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ❓ Inconclusive Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 6 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: implementing the missing signed 64-bit greater-than and greater-than-or-equal compare opcodes.
Description check ✅ Passed The description directly explains the opcode additions, translation approach, related decoding changes, and test coverage.
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 8.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 6 files. (2 skipped: 2 too large.)

  • 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 18:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1222#issuecomment-6066810582) <!-- 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/1222?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**: `91a39d2f-b743-40f6-b80a-55ed7325d31c` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 2f4b8a335d5e27a5153bdea670bd877a061e37b1 and b5482f741f1a5464418e3a990fd58b3f1f9e6364. </details> <details> <summary>📒 Files selected for processing (8)</summary> * `src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h` * `src/graphics/shader/recompiler/frontend/decode/VectorAluOps.cpp` * `src/graphics/shader/recompiler/frontend/translate/Compare.cpp` * `src/graphics/shader/recompiler/frontend/translate/Translate.cpp` * `src/graphics/shader/recompiler/frontend/translate/Translator.h` * `src/graphics/shader/recompiler/frontend/translate/Vector.cpp` * `tests/ShaderRecompilerComputeTests.cpp` * `tests/shaderCfgTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough The decoder now recognizes 64-bit vector comparison encodings and rejects unsupported DPP and SDWA forms. The translator adds signed 64-bit greater-than and greater-than-or-equal comparisons using reversed operands, and updates VGPR accounting. Tests cover the comparison families, operand forms, wave sizes, and mask behavior. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⬇️ Low <!-- change_assessment_commit:"b5482f741f1a5464418e3a990fd58b3f1f9e6364" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **⚪ Minimal** · up to `b5482` <!-- final_review_risk_coverage:{"sourceCommitId":"b5482f741f1a5464418e3a990fd58b3f1f9e6364","coveredCommitId":"b5482f741f1a5464418e3a990fd58b3f1f9e6364","kind":"reviewed"} --> No actionable merge-blocking issue is established for the 64-bit comparison changes. Normal validation remains appropriate. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❓ 1</summary> ### ❌ Failed checks (1 inconclusive) | Check name | Status | Explanation | Resolution | | :---------------- | :------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ❓ Inconclusive | Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 6 files. (2 skipped: 2… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------ | :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly and concisely identifies the main change: implementing the missing signed 64-bit greater-than and greater-than-or-equal compare opcodes. | | Description check | ✅ Passed | The description directly explains the opcode additions, translation approach, related decoding changes, and test coverage. | | 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> <summary>Full details: Docstring Coverage</summary> **Explanation** Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 6 files. (2 skipped: 2 too large.) </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=1222)! 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 -->
Author
Owner

@⁠Nmzik on GitHub · 2026-10-10 01:38 UTC · original

rebased and credited d247d3d60c

**@⁠Nmzik** on GitHub · 2026-10-10 01:38 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1222#issuecomment-6092265854) rebased and credited d247d3d60c6a2f3c38552b53bb1a4e9d1bc15311

Pull request closed

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