vulkan : correctly fix use-after-free in ggml_vk_current_device

The previous attempt actually broke GPU inference with the 'main'
example, which was previously working.

deviceName is a vk::ArrayWrapper1D. Be careful when we convert it to a
std::string, so we don't get null bytes at the end.
This commit is contained in:
Jared Van Bortel 2023-11-30 16:50:20 -05:00
parent 7e11fe0880
commit b932cd7428

View file

@ -340,8 +340,9 @@ ggml_vk_device ggml_vk_current_device() {
if (!komputeManager()->hasDevice())
return ggml_vk_device();
auto devices = ggml_vk_available_devices_internal(0);
ggml_vk_filterByName(devices, komputeManager()->physicalDevice()->getProperties().deviceName);
auto devices = ggml_vk_available_devices(0);
ggml_vk_filterByName(devices, komputeManager()->physicalDevice()->getProperties().deviceName.data());
GGML_ASSERT(!devices.empty());
return devices.front();
}