Add fallback for integrated GPUs if no dedicated GPUs are found
This commit is contained in:
parent
bcdd6531db
commit
8ddd557d3e
1 changed files with 13 additions and 1 deletions
|
@ -1415,8 +1415,15 @@ void ggml_vk_instance_init() {
|
|||
vk_instance.device_indices.push_back(tmp);
|
||||
}
|
||||
} else {
|
||||
// Default to using all dedicated GPUs
|
||||
std::vector<vk::PhysicalDevice> devices = vk_instance.instance.enumeratePhysicalDevices();
|
||||
|
||||
// Make sure at least one device exists
|
||||
if (devices.empty()) {
|
||||
std::cerr << "ggml_vulkan: Error: No devices found." << std::endl;
|
||||
GGML_ASSERT(false);
|
||||
}
|
||||
|
||||
// Default to using all dedicated GPUs
|
||||
for (size_t i = 0; i < devices.size(); i++) {
|
||||
vk::PhysicalDeviceProperties props = devices[i].getProperties();
|
||||
|
||||
|
@ -1424,6 +1431,11 @@ void ggml_vk_instance_init() {
|
|||
vk_instance.device_indices.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
// If no dedicated GPUs found, fall back to GPU 0
|
||||
if (vk_instance.device_indices.empty()) {
|
||||
vk_instance.device_indices.push_back(0);
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "ggml_vulkan: Found " << vk_instance.device_indices.size() << " Vulkan devices:" << std::endl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue