feat(agc): choose the Vulkan device by name with ANYPS5_GPU #876

Merged
YossiYad merged 1 commit from upstream-pr/876 into main 2026-10-07 16:24:14 +00:00
YossiYad commented 2026-10-06 12:17:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-06T12:17:43Z.


What

VulkanDevice picks the first discrete GPU and there is no way to run on another device. On a machine with more than one GPU (laptops with an integrated and a discrete GPU, desktops with an iGPU, or lavapipe beside a real GPU) that blocks testing the other device and running a title on it.

  • ANYPS5_GPU=<text> selects the first usable device whose name contains the text, compared without regard to case. The names are the ones already printed in the Physical device candidate lines. An empty value is the same as unset.
  • When the text matches no usable device, the constructor throws, naming the request and every enumerated device, instead of falling back silently.
  • VulkanDevice::DeviceName() returns the selected device's name; the new agc_driver_device_selection test uses it to check the default, the upper-cased full name, and a name that matches nothing. The test clears ANYPS5_GPU first, so it also passes when the suite as a whole runs under ANYPS5_GPU.
  • docs/user/USAGE.md gets a "GPU selection" paragraph.

Tested

Linux, Ubuntu 24.04 container (GCC 13, Ninja, -DBUILD_TESTING=ON) on a host with two AMD GPUs and lavapipe:

  • ctest: 360 of 360 pass on the default device (AMD Radeon RX 7700 XT, RADV, Mesa 25.2.8); 360 of 360 pass with ANYPS5_GPU=raphael, which moves every GPU test to the integrated Ryzen 7 9800X3D GPU (RDNA 2, subgroup 64).
  • ANYPS5_GPU=nvidia: Vulkan: no usable device whose name contains ANYPS5_GPU="nvidia"; devices: AMD Radeon RX 7700 XT (RADV NAVI32), AMD Ryzen 7 9800X3D 8-Core Processor (RADV RAPHAEL_MENDOCINO), llvmpipe (LLVM 20.1.2, 256 bits).
  • Fork CI (Linux with lavapipe, Windows build): https://github.com/YossiYad/AnyPS5/actions/runs/37459631094
  • No game title was run with this change.

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 added
  • No notes, investigation .md files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4758568794 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/876). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-06T12:17:43Z. --- ### What `VulkanDevice` picks the first discrete GPU and there is no way to run on another device. On a machine with more than one GPU (laptops with an integrated and a discrete GPU, desktops with an iGPU, or lavapipe beside a real GPU) that blocks testing the other device and running a title on it. - `ANYPS5_GPU=<text>` selects the first usable device whose name contains the text, compared without regard to case. The names are the ones already printed in the `Physical device candidate` lines. An empty value is the same as unset. - When the text matches no usable device, the constructor throws, naming the request and every enumerated device, instead of falling back silently. - `VulkanDevice::DeviceName()` returns the selected device's name; the new `agc_driver_device_selection` test uses it to check the default, the upper-cased full name, and a name that matches nothing. The test clears `ANYPS5_GPU` first, so it also passes when the suite as a whole runs under `ANYPS5_GPU`. - `docs/user/USAGE.md` gets a "GPU selection" paragraph. ### Tested Linux, Ubuntu 24.04 container (GCC 13, Ninja, `-DBUILD_TESTING=ON`) on a host with two AMD GPUs and lavapipe: - `ctest`: 360 of 360 pass on the default device (AMD Radeon RX 7700 XT, RADV, Mesa 25.2.8); 360 of 360 pass with `ANYPS5_GPU=raphael`, which moves every GPU test to the integrated Ryzen 7 9800X3D GPU (RDNA 2, subgroup 64). - `ANYPS5_GPU=nvidia`: `Vulkan: no usable device whose name contains ANYPS5_GPU="nvidia"; devices: AMD Radeon RX 7700 XT (RADV NAVI32), AMD Ryzen 7 9800X3D 8-Core Processor (RADV RAPHAEL_MENDOCINO), llvmpipe (LLVM 20.1.2, 256 bits)`. - Fork CI (Linux with lavapipe, Windows build): https://github.com/YossiYad/AnyPS5/actions/runs/37459631094 - No game title was run with this change. ### 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 added - [x] No notes, investigation `.md` files or images added to the repository - [x] No new third-party code - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
adriadam10 commented 2026-10-07 16:24:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T16:24:09Z.


Checked on RADV (Radeon 660M) + CI's lavapipe side by side: ANYPS5_GPU=llvmpipe/LLVMPIPE selects lavapipe, rembrandt the iGPU, unset/empty keeps the default, an unknown name throws listing both devices. Full ctest green on the merge with main; the test fails with the name filter removed and with a case-sensitive compare. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6042122618 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/876#issuecomment-6042122618). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-07T16:24:09Z. --- Checked on RADV (Radeon 660M) + CI's lavapipe side by side: `ANYPS5_GPU=llvmpipe`/`LLVMPIPE` selects lavapipe, `rembrandt` the iGPU, unset/empty keeps the default, an unknown name throws listing both devices. Full ctest green on the merge with main; the test fails with the name filter removed and with a case-sensitive compare. Merging.
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!876
No description provided.