fix(shader): clear BDA ABI after removing address bindings #7817

Merged
JJenkx merged 1 commit from upstream-pr/7817 into main 2026-10-23 11:28:24 +00:00
JJenkx commented 2026-10-19 08:49:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-19T08:49:21Z.


What

After descriptor specialization, full SPIR-V optimization can remove the last fault-buffer descriptor while the materialized program retains the prepared artifact's BDA ABI version. The driver rejects the otherwise valid shader with AGC graphics: incompatible BDA ABI version.

Clear the materialized BDA ABI version when neither an address-table nor a fault-buffer binding survives. Retain the existing ABI version for live bindings; driver validation remains unchanged. Add focused optimizer-disabled/full tests covering both removable 32-bit atomic fault machinery and a 64-bit atomic whose fault buffer must remain.

Tested

  • Linux, Radeon RX 6650 XT (RADV, Mesa 26.2.4-arch1.1), SPIRV-Tools enabled. Single commit on upstream main 52f8222af1c251818210862e4eeae941cb853e85.

  • Before the fix on the local integration base, agc_shader_specialized_bda_abi_full fails with final fault binding and BDA ABI disagree; optimizer-disabled control passes.

  • On main plus this change: built agc_shader_memory_tests, agc_driver_graphics_tests, agc_spirv_optimizer_tests; all five CTests pass: agc_shader_specialized_bda_abi_none, agc_shader_specialized_bda_abi_full, agc_shader_memory, agc_driver_graphics, agc_spirv_optimizer.

  • Additional native smoke test on the existing Crimson Spires integration branch plus this fix (not clean main): PPSA03568, APS5_SPIRV_OPT=full, reaches the driving cutscene and closes normally, native exit 0. The prior integration build aborted with the ABI error. This is crash-fix evidence, not a performance comparison or a claim that this change alone brings up the title.

  • python3 tools/check_conventions.py --base origin/main and git diff --check pass. Open-PR overlap audit run; no matching ABI implementation found in the shared-file patches inspected. Some comparisons remain unavailable because those PRs conflict with main.

  • Independent Windows validation reported by @LeandroLP23 (full report): AMD Radeon 860M (RDNA 3.5), AMD Windows driver 32.0.13058.8001, Windows 11 (reported by @LeandroLP23); WinLibs GCC 15.2.0, Release, SPIRV-Tools enabled, ANYPS5_NO_SHADER_CACHE=1. With the PR head merged into main 118266aec, direct agc_shader_memory_tests --specialized-bda-abi runs pass all three cases with both APS5_SPIRV_OPT=none and full. With main's Recompiler.cpp and this PR's tests, optimizer-disabled passes and full fails with specialized buffer atomic: final fault binding and BDA ABI disagree. The default shader-memory executable also passes. These are the tester's Windows results, not our own Windows execution.

  • Additional isolated current-main check on upstream 9d2d40f5eedfa8c5f4312517175147eb0181001a: the same five focused CTests pass with only this fix applied (baa24e013e7612783684e83772962cb4b2fb0bca). In matching native Crimson Spires startup runs with APS5_SPIRV_OPT=full, main aborts with compute shader 0x200a430000: AGC graphics: incompatible BDA ABI version about 100 seconds after launch; main plus this fix passes that point and later aborts at about 124 seconds with the separate AGC graphics: non-finite register at DWORD 9 failure. Both processes exited, configurations were restored, and neither reached the driving scene. This isolates removal of the ABI blocker; it does not establish title bring-up or a performance gain.

  • Additional independent Windows validation reported by @savvaniss (full report): Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, ANYPS5_NO_SHADER_CACHE=1, serial CTest. PR head 52491e93f merged into main 85029a00f: all 16 ShaderMemory CTests pass three times on both Intel UHD Graphics 770 (driver 32.0.101.7088) and AMD Radeon RX 9070 XT (driver 32.0.31041.1004; VkCache emptied first). The comparison runs pass the 15 tests registered on main; the new test is not registered there, so those runs do not demonstrate the new test failing before the fix. These are the contributor's reported results, not our own Windows runs.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none (the full-optimizer crash was observed in PPSA03568; no title bring-up claim)
  • GPUs tested: AMD Radeon RX 6650 XT, RADV Mesa 26.2.4-arch1.1, Linux; AMD Radeon 860M (RDNA 3.5), AMD Windows driver 32.0.13058.8001, Windows 11 (reported by @LeandroLP23); Intel UHD Graphics 770, driver 32.0.101.7088, and AMD Radeon RX 9070 XT, driver 32.0.31041.1004, Windows 11 Pro 26300 (reported by @savvaniss)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4918309509 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7817). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-19T08:49:21Z. --- ### What After descriptor specialization, full SPIR-V optimization can remove the last fault-buffer descriptor while the materialized program retains the prepared artifact's BDA ABI version. The driver rejects the otherwise valid shader with `AGC graphics: incompatible BDA ABI version`. Clear the materialized BDA ABI version when neither an address-table nor a fault-buffer binding survives. Retain the existing ABI version for live bindings; driver validation remains unchanged. Add focused optimizer-disabled/full tests covering both removable 32-bit atomic fault machinery and a 64-bit atomic whose fault buffer must remain. ### Tested - Linux, Radeon RX 6650 XT (RADV, Mesa 26.2.4-arch1.1), SPIRV-Tools enabled. Single commit on upstream main `52f8222af1c251818210862e4eeae941cb853e85`. - Before the fix on the local integration base, `agc_shader_specialized_bda_abi_full` fails with `final fault binding and BDA ABI disagree`; optimizer-disabled control passes. - On main plus this change: built `agc_shader_memory_tests`, `agc_driver_graphics_tests`, `agc_spirv_optimizer_tests`; all five CTests pass: `agc_shader_specialized_bda_abi_none`, `agc_shader_specialized_bda_abi_full`, `agc_shader_memory`, `agc_driver_graphics`, `agc_spirv_optimizer`. - Additional native smoke test on the existing Crimson Spires integration branch plus this fix (not clean main): `PPSA03568`, `APS5_SPIRV_OPT=full`, reaches the driving cutscene and closes normally, native exit 0. The prior integration build aborted with the ABI error. This is crash-fix evidence, not a performance comparison or a claim that this change alone brings up the title. - `python3 tools/check_conventions.py --base origin/main` and `git diff --check` pass. Open-PR overlap audit run; no matching ABI implementation found in the shared-file patches inspected. Some comparisons remain unavailable because those PRs conflict with main. - Independent Windows validation reported by @LeandroLP23 ([full report](https://github.com/boykopovar/AnyPS5/pull/7817#issuecomment-6265383930)): AMD Radeon 860M (RDNA 3.5), AMD Windows driver 32.0.13058.8001, Windows 11 (reported by @LeandroLP23); WinLibs GCC 15.2.0, Release, SPIRV-Tools enabled, `ANYPS5_NO_SHADER_CACHE=1`. With the PR head merged into main `118266aec`, direct `agc_shader_memory_tests --specialized-bda-abi` runs pass all three cases with both `APS5_SPIRV_OPT=none` and `full`. With main's `Recompiler.cpp` and this PR's tests, optimizer-disabled passes and full fails with `specialized buffer atomic: final fault binding and BDA ABI disagree`. The default shader-memory executable also passes. These are the tester's Windows results, not our own Windows execution. - Additional isolated current-main check on upstream `9d2d40f5eedfa8c5f4312517175147eb0181001a`: the same five focused CTests pass with only this fix applied (`baa24e013e7612783684e83772962cb4b2fb0bca`). In matching native Crimson Spires startup runs with `APS5_SPIRV_OPT=full`, main aborts with `compute shader 0x200a430000: AGC graphics: incompatible BDA ABI version` about 100 seconds after launch; main plus this fix passes that point and later aborts at about 124 seconds with the separate `AGC graphics: non-finite register at DWORD 9` failure. Both processes exited, configurations were restored, and neither reached the driving scene. This isolates removal of the ABI blocker; it does not establish title bring-up or a performance gain. - Additional independent Windows validation reported by @savvaniss ([full report](https://github.com/boykopovar/AnyPS5/pull/7817#issuecomment-6269759178)): Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, `ANYPS5_NO_SHADER_CACHE=1`, serial CTest. PR head `52491e93f` merged into main `85029a00f`: all 16 ShaderMemory CTests pass three times on both Intel UHD Graphics 770 (driver 32.0.101.7088) and AMD Radeon RX 9070 XT (driver 32.0.31041.1004; `VkCache` emptied first). The comparison runs pass the 15 tests registered on main; the new test is not registered there, so those runs do not demonstrate the new test failing before the fix. These are the contributor's reported results, not our own Windows runs. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none (the full-optimizer crash was observed in PPSA03568; no title bring-up claim) - [x] GPUs tested: AMD Radeon RX 6650 XT, RADV Mesa 26.2.4-arch1.1, Linux; AMD Radeon 860M (RDNA 3.5), AMD Windows driver 32.0.13058.8001, Windows 11 (reported by @LeandroLP23); Intel UHD Graphics 770, driver 32.0.101.7088, and AMD Radeon RX 9070 XT, driver 32.0.31041.1004, Windows 11 Pro 26300 (reported by @savvaniss) - [x] AI-assisted: yes
LeandroLP23 commented 2026-10-19 10:44:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-19T10:44:07Z.


AMD's own Windows driver, with SPIRV-Tools. AMD Radeon 860M (RDNA 3.5, 1002:1114), driver 32.0.13058.8001, Windows 11, WinLibs GCC 15.2.0, Release, ANYPS5_NO_SHADER_CACHE=1. Head merged into main 118266aec (clean merge). "Main's sources" means this PR's test files over main's other files.

That build has BUILD_TESTING=OFF, so I ran agc_shader_memory_tests --specialized-bda-abi directly, with the environment this PR registers (ANYPS5_NO_SHADER_CACHE=1, APS5_SPIRV_OPT=none|full, libc on PATH).

APS5_SPIRV_OPT=none APS5_SPIRV_OPT=full
This head pass, 3 of 3 pass, 3 of 3
main's Recompiler.cpp pass fails: specialized buffer atomic: final fault binding and BDA ABI disagree

agc_shader_memory_tests with no arguments also passes on this head. This is the same split you saw on RADV, here on AMD's own driver.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6265383930 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7817#issuecomment-6265383930). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-19T10:44:07Z. --- AMD's own Windows driver, with SPIRV-Tools. AMD Radeon 860M (RDNA 3.5, `1002:1114`), driver 32.0.13058.8001, Windows 11, WinLibs GCC 15.2.0, Release, `ANYPS5_NO_SHADER_CACHE=1`. Head merged into `main` 118266aec (clean merge). "Main's sources" means this PR's test files over `main`'s other files. That build has `BUILD_TESTING=OFF`, so I ran `agc_shader_memory_tests --specialized-bda-abi` directly, with the environment this PR registers (`ANYPS5_NO_SHADER_CACHE=1`, `APS5_SPIRV_OPT=none|full`, `libc` on `PATH`). | | `APS5_SPIRV_OPT=none` | `APS5_SPIRV_OPT=full` | |---|---|---| | This head | pass, 3 of 3 | pass, 3 of 3 | | `main`'s `Recompiler.cpp` | pass | fails: `specialized buffer atomic: final fault binding and BDA ABI disagree` | `agc_shader_memory_tests` with no arguments also passes on this head. This is the same split you saw on RADV, here on AMD's own driver. AI-assisted: yes (Claude Code)
fogydes commented 2026-10-19 12:38:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fogydes on 2026-10-19T12:38:21Z.

Review: COMMENTED


Verified the diff, conventions, and test coverage in PR #7817:

  • Optimization & BDA ABI: In core/shader/recompiler/Recompiler.cpp, resetting bdaAbi = 0 when full SPIR-V optimization eliminates both address-table and fault-buffer bindings correctly aligns the materialized shader artifact with the driver's descriptor expectations, preventing false incompatible BDA ABI version rejections.
  • Unit Testing: Unit test fixtures in tests/ShaderMemory.cpp registered under CMakeLists.txt cover both optimizer disabled (none) and enabled (full) paths, validating that 32-bit atomic fault machinery is stripped cleanly while live 64-bit atomic fault buffers remain intact.
  • Conventions & CI: Zero code comments introduced. All CI checks pass 100% green (conventions, eligibility, intake, labels, report).
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5571640782 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7817#pullrequestreview-5571640782). Originally posted by [fogydes](https://github.com/fogydes) on 2026-10-19T12:38:21Z. **Review:** COMMENTED --- Verified the diff, conventions, and test coverage in PR #7817: - **Optimization & BDA ABI**: In `core/shader/recompiler/Recompiler.cpp`, resetting `bdaAbi = 0` when full SPIR-V optimization eliminates both address-table and fault-buffer bindings correctly aligns the materialized shader artifact with the driver's descriptor expectations, preventing false `incompatible BDA ABI version` rejections. - **Unit Testing**: Unit test fixtures in `tests/ShaderMemory.cpp` registered under `CMakeLists.txt` cover both optimizer disabled (`none`) and enabled (`full`) paths, validating that 32-bit atomic fault machinery is stripped cleanly while live 64-bit atomic fault buffers remain intact. - **Conventions & CI**: Zero code comments introduced. All CI checks pass 100% green (`conventions`, `eligibility`, `intake`, `labels`, `report`).
savvaniss commented 2026-10-19 14:34:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-19T14:34:02Z.


AMD and Intel Windows data: the 16 tests built from tests/ShaderMemory.cpp pass with this PR on an AMD RX 9070 XT and an Intel UHD 770, including the new agc_shader_specialized_bda_abi_none.

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, with VkCache emptied first. This head 52491e93f merged into main 85029a00f. "Without" means only this PR's diff to tests/ShaderMemory.cpp, applied to main 85029a00f.

Tests, ×3 UHD 770 RX 9070 XT
This head: the 16 tests built from tests/ShaderMemory.cpp 16 of 16 pass 16 of 16 pass
Without the 15 tests that exist on main pass same

The without run cannot show the new test failing: it is registered by this PR's CMakeLists.txt change, so it does not exist on main.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6269759178 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7817#issuecomment-6269759178). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-19T14:34:02Z. --- AMD and Intel Windows data: the 16 tests built from `tests/ShaderMemory.cpp` pass with this PR on an AMD RX 9070 XT and an Intel UHD 770, including the new `agc_shader_specialized_bda_abi_none`. Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, `ANYPS5_NO_SHADER_CACHE=1`, serial CTest. Intel UHD Graphics 770 (`8086:a780`), driver 32.0.101.7088. AMD Radeon RX 9070 XT (`1002:7550`), driver 32.0.31041.1004, with `VkCache` emptied first. This head `52491e93f` merged into `main` `85029a00f`. "Without" means only this PR's diff to `tests/ShaderMemory.cpp`, applied to `main` `85029a00f`. | Tests, ×3 | UHD 770 | RX 9070 XT | |---|---|---| | This head: the 16 tests built from `tests/ShaderMemory.cpp` | 16 of 16 pass | 16 of 16 pass | | Without | the 15 tests that exist on `main` pass | same | The without run cannot show the new test failing: it is registered by this PR's `CMakeLists.txt` change, so it does not exist on `main`. AI-assisted: yes (Claude Code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!7817
No description provided.