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:
parent
7e11fe0880
commit
b932cd7428
1 changed files with 3 additions and 2 deletions
|
@ -340,8 +340,9 @@ ggml_vk_device ggml_vk_current_device() {
|
||||||
if (!komputeManager()->hasDevice())
|
if (!komputeManager()->hasDevice())
|
||||||
return ggml_vk_device();
|
return ggml_vk_device();
|
||||||
|
|
||||||
auto devices = ggml_vk_available_devices_internal(0);
|
auto devices = ggml_vk_available_devices(0);
|
||||||
ggml_vk_filterByName(devices, komputeManager()->physicalDevice()->getProperties().deviceName);
|
ggml_vk_filterByName(devices, komputeManager()->physicalDevice()->getProperties().deviceName.data());
|
||||||
|
GGML_ASSERT(!devices.empty());
|
||||||
return devices.front();
|
return devices.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue