shader: preserve workgroup selection for buffer-backed image tables #1141

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

@⁠Fayberr on GitHub · 2026-10-07 14:09 UTC · original
Fayberr:fix/workgroup-image-table-selection → main · +0 −0 · 0 files · 2 commits · closed without merging

Workgroup-selected image tables lose their selector when the table comes from a four-word buffer descriptor. They fall through to the whole-buffer scan instead, so padding and unrelated words can become image candidates. The existing NativeIndirectDispatch fixture hits the indirect ImageWrite assertion in ResourceMaterialization.cpp as a result.

Preserve the workgroup selector for buffer-backed tables as well as two-word pointer tables. The materializer already handles both representations. Descriptor reads used for dimensions remain in the shader, and the existing bounds, probe limits and assertions remain intact.

Automated testing performed:

  • Reproduced the original assertion with --native-indirect-only; the same existing regression passes with this change, including workgroup-count and image-dimension changes.
  • Rebuilt and passed ResourceTracking, ResourceMaterialization and ScalarProvenance tests.
  • The selected Windows native matrix improved from 27/29 to 29/29, including the full compute and metadata-clear executables. This was the existing research build based on 96eb681b, with the separate BDA fix (#1138) and private MinGW compatibility adjustments. Those changes are excluded from this PR. The submission is based on d2413fc2, whose intervening change does not modify these shader sources.

This fixes the existing table-selection regression; gameplay improvements and general support for image writes across different indirect descriptors have not been established.

AI assistance: OpenAI Codex assisted with investigation, the code change and automated testing.

**@⁠Fayberr** on GitHub · 2026-10-07 14:09 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1141) `Fayberr:fix/workgroup-image-table-selection` → `main` · +0 −0 · 0 files · 2 commits · closed without merging Workgroup-selected image tables lose their selector when the table comes from a four-word buffer descriptor. They fall through to the whole-buffer scan instead, so padding and unrelated words can become image candidates. The existing `NativeIndirectDispatch` fixture hits the indirect `ImageWrite` assertion in `ResourceMaterialization.cpp` as a result. Preserve the workgroup selector for buffer-backed tables as well as two-word pointer tables. The materializer already handles both representations. Descriptor reads used for dimensions remain in the shader, and the existing bounds, probe limits and assertions remain intact. Automated testing performed: - Reproduced the original assertion with `--native-indirect-only`; the same existing regression passes with this change, including workgroup-count and image-dimension changes. - Rebuilt and passed ResourceTracking, ResourceMaterialization and ScalarProvenance tests. - The selected Windows native matrix improved from 27/29 to 29/29, including the full compute and metadata-clear executables. This was the existing research build based on `96eb681b`, with the separate BDA fix (#1138) and private MinGW compatibility adjustments. Those changes are excluded from this PR. The submission is based on `d2413fc2`, whose intervening change does not modify these shader sources. This fixes the existing table-selection regression; gameplay improvements and general support for image writes across different indirect descriptors have not been established. AI assistance: OpenAI Codex assisted with investigation, the code change and automated testing.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:44:47 +00:00
github-bot closed this pull request 2026-11-26 09:44:47 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-07 14:13 UTC · original · edited 2026-10-08 10:14 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: 684e0530-8591-4dbe-8e50-54407237c3c1
📥 Commits

Reviewing files that changed from the base of the PR and between d2413fc2eb and bd3fea2c0d.

📒 Files selected for processing (1)
  • src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp

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


📝 Walkthrough

Walkthrough

The workgroup-axis selector now takes the retain-reads path regardless of table_source.dword_count. Other selectors with a two-DWORD source continue to use the existing bounded-selector handling.

Suggested reviewers: nmzik

Priority: ⬇️ Low

Change: Bug fix

Merge Risk: ⚪ Minimal · up to bd3fe

No merge-blocking issue is established for the selector change. Merge after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. 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 summarizes the main change: preserving workgroup selection for buffer-backed image tables.
Description check ✅ Passed The description explains the selector regression, the fix, and the reported testing. It is directly related to 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.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

❤️ Share

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-07 14:13 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1141#issuecomment-6039828082) · edited 2026-10-08 10:14 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/1141?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**: `684e0530-8591-4dbe-8e50-54407237c3c1` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between d2413fc2ebd91d1b7234197c2dd5bd48e1cb6a51 and bd3fea2c0df893f46456e27ff4c84f4d32bbf186. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough The workgroup-axis selector now takes the retain-reads path regardless of `table_source.dword_count`. Other selectors with a two-DWORD source continue to use the existing bounded-selector handling. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⬇️ Low <!-- change_assessment_commit:"bd3fea2c0df893f46456e27ff4c84f4d32bbf186" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _⚪ Minimal_ · up to `bd3fe` <!-- final_review_risk_coverage:{"sourceCommitId":"bd3fea2c0df893f46456e27ff4c84f4d32bbf186","coveredCommitId":"bd3fea2c0df893f46456e27ff4c84f4d32bbf186","kind":"reviewed"} --> No merge-blocking issue is established for the selector change. Merge after normal checks. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :---------------- | :--------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------ | :------- | :---------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly summarizes the main change: preserving workgroup selection for buffer-backed image tables. | | Description check | ✅ Passed | The description explains the selector regression, the fix, and the reported testing. It is directly related to 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. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1141)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-07 18:07 UTC · original · reviewed

Tested this on a clean build: Windows 11, clang-cl 19.1.5, Release, AMD RX 9070 XT. This PR
(bd3fea2c) vs main d2413fc2, full ctest (53 tests) and all 107 --xxx-only modes of
shader_recompiler_compute_tests:

  • --native-indirect-only: main exits with the indirect_root EXIT_IF in
    ResourceMaterialization.cpp (exit code 321); with this PR it passes. --lds-limit-only
    changes the same way.
  • shader_recompiler_compute and compute_meta_clear_classification no longer abort there. On
    this GPU each now stops at a check that main already fails in other tests:
    • shader_recompiler_compute: image.cpp:721 with format=129 (D24_UNORM_S8_UINT, which this
      driver doesn't support), the same failure as five texture-cache tests on main (#930 is
      about that format).
    • compute_meta_clear_classification: RenderExecutorStencilBindingDiscovery, the same
      failure --image-rebind-only has on main.
  • Every other test and mode: same result as main.

So on AMD it removes the abort without changing anything else I could measure.

**@⁠Nawid3333** on GitHub · 2026-10-07 18:07 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1141#pullrequestreview-5446378914) · **reviewed** Tested this on a clean build: Windows 11, clang-cl 19.1.5, Release, AMD RX 9070 XT. This PR (bd3fea2c) vs `main` d2413fc2, full `ctest` (53 tests) and all 107 `--xxx-only` modes of `shader_recompiler_compute_tests`: - `--native-indirect-only`: `main` exits with the `indirect_root` `EXIT_IF` in `ResourceMaterialization.cpp` (exit code 321); with this PR it passes. `--lds-limit-only` changes the same way. - `shader_recompiler_compute` and `compute_meta_clear_classification` no longer abort there. On this GPU each now stops at a check that `main` already fails in other tests: - `shader_recompiler_compute`: `image.cpp:721` with `format=129` (D24_UNORM_S8_UINT, which this driver doesn't support), the same failure as five texture-cache tests on `main` (#930 is about that format). - `compute_meta_clear_classification`: `RenderExecutorStencilBindingDiscovery`, the same failure `--image-rebind-only` has on `main`. - Every other test and mode: same result as `main`. So on AMD it removes the abort without changing anything else I could measure.
Author
Owner

@⁠Fayberr on GitHub · 2026-10-08 10:17 UTC · original

Closing as superseded. The relevant regression tests pass on upstream without this patch, and this PR now has no remaining changes.

**@⁠Fayberr** on GitHub · 2026-10-08 10:17 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1141#issuecomment-6057703903) Closing as superseded. The relevant regression tests pass on upstream without this patch, and this PR now has no remaining changes.

Pull request closed

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