fix(build): preserve bundled validator type tables through exit #6476

Merged
JJenkx merged 1 commit from upstream-pr/6476 into main 2026-10-19 01:27:04 +00:00
JJenkx commented 2026-10-15 16:39:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-15T16:39:31Z.


What

Keep the bundled SPIRV-Tools validator's type-operand opcode tables alive during process exit. InstructionCanHaveTypeOperand and InstructionRequiresTypeOperand currently use function-local unordered_sets. A callback registered before their first use can validate after their destructors have run.

Extend the existing guarded build-source patch mechanism to replace those two sets with constant arrays and std::find, preserving the opcode lists. Both bundled static and shared validator targets use the generated source. Unexpected upstream source changes fail configuration for review. The vendored source and dependency gitlinks remain unchanged; system-package builds are outside this repair.

Add a regression that validates a valid function, valid Phi control flow, and an invalid function type before and during exit. This addresses a specific validator lifetime defect, not every title shutdown fault. No performance or title-unblock claim.

Tested

Arch Linux, Linux 7.2.9-arch1-1, Ryzen 9 7950X. Final source 4187f0b72c31b472dc1103b24f819b5d6f603d8c, rebased on current main ec1193dc3. Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=ON, ANYPS5_USE_SYSTEM_DEPS=OFF. Official SPIRV-Tools pin 7f2d9ee926f98fc77a3ed1e1e0f113b8c9c49458; no private dependency commit.

  • Full runtime libs target and seven focused SPIR-V test executables built successfully.
  • Thirteen focused CTests passed: exit lifetime; branch targets; LDS atomic lock; module generation; narrow constant stores; SPIR-V 1.3 images; optimizer default/full/none variants.
  • Existing agc_driver_f16_to_f32_unpack GPU execution and agc_driver_f16_to_f32_unpack_spirv checks passed on both RADV and lavapipe (2/2 each, no skips).
  • Negative controls: restore the original validator, only the dynamic allow table, or only the dynamic deny table. Each passes warm validation and fails during exit. Restoring the patch passes again. The regression object SHA-256 stays 87c2a1d32a14d04b756c362146f0f4d615075b8bdaa614dac453f582964b5158 across all variants; the linked executable is rebuilt for each validator variant.
  • Conventions, diff whitespace, and test registration checks passed.
  • Record of Lodoss War (PPSA05347, #6460): about 98 seconds of intro rendering with five scheduled Cross presses, readable story text, ordinary close exit 0, kernel import limit restored to its prior 64 MiB. This native smoke check used pre-rebase source 407de2d78fec6d840ca495be54cc291de07dc52b on 0029e62f9, also with the official dependency pin. The intervening main changes are libc formatting/math fixes; the final rebased source was rebuilt and its focused checks rerun. This is not a performance comparison or gameplay validation.

Windows and system-dependency builds have not been tested locally. The separate dependency bump in #5319 does not replace this fix: the v2025.5 validator still uses these dynamic tables; combining the two branches has not been built locally.

Manual review of the overlap bot's unavailable comparisons: #1341 (5380bb9325) adds an SRT source file to the target; #1896 (ae7542cde8), #5867 (a2b5009f55) and #5925 (3339ddd3af) extend shader-cache guard-name lists. Their changes to the shared recompiler CMake file do not register this exit regression or patch the validator. None duplicates this repair. The later #6454 warning was also inspected at 7f7d4064c8: its shared CMake change adds LoadStamp to the cache guard-name list and does not alter validator patching or test registration. Their other conflicts with main remain unresolved in those PRs; combined builds were not performed.

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; no silent stubs introduced
  • No notes, investigation files or images added to the repository
  • New third-party code is a submodule built from source: existing bundled dependency, pin unchanged
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 6650 XT, RADV Mesa 26.2.4; Mesa lavapipe 26.2.4 (LLVM 23.1.1); Arch Linux, kernel 7.2.9-arch1-1
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4876652691 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6476). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-15T16:39:31Z. --- ### What Keep the bundled SPIRV-Tools validator's type-operand opcode tables alive during process exit. `InstructionCanHaveTypeOperand` and `InstructionRequiresTypeOperand` currently use function-local `unordered_set`s. A callback registered before their first use can validate after their destructors have run. Extend the existing guarded build-source patch mechanism to replace those two sets with constant arrays and `std::find`, preserving the opcode lists. Both bundled static and shared validator targets use the generated source. Unexpected upstream source changes fail configuration for review. The vendored source and dependency gitlinks remain unchanged; system-package builds are outside this repair. Add a regression that validates a valid function, valid Phi control flow, and an invalid function type before and during exit. This addresses a specific validator lifetime defect, not every title shutdown fault. No performance or title-unblock claim. ### Tested Arch Linux, Linux 7.2.9-arch1-1, Ryzen 9 7950X. Final source `4187f0b72c31b472dc1103b24f819b5d6f603d8c`, rebased on current main `ec1193dc3`. Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=ON, ANYPS5_USE_SYSTEM_DEPS=OFF. Official SPIRV-Tools pin `7f2d9ee926f98fc77a3ed1e1e0f113b8c9c49458`; no private dependency commit. - Full runtime `libs` target and seven focused SPIR-V test executables built successfully. - Thirteen focused CTests passed: exit lifetime; branch targets; LDS atomic lock; module generation; narrow constant stores; SPIR-V 1.3 images; optimizer default/full/none variants. - Existing `agc_driver_f16_to_f32_unpack` GPU execution and `agc_driver_f16_to_f32_unpack_spirv` checks passed on both RADV and lavapipe (2/2 each, no skips). - Negative controls: restore the original validator, only the dynamic allow table, or only the dynamic deny table. Each passes warm validation and fails during exit. Restoring the patch passes again. The regression object SHA-256 stays `87c2a1d32a14d04b756c362146f0f4d615075b8bdaa614dac453f582964b5158` across all variants; the linked executable is rebuilt for each validator variant. - Conventions, diff whitespace, and test registration checks passed. - Record of Lodoss War (PPSA05347, #6460): about 98 seconds of intro rendering with five scheduled Cross presses, readable story text, ordinary close exit 0, kernel import limit restored to its prior 64 MiB. This native smoke check used pre-rebase source `407de2d78fec6d840ca495be54cc291de07dc52b` on `0029e62f9`, also with the official dependency pin. The intervening main changes are libc formatting/math fixes; the final rebased source was rebuilt and its focused checks rerun. This is not a performance comparison or gameplay validation. Windows and system-dependency builds have not been tested locally. The separate dependency bump in #5319 does not replace this fix: the v2025.5 validator still uses these dynamic tables; combining the two branches has not been built locally. Manual review of the overlap bot's unavailable comparisons: #1341 (`5380bb9325`) adds an SRT source file to the target; #1896 (`ae7542cde8`), #5867 (`a2b5009f55`) and #5925 (`3339ddd3af`) extend shader-cache guard-name lists. Their changes to the shared recompiler CMake file do not register this exit regression or patch the validator. None duplicates this repair. The later #6454 warning was also inspected at `7f7d4064c8`: its shared CMake change adds `LoadStamp` to the cache guard-name list and does not alter validator patching or test registration. Their other conflicts with main remain unresolved in those PRs; combined builds were not performed. ### Checklist - [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 - [x] Unimplemented paths throw; no silent stubs introduced - [x] No notes, investigation files or images added to the repository - [x] New third-party code is a submodule built from source: existing bundled dependency, pin unchanged - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: AMD Radeon RX 6650 XT, RADV Mesa 26.2.4; Mesa lavapipe 26.2.4 (LLVM 23.1.1); Arch Linux, kernel 7.2.9-arch1-1 - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-15 16:53:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T16:53:15Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1341 core/shader/recompiler/CMakeLists.txt
PR 5925 core/shader/recompiler/CMakeLists.txt
PR 6612 core/shader/recompiler/CMakeLists.txt
PR 6879 core/shader/recompiler/CMakeLists.txt
PR 6941 core/shader/recompiler/CMakeLists.txt
PR 6946 core/shader/recompiler/CMakeLists.txt
PR 6947 core/shader/recompiler/CMakeLists.txt
PR 6977 core/shader/recompiler/CMakeLists.txt
PR 7201 core/shader/recompiler/CMakeLists.txt
PR 7332 core/shader/recompiler/CMakeLists.txt
PR 7642 core/shader/recompiler/CMakeLists.txt
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6197506776 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6476#issuecomment-6197506776). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T16:53:15Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 1341](https://www.github.com/boykopovar/AnyPS5/pull/1341) | `core/shader/recompiler/CMakeLists.txt` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/shader/recompiler/CMakeLists.txt` | | [PR 6612](https://www.github.com/boykopovar/AnyPS5/pull/6612) | `core/shader/recompiler/CMakeLists.txt` | | [PR 6879](https://www.github.com/boykopovar/AnyPS5/pull/6879) | `core/shader/recompiler/CMakeLists.txt` | | [PR 6941](https://www.github.com/boykopovar/AnyPS5/pull/6941) | `core/shader/recompiler/CMakeLists.txt` | | [PR 6946](https://www.github.com/boykopovar/AnyPS5/pull/6946) | `core/shader/recompiler/CMakeLists.txt` | | [PR 6947](https://www.github.com/boykopovar/AnyPS5/pull/6947) | `core/shader/recompiler/CMakeLists.txt` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/shader/recompiler/CMakeLists.txt` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/shader/recompiler/CMakeLists.txt` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/shader/recompiler/CMakeLists.txt` | | [PR 7642](https://www.github.com/boykopovar/AnyPS5/pull/7642) | `core/shader/recompiler/CMakeLists.txt` |
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!6476
No description provided.