mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-30 21:34:36 +00:00
Don't crash on available devices if we can't even create an instance.
This commit is contained in:
parent
addac25293
commit
2c24d67e7b
@ -131,7 +131,7 @@ static std::string ggml_vk_getVendorName(uint32_t vendorID) {
|
|||||||
|
|
||||||
std::vector<ggml_vk_device> ggml_vk_available_devices(size_t memoryRequired) {
|
std::vector<ggml_vk_device> ggml_vk_available_devices(size_t memoryRequired) {
|
||||||
std::vector<ggml_vk_device> results;
|
std::vector<ggml_vk_device> results;
|
||||||
if (!komputeManager()->hasVulkan())
|
if (!komputeManager()->hasVulkan() || !komputeManager()->hasInstance())
|
||||||
return results;
|
return results;
|
||||||
|
|
||||||
std::vector<vk::PhysicalDevice> physicalDevices = komputeManager()->listDevices();
|
std::vector<vk::PhysicalDevice> physicalDevices = komputeManager()->listDevices();
|
||||||
|
@ -245,8 +245,15 @@ Manager::createInstance()
|
|||||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
|
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
|
||||||
|
|
||||||
this->mInstance = std::make_shared<vk::Instance>();
|
this->mInstance = std::make_shared<vk::Instance>();
|
||||||
vk::createInstance(
|
vk::Result r = vk::createInstance(
|
||||||
&computeInstanceCreateInfo, nullptr, this->mInstance.get());
|
&computeInstanceCreateInfo, nullptr, this->mInstance.get());
|
||||||
|
if (r != vk::Result::eSuccess) {
|
||||||
|
KP_LOG_ERROR(
|
||||||
|
"Kompute Manager Error allocating vulkan instance", vk::to_string(r));
|
||||||
|
this->mInstance = nullptr;
|
||||||
|
this->mFreeInstance = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(*this->mInstance);
|
VULKAN_HPP_DEFAULT_DISPATCHER.init(*this->mInstance);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user