mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-04-28 23:09:47 +00:00
whisper : use vulkan as gpu backend when available (#2302)
* ggml: use vulkan as gpu backend when available Signed-off-by: Matt Stephenson <mstephenson6@users.noreply.github.com> * whisper: enable using vk as default buffer type Signed-off-by: Matt Stephenson <mstephenson6@users.noreply.github.com> --------- Signed-off-by: Matt Stephenson <mstephenson6@users.noreply.github.com>
This commit is contained in:
parent
7ae885c1ef
commit
f68298ce06
@ -2042,9 +2042,9 @@ void ggml_vk_instance_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ggml_vk_init(ggml_backend_vk_context * ctx, size_t idx) {
|
static void ggml_vk_init(ggml_backend_vk_context * ctx, size_t idx) {
|
||||||
GGML_ASSERT(idx < vk_instance.device_indices.size());
|
|
||||||
VK_LOG_DEBUG("ggml_vk_init(" << ctx->name << ", " << idx << ")");
|
VK_LOG_DEBUG("ggml_vk_init(" << ctx->name << ", " << idx << ")");
|
||||||
ggml_vk_instance_init();
|
ggml_vk_instance_init();
|
||||||
|
GGML_ASSERT(idx < vk_instance.device_indices.size());
|
||||||
|
|
||||||
ctx->name = GGML_VK_NAME + std::to_string(idx);
|
ctx->name = GGML_VK_NAME + std::to_string(idx);
|
||||||
|
|
||||||
|
@ -17,6 +17,10 @@
|
|||||||
#include "ggml-sycl.h"
|
#include "ggml-sycl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GGML_USE_VULKAN
|
||||||
|
#include "ggml-vulkan.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef GGML_USE_BLAS
|
#ifdef GGML_USE_BLAS
|
||||||
#include "ggml-blas.h"
|
#include "ggml-blas.h"
|
||||||
#endif
|
#endif
|
||||||
@ -1269,6 +1273,16 @@ static ggml_backend_t whisper_backend_init_gpu(const whisper_context_params & pa
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GGML_USE_VULKAN
|
||||||
|
if (params.use_gpu) {
|
||||||
|
WHISPER_LOG_INFO("%s: using Vulkan backend\n", __func__);
|
||||||
|
result = ggml_backend_vk_init(params.gpu_device);
|
||||||
|
if (!result) {
|
||||||
|
WHISPER_LOG_ERROR("%s: ggml_backend_vk_init() failed\n", __func__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1317,6 +1331,10 @@ static ggml_backend_buffer_type_t whisper_default_buffer_type(const whisper_cont
|
|||||||
result || (result = ggml_backend_sycl_buffer_type(params.gpu_device));
|
result || (result = ggml_backend_sycl_buffer_type(params.gpu_device));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GGML_USE_VULKAN
|
||||||
|
result || (result = ggml_backend_vk_buffer_type(params.gpu_device));
|
||||||
|
#endif
|
||||||
|
|
||||||
result || (result = ggml_backend_cpu_buffer_type());
|
result || (result = ggml_backend_cpu_buffer_type());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user