shader: elect a non-helper lane for DS_APPEND and DS_CONSUME in pixel shaders #1881

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

@⁠Nawid3333 on GitHub · 2026-10-24 16:35 UTC · original
Nawid3333:fix/ds-append-helper → main · +147 −2 · 6 files · 2 commits · closed without merging

ASTRO BOT (PPSA21564) loses the device while loading on NVIDIA (#1511): CS 0x657ad04626bf9d55 does not leave the loop that walks the per-pixel lists built by PS 0x4a55033774c8f01e. @⁠ZrDaniel07 tested the src/ change of this PR on an RTX 5090 (Windows 11, driver 617.42, no game patch; #1511). His control was an earlier diagnostic build of mine with all its switches off, so the two builds also differ by 20 upstream commits:

Build (RTX 5090) Runs DEVICE_LOST
babec5b = main 79837b42 + #1365 (control) 2 2
de0e387 = main 6aaa5332 + #1365 + this change 2 0

In both de0e387 runs the builder, CS 0x657ad04626bf9d55 and PS 0x5457609506174517 were compiled, and the second run got as far as loading a level. With #838 and a local fix for the oversized mesh draw from #624 added as well, he got into gameplay in the Garden level (#1511).

Rebased on 8291cfeb, the change kept the same git patch-id; after that I removed a lane_count == 2 branch from it that cannot run in pixel shaders (see below). The exact head of this PR has not run in the game, and I have not run the game on 8291cfeb, which also has bdf48dcf (faulting SRT walker loads).

What is wrong

Pixel shaders start with the guest EXEC = true (Translate.cpp), so on a host that keeps helper invocations active in subgroup operations, the EXEC ballot contains the quad's helpers. Vulkan allows that without MaximallyReconvergesKHR, and it differs by driver (#1574). EmitAppendConsume lets the first lane of that ballot do the one OpAtomicIAdd/OpAtomicISub for the wave and broadcasts its result. If that lane is a helper, the atomic has no effect on the GDS buffer and its result is undefined (Vulkan: "Stores and atomics performed by helper invocations must not have any effect on memory except for the Function, Private and Output storage classes, and values returned by atomic instructions in helper invocations are undefined."). The counter is not advanced, and every lane of the wave gets the same undefined base.

The builder takes its node indices from a DS_APPEND on a GDS counter and adds each lane's v_mbcnt rank. My explanation of the hang is that waves then get overlapping node indices and a list ends up with a cycle; I have not dumped the lists to confirm the cycle. The evidence is the 2/2 → 0/2 above. The builder has no derivative or implicit-LOD sample. In the test below, a shader like that (it also reads an interpolant) gets no helpers in the ballot on the RX 9070 XT. On RADV, @⁠NeySlim measured in #1574 that one interpolated input is enough to put the helpers in, and the builder reads interpolants; I have not tried RADV.

What changes

In pixel shaders, the lane that performs the atomic is now the first lane of ballot(EXEC) & ballot(!HelperInvocation). gl_HelperInvocation is declared only for pixel shaders that use DS_APPEND or DS_CONSUME. In pixel shaders the emitter has one guest lane per invocation (lane_count is 2 only for compute and mesh), so the host ballot already has the guest layout. If no live lane is in EXEC, the elected lane is 0, and the atomic still requires that lane's own EXEC bit, so nothing reaches memory, as on main.

The count added is unchanged: the bits in the EXEC ballot, because the guest ranks lanes with v_mbcnt over the same EXEC. So helper lanes in EXEC still take slots, as on main whenever it elected a live lane. Those slots are never written, so an append buffer can have holes, and on hosts that count helpers a quad with one covered pixel can use up to 4 slots; for DS_CONSUME, slots taken by helpers are consumed but not processed. Whether helpers are counted depends on the driver. The wider question in #1574 (helpers inside the guest EXEC) stays open; this change does not touch it. DS_ORDERED_COUNT also elects the first lane of EXEC (Memory.cpp) and is not changed here.

Prior work: #761 (@⁠carbonimax) excludes fragment helpers from the guest ballots and from the internal lane-activity ballot, and has a GDS fragment test, GraphicsDsAppendHelperQuad; the GDS binding for graphics cases here follows the same idea. DeathWhispers traced an ASTRO BOT device loss to helper lanes in EXEC (Death-Whispers-U/KytyPS5@646753963a, see #1574).

Tests

  • GraphicsDsAppendSkipsHelperLanes (--ds-append-helper-only): a 2x1 target where only pixel 1 is covered, so the rest of its quad can run as helpers. It runs ds_append twice on a GDS counter that starts at 10 (M0 = 0x100) and exports the first base and base2 - base1 - s_bcnt1(exec). Expected (10.0, 0.0): the first append returns 10, and the second returns 10 + the lanes in EXEC, so the first add was applied with the EXEC count. This holds whether or not the host counts helpers in EXEC. Like the builder, the shader reads an interpolant. Graphics cases can now bind GDS for this (GraphicsCase::gds_initial), and the harness enables fragmentStoresAndAtomics for graphics cases, as the emulator does.
  • As committed, the case passes on main on both GPUs I have, an RX 9070 XT (driver 26.8.1, LLPC) and the Ryzen 7600X iGPU: on the RX 9070 XT the helpers stay out of the ballot unless the shader needs WQM (a derivative or an implicit-LOD sample), and the interpolant alone does not change that; the iGPU keeps them out even then. With an OpDPdx added by hand to the dumped fragment SPIR-V (not part of this PR; its result goes into a select that is never true), the RX 9070 XT puts all four lanes of the quad into EXEC, and main fails in two separate runs: pixel 1 gets (0.0, -4.0) instead of (10.0, 0.0), consistent with the elected helper's add being dropped and both appends returning 0. With this change the case passes with and without the OpDPdx on both GPUs. The harness skips rasterization cases on these drivers (no attachmentFeedbackLoopDynamicState), so I ran them with a local switch that makes it optional, as vulkanWindow.cpp does.
  • The rest of the shader suite gives the same results with and without this change on both GPUs: the compute cases with native and 32-wide host subgroups, and the graphics cases (validation layer on for the new case, no messages).
  • The 13 ctest programs the Windows CI job runs pass locally on Windows, and shader_cfg_tests passes.
  • Fork CI: https://github.com/Nawid3333/KytyPS5/actions/runs/40107006030. Windows and Linux pass. macOS fails scalar_provenance, resource_materialization and resource_tracking with a SegFault, the same three as main 8291cfeb (https://github.com/KytyPS5/KytyPS5/actions/runs/40076044366); 6aaa5332 still passed them.

Not tested: DS_CONSUME (no case; the builder uses DS_APPEND), the case on NVIDIA, the exact head of this PR in the game, and ASTRO BOT on AMD with this change without the lab loop cap. @⁠ZrDaniel07, if you build this branch, shader_recompiler_compute_tests --ds-append-helper-only on main and on this branch would show whether the RTX 5090 puts the helpers into the ballot here, and ASTRO BOT runs with this branch and with main 8291cfeb (+ #1365, if it still needs it) would test the exact head against a control on the same base.

AI use: Claude Code wrote this change and the test with me and traced the ASTRO BOT shaders; I reviewed the diff and the test results.

🤖 Generated with Claude Code

**@⁠Nawid3333** on GitHub · 2026-10-24 16:35 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881) `Nawid3333:fix/ds-append-helper` → `main` · +147 −2 · 6 files · 2 commits · closed without merging ASTRO BOT (PPSA21564) loses the device while loading on NVIDIA (#1511): `CS 0x657ad04626bf9d55` does not leave the loop that walks the per-pixel lists built by `PS 0x4a55033774c8f01e`. @⁠ZrDaniel07 tested the `src/` change of this PR on an RTX 5090 (Windows 11, driver 617.42, no game patch; https://git.gtahub.st/github/KytyPS5--KytyPS5/issues/1511). His control was an earlier diagnostic build of mine with all its switches off, so the two builds also differ by 20 upstream commits: | Build (RTX 5090) | Runs | DEVICE_LOST | |---|---|---| | `babec5b` = `main` 79837b42 + #1365 (control) | 2 | 2 | | `de0e387` = `main` 6aaa5332 + #1365 + this change | 2 | 0 | In both `de0e387` runs the builder, `CS 0x657ad04626bf9d55` and `PS 0x5457609506174517` were compiled, and the second run got as far as loading a level. With #838 and a local fix for the oversized mesh draw from #624 added as well, he got into gameplay in the Garden level (https://git.gtahub.st/github/KytyPS5--KytyPS5/issues/1511). Rebased on 8291cfeb, the change kept the same `git patch-id`; after that I removed a `lane_count == 2` branch from it that cannot run in pixel shaders (see below). The exact head of this PR has not run in the game, and I have not run the game on 8291cfeb, which also has bdf48dcf (faulting SRT walker loads). **What is wrong** Pixel shaders start with the guest EXEC = true (`Translate.cpp`), so on a host that keeps helper invocations active in subgroup operations, the EXEC ballot contains the quad's helpers. Vulkan allows that without `MaximallyReconvergesKHR`, and it differs by driver (#1574). `EmitAppendConsume` lets the first lane of that ballot do the one `OpAtomicIAdd`/`OpAtomicISub` for the wave and broadcasts its result. If that lane is a helper, the atomic has no effect on the GDS buffer and its result is undefined (Vulkan: "Stores and atomics performed by helper invocations must not have any effect on memory except for the Function, Private and Output storage classes, and values returned by atomic instructions in helper invocations are undefined."). The counter is not advanced, and every lane of the wave gets the same undefined base. The builder takes its node indices from a `DS_APPEND` on a GDS counter and adds each lane's `v_mbcnt` rank. My explanation of the hang is that waves then get overlapping node indices and a list ends up with a cycle; I have not dumped the lists to confirm the cycle. The evidence is the 2/2 → 0/2 above. The builder has no derivative or implicit-LOD sample. In the test below, a shader like that (it also reads an interpolant) gets no helpers in the ballot on the RX 9070 XT. On RADV, @⁠NeySlim measured in #1574 that one interpolated input is enough to put the helpers in, and the builder reads interpolants; I have not tried RADV. **What changes** In pixel shaders, the lane that performs the atomic is now the first lane of `ballot(EXEC) & ballot(!HelperInvocation)`. `gl_HelperInvocation` is declared only for pixel shaders that use `DS_APPEND` or `DS_CONSUME`. In pixel shaders the emitter has one guest lane per invocation (`lane_count` is 2 only for compute and mesh), so the host ballot already has the guest layout. If no live lane is in EXEC, the elected lane is 0, and the atomic still requires that lane's own EXEC bit, so nothing reaches memory, as on `main`. The count added is unchanged: the bits in the EXEC ballot, because the guest ranks lanes with `v_mbcnt` over the same EXEC. So helper lanes in EXEC still take slots, as on `main` whenever it elected a live lane. Those slots are never written, so an append buffer can have holes, and on hosts that count helpers a quad with one covered pixel can use up to 4 slots; for `DS_CONSUME`, slots taken by helpers are consumed but not processed. Whether helpers are counted depends on the driver. The wider question in #1574 (helpers inside the guest EXEC) stays open; this change does not touch it. `DS_ORDERED_COUNT` also elects the first lane of EXEC (`Memory.cpp`) and is not changed here. Prior work: #761 (@⁠carbonimax) excludes fragment helpers from the guest ballots and from the internal lane-activity ballot, and has a GDS fragment test, `GraphicsDsAppendHelperQuad`; the GDS binding for graphics cases here follows the same idea. DeathWhispers traced an ASTRO BOT device loss to helper lanes in EXEC (Death-Whispers-U/KytyPS5@646753963a, see #1574). **Tests** - `GraphicsDsAppendSkipsHelperLanes` (`--ds-append-helper-only`): a 2x1 target where only pixel 1 is covered, so the rest of its quad can run as helpers. It runs `ds_append` twice on a GDS counter that starts at 10 (M0 = 0x100) and exports the first base and `base2 - base1 - s_bcnt1(exec)`. Expected (10.0, 0.0): the first append returns 10, and the second returns 10 + the lanes in EXEC, so the first add was applied with the EXEC count. This holds whether or not the host counts helpers in EXEC. Like the builder, the shader reads an interpolant. Graphics cases can now bind GDS for this (`GraphicsCase::gds_initial`), and the harness enables `fragmentStoresAndAtomics` for graphics cases, as the emulator does. - As committed, the case passes on `main` on both GPUs I have, an RX 9070 XT (driver 26.8.1, LLPC) and the Ryzen 7600X iGPU: on the RX 9070 XT the helpers stay out of the ballot unless the shader needs WQM (a derivative or an implicit-LOD sample), and the interpolant alone does not change that; the iGPU keeps them out even then. With an `OpDPdx` added by hand to the dumped fragment SPIR-V (not part of this PR; its result goes into a select that is never true), the RX 9070 XT puts all four lanes of the quad into EXEC, and `main` fails in two separate runs: pixel 1 gets (0.0, -4.0) instead of (10.0, 0.0), consistent with the elected helper's add being dropped and both appends returning 0. With this change the case passes with and without the `OpDPdx` on both GPUs. The harness skips rasterization cases on these drivers (no `attachmentFeedbackLoopDynamicState`), so I ran them with a local switch that makes it optional, as `vulkanWindow.cpp` does. - The rest of the shader suite gives the same results with and without this change on both GPUs: the compute cases with native and 32-wide host subgroups, and the graphics cases (validation layer on for the new case, no messages). - The 13 ctest programs the Windows CI job runs pass locally on Windows, and `shader_cfg_tests` passes. - Fork CI: https://github.com/Nawid3333/KytyPS5/actions/runs/40107006030. Windows and Linux pass. macOS fails `scalar_provenance`, `resource_materialization` and `resource_tracking` with a SegFault, the same three as `main` 8291cfeb (https://github.com/KytyPS5/KytyPS5/actions/runs/40076044366); 6aaa5332 still passed them. Not tested: `DS_CONSUME` (no case; the builder uses `DS_APPEND`), the case on NVIDIA, the exact head of this PR in the game, and ASTRO BOT on AMD with this change without the lab loop cap. @⁠ZrDaniel07, if you build this branch, `shader_recompiler_compute_tests --ds-append-helper-only` on `main` and on this branch would show whether the RTX 5090 puts the helpers into the ballot here, and ASTRO BOT runs with this branch and with `main` 8291cfeb (+ #1365, if it still needs it) would test the exact head against a control on the same base. AI use: Claude Code wrote this change and the test with me and traced the ASTRO BOT shaders; I reviewed the diff and the test results. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Helper invocations do not perform atomics and return undefined values. The guest EXEC
of a pixel shader includes the host's helper invocations, so the lane that adds the
wave's count could be a helper: the counter was not advanced and every lane got an
undefined base.

GraphicsDsAppendSkipsHelperLanes (--ds-append-helper-only) covers it: graphics cases
can now bind GDS, and the harness enables fragmentStoresAndAtomics for them, as the
emulator does.

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

@⁠coderabbitai[bot] on GitHub · 2026-10-24 16:45 UTC · original · edited 2026-10-24 17:15 UTC

Review in Change Stack →

Walkthrough

Pixel shaders that use shared append or consume operations now collect helper-invocation metadata. The SPIR-V emitter uses that metadata to exclude helper lanes when selecting a lane for the atomic operation. The graphics test harness adds fragment-stage GDS support and append and consume test cases. Rasterization capability detection and device creation now account for fragmentStoresAndAtomics.

Suggested reviewers: nmzik

Priority: Normal

Change: Bug fix

Merge Risk: Low · up to f3396

The change remains mergeable, but the regression test should include derivative-backed coverage so helper-lane election failures cannot pass unnoticed on some hosts.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 5 files. (1 skipped: 1… 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 and concisely describes the main change: electing a non-helper lane for DS_APPEND and DS_CONSUME in pixel shaders.
Description check Passed The description directly explains the bug, implementation, scope, test coverage, and known limitations for the changeset.
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 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 5 files. (1 skipped: 1 too large.)

Resolution

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

  • 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-24 16:45 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#issuecomment-6386855214) · edited 2026-10-24 17:15 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/1881?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-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> Pixel shaders that use shared append or consume operations now collect helper-invocation metadata. The SPIR-V emitter uses that metadata to exclude helper lanes when selecting a lane for the atomic operation. The graphics test harness adds fragment-stage GDS support and append and consume test cases. Rasterization capability detection and device creation now account for `fragmentStoresAndAtomics`. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <strong>Priority: <picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/priority-normal-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Normal</strong> <!-- change_assessment_commit:"f3396e9493eef098e9e5304394569522a33d3d5d" --> **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-low-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Low</strong> · up to <code>f3396</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🔵 Low** · up to `f3396` --> <!-- final_review_risk_coverage:{"sourceCommitId":"f3396e9493eef098e9e5304394569522a33d3d5d","coveredCommitId":"f3396e9493eef098e9e5304394569522a33d3d5d","kind":"reviewed"} --> The change remains mergeable, but the regression test should include derivative-backed coverage so helper-lane election failures cannot pass unnoticed on some hosts. <!-- 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> <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 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 5 files. (1 skipped: 1… | 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> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely describes the main change: electing a non-helper lane for DS_APPEND and DS_CONSUME in pixel shaders. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description directly explains the bug, implementation, scope, test coverage, and known limitations for the changeset. | | 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> **Explanation** Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 5 files. (1 skipped: 1 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 --> <!-- 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=1881)! 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> - [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> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -21372,6 +21437,7 @@ private:
available_features.drawIndirectFirstInstance &&
available_features.multiDrawIndirect &&
available_features.depthBounds &&
available_features.fragmentStoresAndAtomics &&
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-24 16:45 UTC · original · edited 2026-10-24 16:56 UTC

Major · Functional Correctness · Quick win

Do not disable all graphics tests when fragment atomics are unavailable.

fragmentStoresAndAtomics is the feature needed for fragment-stage storage-buffer writes and atomics. Making it a condition of m_rasterization_supported also skips graphics cases that do not use GDS on a device without that feature. Track fragment-atomic support separately, and gate only cases that need it. (docs.vulkan.org)

**@⁠coderabbitai[bot]** on GitHub · 2026-10-24 16:45 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#discussion_r4367776840) · edited 2026-10-24 16:56 UTC <!-- 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** **Do not disable all graphics tests when fragment atomics are unavailable.** `fragmentStoresAndAtomics` is the feature needed for fragment-stage storage-buffer writes and atomics. Making it a condition of `m_rasterization_supported` also skips graphics cases that do not use GDS on a device without that feature. Track fragment-atomic support separately, and gate only cases that need it. ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/chapters/features.html?utm_source=openai)) <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:1350c04ddd9420d1193b7f9a --> <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-24 16:45 UTC · original · reviewed

Actionable comments posted: 1

🧹 Nitpick comments: 1
tests/ShaderRecompilerComputeTests.cpp: 1

43733-43735: Trivial · Functional Correctness · Quick win

Assert the final GDS counter.

GraphicsDsAppendSkipsHelperLanes initializes GDS at 10 and executes two DS_APPEND operations. RenderFragment returns only image data and destroys gds_buffer without reading it back. An extra append whose result is not exported can therefore leave the test passing with an incorrect final GDS counter.

Add an expected final GDS value to GraphicsCase, read back gds_buffer before destroying it, and compare that value for this case. This is a test-coverage improvement, not an existing production failure.


Review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 8291cfeb04 and c076fa5872.

Files selected for processing: 6
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp
  • src/graphics/shader/recompiler/ir/ShaderIR.h
  • src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp
  • tests/ShaderRecompilerComputeTests.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.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-24 16:45 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#pullrequestreview-5639012341) · **reviewed** <!-- coderabbit-ai-generated:v1 --> **Actionable comments posted: 1** <details> <summary>🧹 Nitpick comments: 1</summary><blockquote> <dl> <dd> <details> <summary>tests/ShaderRecompilerComputeTests.cpp: 1</summary><blockquote> <dl> <dd> `43733-43735`: **<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 final GDS counter.** `GraphicsDsAppendSkipsHelperLanes` initializes GDS at `10` and executes two `DS_APPEND` operations. `RenderFragment` returns only image data and destroys `gds_buffer` without reading it back. An extra append whose result is not exported can therefore leave the test passing with an incorrect final GDS counter. Add an expected final GDS value to `GraphicsCase`, read back `gds_buffer` before destroying it, and compare that value for this case. This is a test-coverage improvement, not an existing production failure. <!-- cr-comment:v1:f08b1739a6713e720beb4ef4 --> </dd> </dl> </blockquote></details> </dd> </dl> </blockquote></details> --- <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="16" height="16" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <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> - **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/8291cfeb04237a5e36f5d377e620cd0e6acd5805/.coderabbit.yaml>) - **Commit**: [8291cfe](<https://github.com/KytyPS5/KytyPS5/commit/8291cfeb04237a5e36f5d377e620cd0e6acd5805>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `4044cf99-1f58-4dc1-a6ed-d65a85bad2bb` </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> Reviewing files that changed from the base of the PR and between 8291cfeb04237a5e36f5d377e620cd0e6acd5805 and c076fa587235756e5f9ef35afda5ab0bab9ee96b. </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: 6</summary> <dl> <dd> * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp` * `src/graphics/shader/recompiler/ir/ShaderIR.h` * `src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp` * `tests/ShaderRecompilerComputeTests.cpp` </dd> </dl> </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. </dd> </dl> </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=89a49899-8fbd-4073-9460-c1299ff07965 attempt=dd5014c9-2860-4953-857a-e808ca4f95f9 batch=1/1 -->
@ -21372,6 +21437,7 @@ private:
available_features.drawIndirectFirstInstance &&
available_features.multiDrawIndirect &&
available_features.depthBounds &&
available_features.fragmentStoresAndAtomics &&
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-24 16:56 UTC · original

The emulator itself requires fragmentStoresAndAtomics: vulkanWindow.cpp rejects a device without it (check_feature(device_features2.features.fragmentStoresAndAtomics, ...)) and enables it. So a device that lacks it cannot run Kyty, and m_rasterization_supported already stands for the features the production renderer needs. Gating only the GDS case would add code for a device the emulator does not start on, so I'd keep it as it is.

**@⁠Nawid3333** on GitHub · 2026-10-24 16:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#discussion_r4367809777) The emulator itself requires `fragmentStoresAndAtomics`: `vulkanWindow.cpp` rejects a device without it (`check_feature(device_features2.features.fragmentStoresAndAtomics, ...)`) and enables it. So a device that lacks it cannot run Kyty, and `m_rasterization_supported` already stands for the features the production renderer needs. Gating only the GDS case would add code for a device the emulator does not start on, so I'd keep it as it is.
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-24 16:56 UTC · original

@⁠coderabbitai On the nitpick about reading back the final GDS counter in GraphicsDsAppendSkipsHelperLanes: the final value is 10 + 2 × the lanes in EXEC, and that lane count depends on the host (1 when the helpers stay out of the ballot, 4 when they are in), so a fixed expected value would fail on one of them. The case checks the add through the second append's return value instead (base2 - base1 - s_bcnt1(exec) = 0), and both appends go through the same lane election.

**@⁠Nawid3333** on GitHub · 2026-10-24 16:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#issuecomment-6386975810) @⁠coderabbitai On the nitpick about reading back the final GDS counter in `GraphicsDsAppendSkipsHelperLanes`: the final value is 10 + 2 × the lanes in EXEC, and that lane count depends on the host (1 when the helpers stay out of the ballot, 4 when they are in), so a fixed expected value would fail on one of them. The case checks the add through the second append's return value instead (`base2 - base1 - s_bcnt1(exec)` = 0), and both appends go through the same lane election.
@ -21372,6 +21437,7 @@ private:
available_features.drawIndirectFirstInstance &&
available_features.multiDrawIndirect &&
available_features.depthBounds &&
available_features.fragmentStoresAndAtomics &&
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-24 16:57 UTC · original

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
fd -t f '^vulkanWindow\.cpp$' --exec rg -n -C 5 'fragmentStoresAndAtomics' {}
rg -n -C 10 'available_features\.fragmentStoresAndAtomics|fragmentStoresAndAtomics =|m_rasterization_supported =' tests/ShaderRecompilerComputeTests.cpp

Length of output: 6060


@Nawid3333 You're right. I verified that vulkanWindow.cpp checks and enables fragmentStoresAndAtomics. The harness also labels this gate ProductionRasterization.

Keeping the feature in m_rasterization_supported matches that production baseline. A separate gate for GDS cases is not needed here. I withdraw this finding.


✏️ Learnings added
Learnt from: Nawid3333
Repo: KytyPS5/KytyPS5 PR: 1881
File: tests/ShaderRecompilerComputeTests.cpp:21440-21440
Timestamp: 2026-10-24T16:56:54.963Z
Learning: Within repository "KytyPS5/KytyPS5", only for files matching one of ["tests/ShaderRecompilerComputeTests.cpp"]: When reviewing m_rasterization_supported in tests/ShaderRecompilerComputeTests.cpp, evaluate its feature requirements against the production renderer baseline. While production device setup requires fragmentStoresAndAtomics, do not request a separate per-case GDS gate solely to support devices without that feature.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-24 16:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#discussion_r4367811249) <!-- coderabbit-ai-generated:v1 --> <details> <summary>🧩 Analysis chain</summary> <dl> <dd> 🏁 Script executed: ```shell #!/bin/bash fd -t f '^vulkanWindow\.cpp$' --exec rg -n -C 5 'fragmentStoresAndAtomics' {} rg -n -C 10 'available_features\.fragmentStoresAndAtomics|fragmentStoresAndAtomics =|m_rasterization_supported =' tests/ShaderRecompilerComputeTests.cpp ``` Length of output: 6060 --- </dd> </dl> </details> `@Nawid3333` You're right. I verified that `vulkanWindow.cpp` checks and enables `fragmentStoresAndAtomics`. The harness also labels this gate `ProductionRasterization`. Keeping the feature in `m_rasterization_supported` matches that production baseline. A separate gate for GDS cases is not needed here. I withdraw this finding. --- <details> <summary>✏️ Learnings added</summary> <dl> <dd> ``` Learnt from: Nawid3333 Repo: KytyPS5/KytyPS5 PR: 1881 File: tests/ShaderRecompilerComputeTests.cpp:21440-21440 Timestamp: 2026-10-24T16:56:54.963Z Learning: Within repository "KytyPS5/KytyPS5", only for files matching one of ["tests/ShaderRecompilerComputeTests.cpp"]: When reviewing m_rasterization_supported in tests/ShaderRecompilerComputeTests.cpp, evaluate its feature requirements against the production renderer baseline. While production device setup requires fragmentStoresAndAtomics, do not request a separate per-case GDS gate solely to support devices without that feature. ``` > Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings). </dd> </dl> </details> <!-- <review_comment_withdrawn> --> ✅ Review thread resolved. <sub><i>You are interacting with an AI system.</i></sub> <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-24 16:57 UTC · original

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
ast-grep outline tests/ShaderRecompilerComputeTests.cpp --match GraphicsDsAppendSkipsHelperLanes --view expanded
rg -n -A160 -B8 'GraphicsCase GraphicsDsAppendSkipsHelperLanes\s*\(' tests/ShaderRecompilerComputeTests.cpp

Length of output: 7758


@Nawid3333 I couldn't produce a complete response to this request. Please try again.


📝 I couldn't check this conversation for new learnings, so no new learning was saved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-24 16:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#issuecomment-6386981160) <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated reply by CodeRabbit --> > [!TIP] > For best results, initiate chat on the files or code changes. <details> <summary>🧩 Analysis chain</summary> <dl> <dd> 🏁 Script executed: ```shell #!/bin/bash ast-grep outline tests/ShaderRecompilerComputeTests.cpp --match GraphicsDsAppendSkipsHelperLanes --view expanded rg -n -A160 -B8 'GraphicsCase GraphicsDsAppendSkipsHelperLanes\s*\(' tests/ShaderRecompilerComputeTests.cpp ``` Length of output: 7758 --- </dd> </dl> </details> `@Nawid3333` I couldn't produce a complete response to this request. Please try again. --- > 📝 I couldn't check this conversation for new learnings, so no new learning was saved. <sub><i>You are interacting with an AI system.</i></sub>
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-24 17:14 UTC · original

Added f3396e94: the same case for DS_CONSUME (GraphicsDsConsumeSkipsHelperLanes; --ds-append-helper-only now runs both). With the counter starting at 10 it exports the first value returned and base1 - base2 - s_bcnt1(exec), expected (10.0, 0.0). The results match the append case: it passes on main and with this PR on the RX 9070 XT and the 7600X iGPU, and with the hand-added OpDPdx the RX 9070 XT fails on main with (0.0, -4.0) and passes with this PR. With this PR the validation layer reports nothing for either case on either GPU.

**@⁠Nawid3333** on GitHub · 2026-10-24 17:14 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#issuecomment-6387165686) Added f3396e94: the same case for `DS_CONSUME` (`GraphicsDsConsumeSkipsHelperLanes`; `--ds-append-helper-only` now runs both). With the counter starting at 10 it exports the first value returned and `base1 - base2 - s_bcnt1(exec)`, expected (10.0, 0.0). The results match the append case: it passes on `main` and with this PR on the RX 9070 XT and the 7600X iGPU, and with the hand-added `OpDPdx` the RX 9070 XT fails on `main` with (0.0, -4.0) and passes with this PR. With this PR the validation layer reports nothing for either case on either GPU.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-24 17:15 UTC · original · reviewed

🧹 Nitpick comments: 1
tests/ShaderRecompilerComputeTests.cpp: 1

43706-43706: Trivial · Functional Correctness · Quick win

Add a derivative-backed helper-lane variant.

GraphicsDsAppendSkipsHelperLanes emits interpolant reads but no derivative operation. Its pixel assertion checks only the final readback, so it does not prove that helper invocations entered the ballot. On hosts where interpolation alone does not include helpers in EXEC, this case can pass without exercising helper-lane election. Keep the current case and add an OpDPdx-backed variant to cover that path.


Review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between c076fa5872 and f3396e9493.

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.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-24 17:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#pullrequestreview-5639106929) · **reviewed** <!-- coderabbit-ai-generated:v1 --> <details> <summary>🧹 Nitpick comments: 1</summary><blockquote> <dl> <dd> <details> <summary>tests/ShaderRecompilerComputeTests.cpp: 1</summary><blockquote> <dl> <dd> `43706-43706`: **<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** **Add a derivative-backed helper-lane variant.** `GraphicsDsAppendSkipsHelperLanes` emits interpolant reads but no derivative operation. Its pixel assertion checks only the final readback, so it does not prove that helper invocations entered the ballot. On hosts where interpolation alone does not include helpers in `EXEC`, this case can pass without exercising helper-lane election. Keep the current case and add an `OpDPdx`-backed variant to cover that path. <!-- cr-comment:v1:7911daea0c4791aa30c7846e --> </dd> </dl> </blockquote></details> </dd> </dl> </blockquote></details> --- <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="16" height="16" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <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> - **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/8291cfeb04237a5e36f5d377e620cd0e6acd5805/.coderabbit.yaml>) - **Commit**: [8291cfe](<https://github.com/KytyPS5/KytyPS5/commit/8291cfeb04237a5e36f5d377e620cd0e6acd5805>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `016491ff-8667-4274-be4d-803fbec36b0c` </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> Reviewing files that changed from the base of the PR and between c076fa587235756e5f9ef35afda5ab0bab9ee96b and f3396e9493eef098e9e5304394569522a33d3d5d. </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: 1</summary> <dl> <dd> * `tests/ShaderRecompilerComputeTests.cpp` </dd> </dl> </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. </dd> </dl> </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=67969f53-5809-474b-9f63-cc8cfde66f4a attempt=acea358d-c539-4513-a0ef-32967c04fd3f batch=1/1 -->
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-24 17:34 UTC · original

@⁠coderabbitai On the nitpick about a derivative-backed variant: the recompiler emits a derivative only for an implicit-LOD image sample (OpImageSampleImplicitLod in spirvEmitterImage.cpp); no guest instruction becomes OpDPdx or a quad operation, and graphics cases cannot bind images yet. So the OpDPdx variant was run by hand on the dumped fragment SPIR-V (results in the description and in the comment above), and a committed variant would need image binding in the fragment harness first, which I'd keep out of this PR.

**@⁠Nawid3333** on GitHub · 2026-10-24 17:34 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#issuecomment-6387376083) @⁠coderabbitai On the nitpick about a derivative-backed variant: the recompiler emits a derivative only for an implicit-LOD image sample (`OpImageSampleImplicitLod` in `spirvEmitterImage.cpp`); no guest instruction becomes `OpDPdx` or a quad operation, and graphics cases cannot bind images yet. So the `OpDPdx` variant was run by hand on the dumped fragment SPIR-V (results in the description and in the comment above), and a committed variant would need image binding in the fragment harness first, which I'd keep out of this PR.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-24 17:35 UTC · original

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
fd '^spirvEmitterImage\.cpp$'
ast-grep outline src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp --match 'Image|Sample' --view expanded
ast-grep outline tests/ShaderRecompilerComputeTests.cpp --match 'RenderFragment|GraphicsCase' --view expanded
rg -n -C5 'OpImageSampleImplicitLod|ImageSampleImplicitLod|OpDPdx|DPdx|Quad' src/graphics/shader/recompiler
rg -n -C8 'descriptor_mask|DescriptorMask|initial_gds|fragment.*descriptor|only GDS|GDS.*only' tests/ShaderRecompilerComputeTests.cpp

Length of output: 14451


@Nawid3333 I couldn't produce a complete response to this request. Please try again.


📝 I couldn't check this conversation for new learnings, so no new learning was saved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-24 17:35 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#issuecomment-6387381215) <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated reply by CodeRabbit --> > [!TIP] > For best results, initiate chat on the files or code changes. <details> <summary>🧩 Analysis chain</summary> <dl> <dd> 🏁 Script executed: ```shell #!/bin/bash fd '^spirvEmitterImage\.cpp$' ast-grep outline src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp --match 'Image|Sample' --view expanded ast-grep outline tests/ShaderRecompilerComputeTests.cpp --match 'RenderFragment|GraphicsCase' --view expanded rg -n -C5 'OpImageSampleImplicitLod|ImageSampleImplicitLod|OpDPdx|DPdx|Quad' src/graphics/shader/recompiler rg -n -C8 'descriptor_mask|DescriptorMask|initial_gds|fragment.*descriptor|only GDS|GDS.*only' tests/ShaderRecompilerComputeTests.cpp ``` Length of output: 14451 --- </dd> </dl> </details> `@Nawid3333` I couldn't produce a complete response to this request. Please try again. --- > 📝 I couldn't check this conversation for new learnings, so no new learning was saved. <sub><i>You are interacting with an AI system.</i></sub>
Author
Owner

@⁠ZrDaniel07 on GitHub · 2026-10-24 17:39 UTC · original

@⁠Nawid3333 I ran both tests on the RTX 5090 (Windows 11, driver 617.42).

shader_recompiler_compute_tests --ds-append-helper-only

Build Result
this PR (f3396e94) GraphicsDsAppendSkipsHelperLanes ok, GraphicsDsConsumeSkipsHelperLanes ok
this PR's tests with main's shader code (git checkout 8291cfeb -- src) append case fails in 2 of 2 runs

On main's code, pixel 1 read back (4294967296.0, -3.0) in the first run and (4294967296.0, ≈-2.09e9) in the second, instead of (10.0, 0.0). The values change from run to run, which is what an atomic done by a helper lane would give. The run stops at that case, so the consume case didn't run on main's code. So the NVIDIA driver puts helpers into the EXEC ballot for this shader without a derivative, and the case as committed catches the bug there without the hand-added OpDPdx (re the derivative-variant nitpick).

ASTRO BOT, same base (8291cfeb)

Same settings as my earlier runs: no game patch, no loop cap, guest log to a file. There is no #838 and no mesh patch, so only the loading hang is being tested.

Build (RTX 5090) Runs DEVICE_LOST
main 8291cfeb (control) 2 2: masterSemaphore.cpp:56 at VS 22 | PS 36 | CS 48 and VS 18 | PS 28 | CS 47
this PR f3396e94 2 0
  • The two PR runs got past that point, to ~117 VS / 113 PS.
    • Run 1 ended in a guest fault on LevelTask_ATQT (pc=0x900388230, rcx=0x9ca52db2). That is the same fault #838 fixes, and #838 is not in these builds.
    • Run 2 stopped on the level's loading screen with no error, and I closed it. It is probably the same loading-thread problem, but I haven't checked.
  • #1365 doesn't build on 8291cfeb (SrtRuntime::read_memory is gone), so the control is plain main. Neither build needed it to boot, so bdf48dcf seems to cover that crash.

Separate, probably not from this PR

In the PR build, the sand in the crash-site desert is flat bright yellow and the rocks are mostly dark. With de0e387 on 6aaa5332 the same area looked right. The control dies before the desert, so I can't tell from these runs whether it comes from the 9 main commits in 6aaa5332..8291cfeb. Since this PR only touches the DS_APPEND/DS_CONSUME lane election, I suspect them. I haven't bisected it yet.

AI use: Claude Code built the branches, ran the shader tests and compared the logs with me; I ran the game and checked the outputs myself.

**@⁠ZrDaniel07** on GitHub · 2026-10-24 17:39 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#issuecomment-6387426912) @⁠Nawid3333 I ran both tests on the RTX 5090 (Windows 11, driver 617.42). **`shader_recompiler_compute_tests --ds-append-helper-only`** | Build | Result | |---|---| | this PR (`f3396e94`) | `GraphicsDsAppendSkipsHelperLanes ok`, `GraphicsDsConsumeSkipsHelperLanes ok` | | this PR's tests with `main`'s shader code (`git checkout 8291cfeb -- src`) | append case fails in 2 of 2 runs | On `main`'s code, pixel 1 read back (4294967296.0, -3.0) in the first run and (4294967296.0, ≈-2.09e9) in the second, instead of (10.0, 0.0). The values change from run to run, which is what an atomic done by a helper lane would give. The run stops at that case, so the consume case didn't run on `main`'s code. So the NVIDIA driver puts helpers into the EXEC ballot for this shader without a derivative, and the case as committed catches the bug there without the hand-added `OpDPdx` (re the derivative-variant nitpick). **ASTRO BOT, same base (`8291cfeb`)** Same settings as my earlier runs: no game patch, no loop cap, guest log to a file. There is no #838 and no mesh patch, so only the loading hang is being tested. | Build (RTX 5090) | Runs | DEVICE_LOST | |---|---|---| | `main` `8291cfeb` (control) | 2 | 2: `masterSemaphore.cpp:56` at `VS 22 \| PS 36 \| CS 48` and `VS 18 \| PS 28 \| CS 47` | | this PR `f3396e94` | 2 | 0 | - The two PR runs got past that point, to ~117 VS / 113 PS. - Run 1 ended in a guest fault on `LevelTask_ATQT` (`pc=0x900388230`, `rcx=0x9ca52db2`). That is the same fault #838 fixes, and #838 is not in these builds. - Run 2 stopped on the level's loading screen with no error, and I closed it. It is probably the same loading-thread problem, but I haven't checked. - #1365 doesn't build on `8291cfeb` (`SrtRuntime::read_memory` is gone), so the control is plain `main`. Neither build needed it to boot, so `bdf48dcf` seems to cover that crash. **Separate, probably not from this PR** In the PR build, the sand in the crash-site desert is flat bright yellow and the rocks are mostly dark. With `de0e387` on `6aaa5332` the same area looked right. The control dies before the desert, so I can't tell from these runs whether it comes from the 9 `main` commits in `6aaa5332..8291cfeb`. Since this PR only touches the `DS_APPEND`/`DS_CONSUME` lane election, I suspect them. I haven't bisected it yet. AI use: Claude Code built the branches, ran the shader tests and compared the logs with me; I ran the game and checked the outputs myself.
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-24 17:47 UTC · original

@⁠ZrDaniel07 Thank you, that settles two things the description lists as not tested: the case on NVIDIA (as committed it fails on main's shader code on the RTX 5090 without the OpDPdx edit, and passes with this PR), and the exact head in the game (2 of 2 device losses on plain main 8291cfeb, 0 of 2 with this PR on the same base). Good to know that #1365 is no longer needed to boot on 8291cfeb.

I can't reach the desert here (our RX 9070 XT loses the device earlier in ASTRO BOT), so I can't check the sand myself. If you look into it, the main commits between 6aaa5332 and 8291cfeb are the 9 from 07f64202 to 8291cfeb.

**@⁠Nawid3333** on GitHub · 2026-10-24 17:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#issuecomment-6387505039) @⁠ZrDaniel07 Thank you, that settles two things the description lists as not tested: the case on NVIDIA (as committed it fails on `main`'s shader code on the RTX 5090 without the `OpDPdx` edit, and passes with this PR), and the exact head in the game (2 of 2 device losses on plain `main` 8291cfeb, 0 of 2 with this PR on the same base). Good to know that #1365 is no longer needed to boot on 8291cfeb. I can't reach the desert here (our RX 9070 XT loses the device earlier in ASTRO BOT), so I can't check the sand myself. If you look into it, the `main` commits between 6aaa5332 and 8291cfeb are the 9 from 07f64202 to 8291cfeb.
Author
Owner

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

I checked which shaders this has to cover, using a 4090 run that lost the device entering Sky Garden in the same CS 0x657ad04626bf9d55 dispatch (#1511). That run dumped all 551 shaders it compiled, and 15 of them are pixel shaders with DS_APPEND, 4a55033774c8f01e among them.

  • In all 15, V_MBCNT ranks exactly the lanes that the DS_APPEND counts, and none picks a lane itself (no V_READLANE, V_READFIRSTLANE or S_FF1). So the election in this PR should be enough for all of them.
  • 13 of the 15 rank and append in exact mode: the rank over exec & s, then the append under S_AND_SAVEEXEC_B64 with s, the EXEC saved before the entry S_WQM_B64. Unlike 4a55, these 13 sample with implicit LOD, so going by #1574 the RX 9070 XT also puts their helpers into the ballot. Wherever helpers are in the ballot, they still take slots in these 13: the holes the description mentions.

I haven't run this branch; this comes from the shader code.

AI use: Claude Code went through the shader dumps and drafted this comment.

**@⁠devklex** on GitHub · 2026-10-25 01:38 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#issuecomment-6392037217) I checked which shaders this has to cover, using a 4090 run that lost the device entering Sky Garden in the same `CS 0x657ad04626bf9d55` dispatch (#1511). That run dumped all 551 shaders it compiled, and 15 of them are pixel shaders with `DS_APPEND`, `4a55033774c8f01e` among them. - In all 15, `V_MBCNT` ranks exactly the lanes that the `DS_APPEND` counts, and none picks a lane itself (no `V_READLANE`, `V_READFIRSTLANE` or `S_FF1`). So the election in this PR should be enough for all of them. - 13 of the 15 rank and append in exact mode: the rank over `exec & s`, then the append under `S_AND_SAVEEXEC_B64` with `s`, the EXEC saved before the entry `S_WQM_B64`. Unlike `4a55`, these 13 sample with implicit LOD, so going by #1574 the RX 9070 XT also puts their helpers into the ballot. Wherever helpers are in the ballot, they still take slots in these 13: the holes the description mentions. I haven't run this branch; this comes from the shader code. AI use: Claude Code went through the shader dumps and drafted this comment.
Author
Owner

@⁠ZrDaniel07 on GitHub · 2026-10-26 20:35 UTC · original

@⁠Nawid3333 FYI, on main f90a8b15 (with #838, without this PR) ASTRO BOT no longer loses the device while loading on my RTX 5090. I did 1 run to the Garden plus 3 more with the mesh patch, with no DEVICE_LOST. That is presumably 5429888d, which keeps helper lanes out of EXEC/VCC. I haven't re-run --ds-append-helper-only against it, so I can't say whether this PR still covers a case main misses.

AI use: Claude Code compared the builds with me; I ran the game.

**@⁠ZrDaniel07** on GitHub · 2026-10-26 20:35 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#issuecomment-6426710103) @⁠Nawid3333 FYI, on `main` `f90a8b15` (with #838, without this PR) ASTRO BOT no longer loses the device while loading on my RTX 5090. I did 1 run to the Garden plus 3 more with the mesh patch, with no DEVICE_LOST. That is presumably `5429888d`, which keeps helper lanes out of EXEC/VCC. I haven't re-run `--ds-append-helper-only` against it, so I can't say whether this PR still covers a case `main` misses. AI use: Claude Code compared the builds with me; I ran the game.
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-27 16:23 UTC · original

Closing: main has this since 5429888d ("shader: keep pixel helper lanes out of the EXEC and VCC words"), which keeps the helper lanes out of the EXEC words that DS_APPEND and DS_CONSUME elect and count from, and adds GraphicsDsAppendSkipsHelperLanes with consume and ordered-count cases. ZrDaniel07 reports no DEVICE_LOST in ASTRO BOT on f90a8b15 with #838 and without this PR (#1881). Thanks for all the test runs, @⁠ZrDaniel07, and to @⁠devklex for checking which shaders it has to cover.

**@⁠Nawid3333** on GitHub · 2026-10-27 16:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1881#issuecomment-6447384265) Closing: `main` has this since 5429888d ("shader: keep pixel helper lanes out of the EXEC and VCC words"), which keeps the helper lanes out of the EXEC words that DS_APPEND and DS_CONSUME elect and count from, and adds `GraphicsDsAppendSkipsHelperLanes` with consume and ordered-count cases. ZrDaniel07 reports no DEVICE_LOST in ASTRO BOT on f90a8b15 with #838 and without this PR (https://git.gtahub.st/github/KytyPS5--KytyPS5/pulls/1881). Thanks for all the test runs, @⁠ZrDaniel07, and to @⁠devklex for checking which shaders it has to cover.

Pull request closed

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