perf(shader): use fused legacy MAD on Apple #1304

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

@⁠carbonimax on GitHub · 2026-10-09 13:25 UTC · original
carbonimax:perf/apple-fused-legacy-mad → main · +72 −1 · 4 files · 2 commits · closed without merging

Legacy MAD currently emits NoContraction multiply and add operations. SPIRV-Cross lowers these to [[clang::optnone]] helpers in MSL, which can cause a substantial performance cost on Apple GPUs. See SPIRV-Cross #1999 and #2156.

Use one GLSL.std.450 Fma for legacy MAD by default on Apple. Other platforms keep separate multiply/add rounding. KYTY_MAD_SEPARATE_ROUNDING=1 restores the previous Apple policy; =0 selects fused MAD on either platform. Invalid values use the platform default. Explicit Fma, V_FMAC_F32, V_FMAMK_F32 and V_FMAAK_F32 keep their existing behavior.

This deliberately abandons separate legacy MAD rounding by default on Apple. Fused and separate results can differ. The default applies to all shaders on Apple, rather than to one driver version or application.

Testing

Validation on Apple M4 Pro under Rosetta, macOS 27.2, against 4c8fc53a8582543200caa697acad2a9f09937cec:

  • Release x86_64 build passes.
  • With only the CPU regression, the Apple default, =0 and invalid-value cases fail; =1 already passes. With the change all four pass in separate processes.
  • The test validates SPIR-V and checks FMul/FAdd, Fma and NoContraction counts, plus unchanged explicit Fma behavior. Its default expectation remains separate on non-Apple builds; that platform was not run locally.
  • Complete shader_cfg_tests, resource_tracking_tests, resource_materialization_tests and shader_vertex_metadata_tests suites pass.

In a prior measurement on an Apple M4 Pro under Rosetta with MoltenVK, a GPU-bound scene went from ~140 ms to ~75 ms per frame. This used a development MoltenVK build and one qualified run of the fused policy; these are mean frame-time equivalents calculated from FPS, not measured percentiles. The revisions differed and the cache was cold for the fused run. The result is historical motivation, not a new benchmark of this branch against upstream or a guarantee for stock MoltenVK.

Limits

No GPU was run for this PR preparation. CPU tests check emitted structure, not numerical execution or rendering equivalence on a GPU. Linux and Windows builds were not run locally. The explicit override restores the previous policy but does not remove the numerical risk of the new default.

AI assistance

This contribution was developed with the assistance of AI coding tools. They helped write the code, tests and this description, and ran the builds and tests reported above. The commit carries a Co-Authored-By trailer.

**@⁠carbonimax** on GitHub · 2026-10-09 13:25 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1304) `carbonimax:perf/apple-fused-legacy-mad` → `main` · +72 −1 · 4 files · 2 commits · closed without merging Legacy MAD currently emits `NoContraction` multiply and add operations. SPIRV-Cross lowers these to `[[clang::optnone]]` helpers in MSL, which can cause a substantial performance cost on Apple GPUs. See [SPIRV-Cross #1999](https://github.com/KhronosGroup/SPIRV-Cross/issues/1999) and [#2156](https://github.com/KhronosGroup/SPIRV-Cross/issues/2156). Use one GLSL.std.450 `Fma` for legacy MAD by default on Apple. Other platforms keep separate multiply/add rounding. `KYTY_MAD_SEPARATE_ROUNDING=1` restores the previous Apple policy; `=0` selects fused MAD on either platform. Invalid values use the platform default. Explicit Fma, `V_FMAC_F32`, `V_FMAMK_F32` and `V_FMAAK_F32` keep their existing behavior. **This deliberately abandons separate legacy MAD rounding by default on Apple.** Fused and separate results can differ. The default applies to all shaders on Apple, rather than to one driver version or application. ## Testing Validation on Apple M4 Pro under Rosetta, macOS 27.2, against `4c8fc53a8582543200caa697acad2a9f09937cec`: - Release x86_64 build passes. - With only the CPU regression, the Apple default, `=0` and invalid-value cases fail; `=1` already passes. With the change all four pass in separate processes. - The test validates SPIR-V and checks FMul/FAdd, Fma and NoContraction counts, plus unchanged explicit Fma behavior. Its default expectation remains separate on non-Apple builds; that platform was not run locally. - Complete `shader_cfg_tests`, `resource_tracking_tests`, `resource_materialization_tests` and `shader_vertex_metadata_tests` suites pass. In a prior measurement on an Apple M4 Pro under Rosetta with MoltenVK, a GPU-bound scene went from ~140 ms to ~75 ms per frame. This used a **development MoltenVK build** and one qualified run of the fused policy; these are mean frame-time equivalents calculated from FPS, not measured percentiles. The revisions differed and the cache was cold for the fused run. The result is historical motivation, not a new benchmark of this branch against upstream or a guarantee for stock MoltenVK. ## Limits No GPU was run for this PR preparation. CPU tests check emitted structure, not numerical execution or rendering equivalence on a GPU. Linux and Windows builds were not run locally. The explicit override restores the previous policy but does not remove the numerical risk of the new default. ## AI assistance This contribution was developed with the assistance of AI coding tools. They helped write the code, tests and this description, and ran the builds and tests reported above. The commit carries a `Co-Authored-By` trailer.
Separate legacy MAD emits NoContraction FMul and FAdd. SPIRV-Cross lowers
these to optnone helpers in MSL, which can substantially slow Apple GPU
execution (KhronosGroup/SPIRV-Cross issues #1999 and #2156).

Default to a single GLSL.std.450 Fma on Apple and keep separate rounding
elsewhere. KYTY_MAD_SEPARATE_ROUNDING=0/1 overrides the platform default;
invalid values fall back to it. Explicit Fma and the supported FMA opcodes
retain their existing behavior. Fusing legacy MAD changes its rounding,
so users needing the previous Apple policy can set the override to 1.

Keep the CPU SPIR-V regression and run each policy in a separate process.
Check operations, NoContraction decorations, SPIR-V validation, and the
unchanged explicit Fma path, including the non-Apple default expectation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Set the compute harness policy before its first shader emission so legacy
MAD rounding fixtures also work in direct runs on Apple. Register focused
GPU and SPIR-V cases, and pass independent rounding expectations from CTest
instead of duplicating the emitter's environment parsing in the CFG test.

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

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-10-09 13:25 UTC · original · edited 2026-10-09 13:29 UTC

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T13:29:40.724885Z 424e1c4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-10-09 13:25 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1304#issuecomment-6081811169) · edited 2026-10-09 13:29 UTC <!-- codex-pull-request-review-summary --> ## Codex Review Summary This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-10-09T13:29:40.724885Z">2026-10-09T13:29:40.724885Z</relative-time> | `424e1c4` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details>
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 13:29 UTC · original · edited 2026-10-09 14:39 UTC

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 095cabb3-9e06-4d1e-92b9-5919a5668014

📥 Commits

Reviewing files that changed from the base of the PR and between 424e1c485c and 14973312ee.


📒 Files selected for processing (3)
  • CMakeLists.txt
  • 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; 7 remain after this review.



📝 Walkthrough

Walkthrough

The SPIR-V emitter now selects MAD rounding behavior from KYTY_MAD_SEPARATE_ROUNDING, with platform-specific defaults for unset or invalid values. When separate rounding is disabled, FPMad32 emits a GLSL FMA; otherwise, it uses separate multiply and add operations. Focused tests check the emitted instructions and explicit FPFma32 behavior. CTest registers configuration cases and compute-test modes, including compilation of a MAD shader without a Vulkan harness.

Suggested reviewers: nmzik


Priority: ➖ Normal

Change: Other

Merge Risk: ⚪ Minimal · up to 14973

The focused tests check the fused and separate modes against matching policy settings. No concrete merge-blocking behavior is established in the reviewed changes.

🚥 Pre-merge checks | ✅ 4 | ❓ 1

❌ 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. Analyzed 4 functions across 1 files. (3 skipped: 1… 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: using fused legacy MAD on Apple for shader performance.
Description check Passed The description directly explains the fused MAD policy, platform defaults, environment override, preserved behavior, 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 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. (3 skipped: 1 unsupported, 2 too large.)



  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 13:29 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1304#issuecomment-6081892258) · edited 2026-10-09 14:39 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1304?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**: `095cabb3-9e06-4d1e-92b9-5919a5668014` <hr> </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 424e1c485c4960c5422b9f6588b27f8202ca9278 and 14973312ee1dce746a3b91d9be128672e4007ee0. <hr> </details> <details> <summary>📒 Files selected for processing (3)</summary> * `CMakeLists.txt` * `tests/ShaderRecompilerComputeTests.cpp` * `tests/shaderCfgTests.cpp` <hr> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. <hr> </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough The SPIR-V emitter now selects MAD rounding behavior from `KYTY_MAD_SEPARATE_ROUNDING`, with platform-specific defaults for unset or invalid values. When separate rounding is disabled, `FPMad32` emits a GLSL FMA; otherwise, it uses separate multiply and add operations. Focused tests check the emitted instructions and explicit `FPFma32` behavior. CTest registers configuration cases and compute-test modes, including compilation of a MAD shader without a Vulkan harness. **Suggested reviewers:** `nmzik` <hr> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"14973312ee1dce746a3b91d9be128672e4007ee0" --> **Change:** Other <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **⚪ Minimal** · up to `14973` <!-- final_review_risk_coverage:{"sourceCommitId":"14973312ee1dce746a3b91d9be128672e4007ee0","coveredCommitId":"14973312ee1dce746a3b91d9be128672e4007ee0","kind":"reviewed"} --> The focused tests check the fused and separate modes against matching policy settings. No concrete merge-blocking behavior is established in the reviewed changes. <!-- 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](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. Analyzed 4 functions across 1 files. (3 skipped: 1… | 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](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely identifies the main change: using fused legacy MAD on Apple for shader performance. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description directly explains the fused MAD policy, platform defaults, environment override, preserved behavior, and test coverage. | | 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. | <hr> </details> <details> <summary>Full details: Docstring Coverage</summary> **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. Analyzed 4 functions across 1 files. (3 skipped: 1 unsupported, 2 too large.) <hr> </details> <hr> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1304)! 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) <hr> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-10-09 13:29 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 424e1c485c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-10-09 13:29 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1304#pullrequestreview-5470702535) · **reviewed** ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `424e1c485c` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
@ -109,2 +126,4 @@
uint32_t EmitFPMad32(EmitterState& state, uint32_t a, uint32_t b, uint32_t c) {
if (!MadSeparateRounding()) {
return EmitGlsl<GLSLstd450Fma, IR::Type::F32>(state, a, b, c);
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-10-09 13:29 UTC · original

P2 Badge Align the existing MAD GPU case with the Apple policy

When KYTY_MAD_SEPARATE_ROUNDING is unset or invalid on Apple, this branch replaces every legacy MAD in VectorMadF32RoundsProduct with Fma, but that registered compute case still requires OpFMul and OpFAdd and expects its five legacy results to be zero (tests/ShaderRecompilerComputeTests.cpp:24710-24717; invoked by shader_recompiler_compute in CMakeLists.txt:643). A default Apple run therefore fails in CheckSpirvText before dispatch, and its numerical expectations are also stale; make the case policy-aware or run its legacy assertions with KYTY_MAD_SEPARATE_ROUNDING=1.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-10-09 13:29 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1304#discussion_r4230625059) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Align the existing MAD GPU case with the Apple policy** When `KYTY_MAD_SEPARATE_ROUNDING` is unset or invalid on Apple, this branch replaces every legacy MAD in `VectorMadF32RoundsProduct` with `Fma`, but that registered compute case still requires `OpFMul` and `OpFAdd` and expects its five legacy results to be zero (`tests/ShaderRecompilerComputeTests.cpp:24710-24717`; invoked by `shader_recompiler_compute` in `CMakeLists.txt:643`). A default Apple run therefore fails in `CheckSpirvText` before dispatch, and its numerical expectations are also stale; make the case policy-aware or run its legacy assertions with `KYTY_MAD_SEPARATE_ROUNDING=1`. Useful? React with 👍 / 👎.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 13:29 UTC · original · reviewed

🧹 Nitpick comments (1)
tests/shaderCfgTests.cpp (1)

15014-15026: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The test duplicates the policy parsing in the emitter.

The test re-implements the parsing of KYTY_MAD_SEPARATE_ROUNDING. It uses std::strcmp against "0" and "1". The emitter accepts only an exact one-character 0 or 1, so the two currently agree.

The copy can drift from the emitter. If the emitter changes its accepted values, the test can compute the wrong expectation. The test would then assert the wrong behavior.

This is a low-value concern. Keep the copy if you want the test to be independent of the emitter. Otherwise, expose the policy function for tests.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fb904379-97ea-4a88-ba6a-fe492f15cc99
📥 Commits

Reviewing files that changed from the base of the PR and between 4c8fc53a85 and 424e1c485c.

📒 Files selected for processing (3)
  • CMakeLists.txt
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterAlu.cpp
  • tests/shaderCfgTests.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 13:29 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1304#pullrequestreview-5470703271) · **reviewed** <details> <summary>🧹 Nitpick comments (1)</summary><blockquote> <details> <summary>tests/shaderCfgTests.cpp (1)</summary><blockquote> `15014-15026`: **📐 Maintainability & Code Quality** | **🔵 Trivial** | **💤 Low value** **The test duplicates the policy parsing in the emitter.** The test re-implements the parsing of `KYTY_MAD_SEPARATE_ROUNDING`. It uses `std::strcmp` against "0" and "1". The emitter accepts only an exact one-character `0` or `1`, so the two currently agree. The copy can drift from the emitter. If the emitter changes its accepted values, the test can compute the wrong expectation. The test would then assert the wrong behavior. This is a low-value concern. Keep the copy if you want the test to be independent of the emitter. Otherwise, expose the policy function for tests. <!-- cr-comment:v1:10d0467cb2e76873d62603d5 --> </blockquote></details> </blockquote></details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `fb904379-97ea-4a88-ba6a-fe492f15cc99` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 4c8fc53a8582543200caa697acad2a9f09937cec and 424e1c485c4960c5422b9f6588b27f8202ca9278. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `CMakeLists.txt` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterAlu.cpp` * `tests/shaderCfgTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=8be49b2c-0913-4555-bf73-06f37be18bc9 attempt=910437cd-d093-4fe8-8a95-931eea84b3de batch=1/1 -->
@ -109,2 +126,4 @@
uint32_t EmitFPMad32(EmitterState& state, uint32_t a, uint32_t b, uint32_t c) {
if (!MadSeparateRounding()) {
return EmitGlsl<GLSLstd450Fma, IR::Type::F32>(state, a, b, c);
Author
Owner

@⁠carbonimax on GitHub · 2026-10-09 14:33 UTC · original

Fixed in 14973312ee: the compute harness forces KYTY_MAD_SEPARATE_ROUNDING=1 before initialization, preserving this fixture's separate-rounding contract in direct runs and CTest. The same fixture's SPIR-V check fails before the fix and passes after it; 9 CPU tests pass. GPU attempts are blocked before the case by MoltenVK device requirements, so numerical GPU behavior remains unvalidated.

**@⁠carbonimax** on GitHub · 2026-10-09 14:33 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1304#discussion_r4231243277) Fixed in 14973312ee1dce746a3b91d9be128672e4007ee0: the compute harness forces KYTY_MAD_SEPARATE_ROUNDING=1 before initialization, preserving this fixture's separate-rounding contract in direct runs and CTest. The same fixture's SPIR-V check fails before the fix and passes after it; 9 CPU tests pass. GPU attempts are blocked before the case by MoltenVK device requirements, so numerical GPU behavior remains unvalidated.
Author
Owner

@⁠carbonimax on GitHub · 2026-10-09 14:33 UTC · original

@⁠coderabbitai Addressed in 14973312ee: CTest now supplies explicit fused/separate expectations to the CFG test; it no longer parses KYTY_MAD_SEPARATE_ROUNDING. All four policy cases pass, and an incorrect expectation still fails.

**@⁠carbonimax** on GitHub · 2026-10-09 14:33 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1304#issuecomment-6083019043) @⁠coderabbitai Addressed in 14973312ee1dce746a3b91d9be128672e4007ee0: CTest now supplies explicit fused/separate expectations to the CFG test; it no longer parses KYTY_MAD_SEPARATE_ROUNDING. All four policy cases pass, and an incorrect expectation still fails.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 14:40 UTC · original

Tip

For best results, initiate chat on the files or code changes.

@carbonimax Thanks for the fix. Explicit CTest expectations remove the duplicated environment parsing from the CFG test. The reported incorrect-expectation failure confirms that the test can detect a policy mismatch.


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

Thank you for using CodeRabbit!

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 14:40 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1304#issuecomment-6083153712) <!-- This is an auto-generated reply by CodeRabbit --> > [!TIP] > For best results, initiate chat on the files or code changes. `@carbonimax` Thanks for the fix. Explicit CTest expectations remove the duplicated environment parsing from the CFG test. The reported incorrect-expectation failure confirms that the test can detect a policy mismatch. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=CTest%20now%20verifies%20explicit%20fused%2Fseparate%20CFG%20expectations%E2%80%94not%20environment%20parsing.%20All%204%20policy%20cases%20pass%2C%20and%20wrong%20expectations%20fail.%20Try%20%40coderabbitai%20for%20sharper%20code%20reviews!%20%F0%9F%A7%AA&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1304)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> _You are interacting with an AI system._
Author
Owner

@⁠carbonimax on GitHub · 2026-10-10 21:17 UTC · original

Hi, was this closed for the AI policy?
For context: on Apple GPUs, the NoContraction FMul/FAdd path makes MoltenVK emit non-optimizable helpers, which made one scene about 1.85× slower in our tests; this restores a single Fma on Apple only, with an env override. The patch was written by AI agents (Claude and Codex) and tested on my M4 Pro; I reviewed it. Happy to resubmit with an AI disclosure section.

**@⁠carbonimax** on GitHub · 2026-10-10 21:17 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1304#issuecomment-6102270873) Hi, was this closed for the AI policy? For context: on Apple GPUs, the NoContraction FMul/FAdd path makes MoltenVK emit non-optimizable helpers, which made one scene about 1.85× slower in our tests; this restores a single Fma on Apple only, with an env override. The patch was written by AI agents (Claude and Codex) and tested on my M4 Pro; I reviewed it. Happy to resubmit with an AI disclosure section.

Pull request closed

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