shader: decode V_CMPX_NGE_F16 (VOPC 0xf9) #2532

Manually merged
github merged 2 commits from gh-pr/2532/head into gh-pr/2532/base 2026-11-26 10:22:18 +00:00
Owner

@⁠Nawid3333 on GitHub · 2026-11-24 02:09 UTC · original
Nawid3333:fix/vopc-cmpx-nge-f16 → main · +124 −23 · 11 files · 2 commits · merged 2026-11-24 14:33 UTC

Refs #2331

Avatar: Frontiers of Pandora stops in the CFG builder on a compare the decoder does not know:

shader CFG build failed: unsupported decoded instruction in CFG at pc 0x00000288: 0x00000288: unsupported family=VOPC opcode=0xf9 raw=[0x7df2d4f9 0x86060004] reason=VOPC SDWA modifier is not supported for opcode

0x7df2d4f9 0x86060004 is v_cmpx_nge_f16_sdwa v4, vcc_lo src0_sel:DWORD src1_sel:DWORD (llvm-mc -mcpu=gfx1013 encodes exactly these words). V_CMP_NGE_F16 (0xe9) is in the VOPC table, but its CMPX form 0xf9 is not, so the opcode decodes as UNSUPPORTED and SupportsVopcSdwa rejects it; the SDWA wording is a side effect of the missing entry.

Change

  • V_CMPX_NGE_F16 in the opcode enum, the VOPC table entry 0xf9, and the two lists that mark float compares and EXEC-writing compares (IsVopcFloatCompareOpcode, IsVopcCompareExec).
  • The translation is the one V_CMP_NGE_F16 already uses (unordered less-than on F16), with the result written to EXEC like the other CMPX compares.

Hardware rows
I ran the game's two words, the SDWA DWORD and WORD_1 forms, the e32 form and the VOP3 form with a negated v4 on an RDNA2 GPU (Ryzen 7600X iGPU, gfx1036) through HIP, FLOAT_MODE with denorm16 = 3, IEEE mode off. All 16 rows match nge = !(a >= b): quiet and signaling NaN compare unordered (1), -0 against +0 gives 0, the DWORD select reads the low half and ignores the high half, WORD_1 reads the high halves, VOP3 neg flips the first source, and f16 denormals are kept (0 against 0x0001 gives 1). VCC keeps its value; only EXEC is written.

Tests

  • New VectorVopcCmpxNgeF16SgprSdwaExecMask: the game's two instruction words and the VOP3 form with -v4, against vcc_lo = 0xbc003c00, 14 cases (NaN, infinity, -0, values around 1.0, data in the unused upper half, one case that starts with EXEC = 0). The expected EXEC bits follow the comparison rule the RDNA2 rows show; the test also checks that VCC is unchanged.
  • With main's source (plus only the enum line, so the test compiles) the test stops with the game's error (same opcode, words and reason, at the test program's pc). With the change it passes on an RX 9070 XT (Windows 11).
  • The whole compute case list on the same GPU gives the same results with and without the change: 249 entries pass, the same three fail on both (Vop2SdwaMinU32PreservesWordDestination, VectorAddcWritesPerLaneCarryOut, VectorCompareF64Edges), and on both the test process crashes at the same point after VectorFractF64CapturedAndEdges (a host problem on this GPU that main has too). The new test comes after that point, so I ran it and the other F16 CMPX tests as their own case list. shader_cfg_tests gives the same output as on main.
  • Ghost of Yōtei (PPSA26344): the 235 shader modules of a capture, translated offline by main and by this branch (both built with the same local test tooling commits): none changes.
  • The test harness needs local changes to run on that GPU (the test changes of #2038, and a runner that starts one case list entry per process); the code under test is this branch.
  • Fork CI for this head: https://github.com/Nawid3333/KytyPS5/actions/runs/45292692673

Game
A tester build with this change (plus my unrelated, not yet submitted material-key work) got Avatar past this stop on the tester's RX 9070 XT; the next stop is an image allocation (failed to create image: extent=3840x2160x1 format=122, image.cpp:720), which this change does not touch (#2331 comment 7117344329).

Not covered: the PS5's own GPU (gfx1013) was not measured, only the RDNA2 iGPU. Other F16 compares are still missing from the table (v_cmp_f/o/nlg/nle/tru_f16, v_cmpx_f/lg/o/u/nlg/tru_f16); I left them out because no game log shows them yet.

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

Written with Claude Code (AI): it decoded the words, measured the instruction on the GPU, wrote the change and the test, and ran them on my PC (Windows 11, RX 9070 XT and Ryzen 7600X iGPU).

**@⁠Nawid3333** on GitHub · 2026-11-24 02:09 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2532) `Nawid3333:fix/vopc-cmpx-nge-f16` → `main` · +124 −23 · 11 files · 2 commits · merged 2026-11-24 14:33 UTC Refs #2331 Avatar: Frontiers of Pandora stops in the CFG builder on a compare the decoder does not know: ``` shader CFG build failed: unsupported decoded instruction in CFG at pc 0x00000288: 0x00000288: unsupported family=VOPC opcode=0xf9 raw=[0x7df2d4f9 0x86060004] reason=VOPC SDWA modifier is not supported for opcode ``` `0x7df2d4f9 0x86060004` is `v_cmpx_nge_f16_sdwa v4, vcc_lo src0_sel:DWORD src1_sel:DWORD` (llvm-mc `-mcpu=gfx1013` encodes exactly these words). `V_CMP_NGE_F16` (0xe9) is in the VOPC table, but its CMPX form 0xf9 is not, so the opcode decodes as UNSUPPORTED and `SupportsVopcSdwa` rejects it; the SDWA wording is a side effect of the missing entry. **Change** - `V_CMPX_NGE_F16` in the opcode enum, the VOPC table entry 0xf9, and the two lists that mark float compares and EXEC-writing compares (`IsVopcFloatCompareOpcode`, `IsVopcCompareExec`). - The translation is the one `V_CMP_NGE_F16` already uses (unordered less-than on F16), with the result written to EXEC like the other CMPX compares. **Hardware rows** I ran the game's two words, the SDWA DWORD and WORD_1 forms, the e32 form and the VOP3 form with a negated `v4` on an RDNA2 GPU (Ryzen 7600X iGPU, gfx1036) through HIP, FLOAT_MODE with denorm16 = 3, IEEE mode off. All 16 rows match nge = !(a >= b): quiet and signaling NaN compare unordered (1), -0 against +0 gives 0, the DWORD select reads the low half and ignores the high half, WORD_1 reads the high halves, VOP3 neg flips the first source, and f16 denormals are kept (0 against 0x0001 gives 1). VCC keeps its value; only EXEC is written. **Tests** - New `VectorVopcCmpxNgeF16SgprSdwaExecMask`: the game's two instruction words and the VOP3 form with `-v4`, against `vcc_lo = 0xbc003c00`, 14 cases (NaN, infinity, -0, values around 1.0, data in the unused upper half, one case that starts with EXEC = 0). The expected EXEC bits follow the comparison rule the RDNA2 rows show; the test also checks that VCC is unchanged. - With main's source (plus only the enum line, so the test compiles) the test stops with the game's error (same opcode, words and reason, at the test program's pc). With the change it passes on an RX 9070 XT (Windows 11). - The whole compute case list on the same GPU gives the same results with and without the change: 249 entries pass, the same three fail on both (`Vop2SdwaMinU32PreservesWordDestination`, `VectorAddcWritesPerLaneCarryOut`, `VectorCompareF64Edges`), and on both the test process crashes at the same point after `VectorFractF64CapturedAndEdges` (a host problem on this GPU that main has too). The new test comes after that point, so I ran it and the other F16 CMPX tests as their own case list. `shader_cfg_tests` gives the same output as on main. - Ghost of Yōtei (PPSA26344): the 235 shader modules of a capture, translated offline by main and by this branch (both built with the same local test tooling commits): none changes. - The test harness needs local changes to run on that GPU (the test changes of #2038, and a runner that starts one case list entry per process); the code under test is this branch. - Fork CI for this head: https://github.com/Nawid3333/KytyPS5/actions/runs/45292692673 **Game** A tester build with this change (plus my unrelated, not yet submitted material-key work) got Avatar past this stop on the tester's RX 9070 XT; the next stop is an image allocation (`failed to create image: extent=3840x2160x1 format=122`, image.cpp:720), which this change does not touch (#2331 comment 7117344329). Not covered: the PS5's own GPU (gfx1013) was not measured, only the RDNA2 iGPU. Other F16 compares are still missing from the table (`v_cmp_f/o/nlg/nle/tru_f16`, `v_cmpx_f/lg/o/u/nlg/tru_f16`); I left them out because no game log shows them yet. If you'd like this done differently, tell me and I'll change it. Written with Claude Code (AI): it decoded the words, measured the instruction on the GPU, wrote the change and the test, and ran them on my PC (Windows 11, RX 9070 XT and Ryzen 7600X iGPU).
Avatar: Frontiers of Pandora stops on a VOPC SDWA v_cmpx_nge_f16 with an
SGPR second operand (0x7df2d4f9 0x86060004, v4 against vcc_lo), because
the opcode is missing from the VOPC table. It shares the translation of
v_cmp_nge_f16 and, like the other compare-exec opcodes, writes EXEC only.

The new test runs the shader's own words and the VOP3 form with a negated
source. Its expected values were measured on RDNA2 hardware (gfx1036):
NaN operands compare unordered, the DWORD select reads the low half, and
VCC keeps its value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:22:16 +00:00
github manually merged commit 6d0b39de88 into gh-pr/2532/base 2026-11-26 10:22:18 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-24 02:12 UTC · original

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The decoder recognizes V_CMPX_NGE_F16 with encoding 0xf9 and classifies it as a floating-point compare that writes the execution mask. The translator routes it through the existing F16 unordered less-than comparison path. A compute test covers 14 inputs across SDWA and VOP3 forms, execution-mask settings, and comparison results. The test also checks that the SGPR pair retains its initial values.

Suggested reviewers: nmzik

Change: Bug fix

Merge Risk: Minimal · up to 4a302

This adds decoder and translator support for V_CMPX_NGE_F16, which a game's shader was missing and which stopped the decode. The new opcode reuses the existing compare path and has a dedicated test, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: adding decoder support for V_CMPX_NGE_F16 (VOPC opcode 0xf9). The changeset adds the enum value, the VOPC table entry, the float-compare and EXEC-writing classifications, t…
Description check Passed The description ties the change to a concrete failure (Avatar: Frontiers of Pandora CFG build stop on VOPC opcode 0xf9). It explains the missing table entry, the translation reused from V_CMP_NGE_F16,…
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: Title check

Explanation

The title names the change: adding decoder support for V_CMPX_NGE_F16 (VOPC opcode 0xf9). The changeset adds the enum value, the VOPC table entry, the float-compare and EXEC-writing classifications, the translation routing, and a test. The title is specific and concise, and it matches the primary change.

Full details: Description check

Explanation

The description ties the change to a concrete failure (Avatar: Frontiers of Pandora CFG build stop on VOPC opcode 0xf9). It explains the missing table entry, the translation reused from V_CMP_NGE_F16, the new test, and the validation performed. This relates directly to the changeset.

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4e90654506 and 4a3023c03b.

Files selected for processing: 4

  • src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h
  • src/graphics/shader/recompiler/frontend/decode/VectorAluOps.cpp
  • src/graphics/shader/recompiler/frontend/translate/Vector.cpp
  • tests/ShaderRecompilerComputeTests.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-24 02:12 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2532#issuecomment-7119876584) <!-- 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/2532?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 --> <!-- recent_review_status_start --> No actionable comments were generated in the recent review. <!-- recent_review_status_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> <br> The decoder recognizes `V_CMPX_NGE_F16` with encoding `0xf9` and classifies it as a floating-point compare that writes the execution mask. The translator routes it through the existing F16 unordered less-than comparison path. A compute test covers 14 inputs across SDWA and VOP3 forms, execution-mask settings, and comparison results. The test also checks that the SGPR pair retains its initial values. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"4a3023c03bbdca32aae2b4073209686342a320b4" --> <!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>4a302</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `4a302` --> <!-- final_review_risk_coverage:{"sourceCommitId":"4a3023c03bbdca32aae2b4073209686342a320b4","coveredCommitId":"4a3023c03bbdca32aae2b4073209686342a320b4","kind":"reviewed"} --> This adds decoder and translator support for V_CMPX_NGE_F16, which a game's shader was missing and which stopped the decode. The new opcode reuses the existing compare path and has a dedicated test, so merge risk is minimal. <!-- 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</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 names the change: adding decoder support for V_CMPX_NGE_F16 (VOPC opcode 0xf9). The changeset adds the enum value, the VOPC table entry, the float-compare and EXEC-writing classifications, t… | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description ties the change to a concrete failure (Avatar: Frontiers of Pandora CFG build stop on VOPC opcode 0xf9). It explains the missing table entry, the translation reused from V_CMP_NGE_F16,… | | 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: Title check</strong></summary> <dl> <dd> <br> **Explanation** The title names the change: adding decoder support for V_CMPX_NGE_F16 (VOPC opcode 0xf9). The changeset adds the enum value, the VOPC table entry, the float-compare and EXEC-writing classifications, the translation routing, and a test. The title is specific and concise, and it matches the primary change. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> <br> **Explanation** The description ties the change to a concrete failure (Avatar: Frontiers of Pandora CFG build stop on VOPC opcode 0xf9). It explains the missing table entry, the translation reused from V_CMP_NGE_F16, the new test, and the validation performed. This relates directly to the changeset. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2532)! 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 --> <!-- recent_review_start --> <h6> <details> <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary> <dl> <dd> <br> <!-- review_info_content --> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary> <dl> <dd> <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/4e90654506c8078649e2c1d22c763164406497da/.coderabbit.yaml>) - **Commit**: [4e90654](<https://github.com/KytyPS5/KytyPS5/commit/4e90654506c8078649e2c1d22c763164406497da>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `34455f65-1c97-4558-b4f5-a30c1d2ae135` </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 4e90654506c8078649e2c1d22c763164406497da and 4a3023c03bbdca32aae2b4073209686342a320b4. </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 4</strong></summary> <dl> <dd> <br> * `src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h` * `src/graphics/shader/recompiler/frontend/decode/VectorAluOps.cpp` * `src/graphics/shader/recompiler/frontend/translate/Vector.cpp` * `tests/ShaderRecompilerComputeTests.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> <!-- recent_review_end -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.