feat(agc): select Vulkan devices by driver name #6788

Closed
Muhammed-Jameel wants to merge 1 commit from upstream-pr/6788 into main
Muhammed-Jameel commented 2026-10-16 11:56:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Muhammed-Jameel on 2026-10-16T11:56:17Z.


What

ANYPS5_GPU cannot distinguish Vulkan implementations that expose the same device name, such as MoltenVK and KosmicKrisp on one Apple GPU. Add ANYPS5_VULKAN_DRIVER as a case-insensitive substring filter on the standardized driverName, combined with the existing GPU filter. An unmatched explicit request fails and lists device/driver identities instead of selecting another implementation. Empty requests preserve existing ranking.

Query driver properties through Vulkan 1.2 core support or VK_KHR_driver_properties on older devices. Include the identity in candidate/selected-device diagnostics and preserve it for performance reports. Add focused tests for duplicate GPU names, combined filters, unavailable identities and core promotion, and extend the existing runtime selection regression.

This is the first part of controlled macOS driver comparisons. It does not install drivers, implement a complete Mac runtime, change shader semantics, or claim a speedup. It also works with other Vulkan implementations.

Related work checked: #6222 already provides Mac loader/portability changes, #4847 addresses BDA candidate eligibility, and #5021 contains the experimental ARM64 AOT route. Their implementations are not duplicated here. The selector has no merge dependency on those changes, but end-to-end macOS runtime validation still needs the Mac prerequisites. This draft remains pending full runtime validation.

Tested

Apple M1 Pro, 16 GiB, macOS 27.0.1 (26A434), AppleClang 17 / Xcode 26.2 with its matching macOS 26.2 SDK. Rebased onto c8044c3a7.

  • New focused test compiled and passed as native ARM64 and x86-64 under Rosetta, with -Wall -Wextra -Werror -Wno-missing-field-initializers.
  • Full CMake configuration completed. agc_vulkan_driver_selection_tests built and its CTest passed under Rosetta.
  • A separate native Vulkan discovery probe exercised the new query/filter helpers against the installed MoltenVK 1.4.2 driver on Apple M1 Pro: matching GPU/driver accepted; a KosmicKrisp request and wrong GPU request rejected. This queried a real driver; it did not render or execute a game. KosmicKrisp is not installed on this validation host.
  • Both changed translation units passed syntax checks with the generated CMake compiler options; VulkanDevice.cpp additionally required the bundled SDL include directory because the current Mac build does not supply it.
  • Full agc_driver_device_selection_tests build attempted, blocked in existing macOS libc code (CLOCK_REALTIME_COARSE, stat.st_mtim, stdio macros and Linux link.h). The extended runtime test was not run. No Linux/Windows full build or game/FPS comparison is claimed.
  • The native focused test also passed UndefinedBehaviorSanitizer. AddressSanitizer could not be evaluated: its runtime stalled during shadow-memory initialization before main; the attempt was terminated.
  • Conventions and whitespace checks passed.

Checklist

  • Based on current main; no other open PR found implementing driver-name filtering
  • One topic per PR; follow-ups go in a new PR
  • No new code comments
  • Unsupported explicit selections throw; no silent stubs added
  • No investigation notes, logs or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none for this selector; Mac runtime prerequisites noted above
  • Unblocks: none (no retail-title claim)
  • GPUs tested: Apple M1 Pro / MoltenVK 1.4.2 / macOS 27.0.1, discovery only; AGC GPU execution tests remain unrun
  • AI-assisted: yes, with Codex
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4888005568 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6788). Originally posted by [Muhammed-Jameel](https://github.com/Muhammed-Jameel) on 2026-10-16T11:56:17Z. --- ### What `ANYPS5_GPU` cannot distinguish Vulkan implementations that expose the same device name, such as MoltenVK and KosmicKrisp on one Apple GPU. Add `ANYPS5_VULKAN_DRIVER` as a case-insensitive substring filter on the standardized `driverName`, combined with the existing GPU filter. An unmatched explicit request fails and lists device/driver identities instead of selecting another implementation. Empty requests preserve existing ranking. Query driver properties through Vulkan 1.2 core support or `VK_KHR_driver_properties` on older devices. Include the identity in candidate/selected-device diagnostics and preserve it for performance reports. Add focused tests for duplicate GPU names, combined filters, unavailable identities and core promotion, and extend the existing runtime selection regression. This is the first part of controlled macOS driver comparisons. It does not install drivers, implement a complete Mac runtime, change shader semantics, or claim a speedup. It also works with other Vulkan implementations. Related work checked: #6222 already provides Mac loader/portability changes, #4847 addresses BDA candidate eligibility, and #5021 contains the experimental ARM64 AOT route. Their implementations are not duplicated here. The selector has no merge dependency on those changes, but end-to-end macOS runtime validation still needs the Mac prerequisites. This draft remains pending full runtime validation. ### Tested Apple M1 Pro, 16 GiB, macOS 27.0.1 (26A434), AppleClang 17 / Xcode 26.2 with its matching macOS 26.2 SDK. Rebased onto `c8044c3a7`. - New focused test compiled and passed as native ARM64 and x86-64 under Rosetta, with `-Wall -Wextra -Werror -Wno-missing-field-initializers`. - Full CMake configuration completed. `agc_vulkan_driver_selection_tests` built and its CTest passed under Rosetta. - A separate native Vulkan discovery probe exercised the new query/filter helpers against the installed MoltenVK 1.4.2 driver on Apple M1 Pro: matching GPU/driver accepted; a KosmicKrisp request and wrong GPU request rejected. This queried a real driver; it did not render or execute a game. KosmicKrisp is not installed on this validation host. - Both changed translation units passed syntax checks with the generated CMake compiler options; `VulkanDevice.cpp` additionally required the bundled SDL include directory because the current Mac build does not supply it. - Full `agc_driver_device_selection_tests` build attempted, blocked in existing macOS libc code (`CLOCK_REALTIME_COARSE`, `stat.st_mtim`, stdio macros and Linux `link.h`). The extended runtime test was not run. No Linux/Windows full build or game/FPS comparison is claimed. - The native focused test also passed UndefinedBehaviorSanitizer. AddressSanitizer could not be evaluated: its runtime stalled during shadow-memory initialization before `main`; the attempt was terminated. - Conventions and whitespace checks passed. ### Checklist - [x] Based on current `main`; no other open PR found implementing driver-name filtering - [x] One topic per PR; follow-ups go in a new PR - [x] No new code comments - [x] Unsupported explicit selections throw; no silent stubs added - [x] No investigation notes, logs or images added to the repository - [x] No new third-party code - [x] Generic behaviour, not specific to one title - [x] Depends on: none for this selector; Mac runtime prerequisites noted above - [x] Unblocks: none (no retail-title claim) - [x] GPUs tested: Apple M1 Pro / MoltenVK 1.4.2 / macOS 27.0.1, discovery only; AGC GPU execution tests remain unrun - [x] AI-assisted: yes, with Codex
al3w0f205 commented 2026-10-16 12:07:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by al3w0f205 on 2026-10-16T12:07:10Z.

Review: COMMENTED


Tested on Windows 11 with MinGW-w64 (GCC 15.2.0, Ninja, CMake 4.2.3, Release):

  • tools/check_conventions.py --base origin/main: passed cleanly.
  • Build evaluation: when building agc_vulkan_driver_selection_tests, the link step fails on Windows MinGW with an unresolved personality symbol:
undefined reference to `__gxx_personality_v0`
collect2.exe: error: ld returned 1 exit status

This happens because agc_vulkan_driver_selection_tests does not link libc. Adding:

target_link_libraries(agc_vulkan_driver_selection_tests PRIVATE libc)

under core/libs/prx/libSceAgcDriver/CMakeLists.txt (matching the other AGC tests) resolves the linker error.

  • With that library dependency added:
    • ninja -C build-all agc_vulkan_driver_selection_tests builds cleanly without warnings.
    • ctest -R "^agc_vulkan_driver_selection$": passed 100% (20/20 with --repeat until-fail:20).
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5547543270 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6788#pullrequestreview-5547543270). Originally posted by [al3w0f205](https://github.com/al3w0f205) on 2026-10-16T12:07:10Z. **Review:** COMMENTED --- Tested on Windows 11 with MinGW-w64 (GCC 15.2.0, Ninja, CMake 4.2.3, Release): - `tools/check_conventions.py --base origin/main`: passed cleanly. - Build evaluation: when building `agc_vulkan_driver_selection_tests`, the link step fails on Windows MinGW with an unresolved personality symbol: ``` undefined reference to `__gxx_personality_v0` collect2.exe: error: ld returned 1 exit status ``` This happens because `agc_vulkan_driver_selection_tests` does not link `libc`. Adding: ```cmake target_link_libraries(agc_vulkan_driver_selection_tests PRIVATE libc) ``` under `core/libs/prx/libSceAgcDriver/CMakeLists.txt` (matching the other AGC tests) resolves the linker error. - With that library dependency added: - `ninja -C build-all agc_vulkan_driver_selection_tests` builds cleanly without warnings. - `ctest -R "^agc_vulkan_driver_selection$"`: passed 100% (20/20 with `--repeat until-fail:20`).

Pull request closed

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!6788
No description provided.