From: Slava Primenko Date: Thu, 4 Apr 2024 12:49:24 +0000 (+0200) Subject: ggml: bypass code incompatible with CUDA < 11.1 (#2020) X-Git-Tag: upstream/1.7.4~867 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=1d7657f40974e251ea42275e155a8abfb24228ef;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp ggml: bypass code incompatible with CUDA < 11.1 (#2020) `cudaHostRegisterReadOnly` parameter was only introduced in CUDA 11.1 See this issue for more details: https://github.com/ggerganov/whisper.cpp/issues/2007 --- diff --git a/ggml-cuda.cu b/ggml-cuda.cu index be8e33a5..5607386c 100644 --- a/ggml-cuda.cu +++ b/ggml-cuda.cu @@ -2797,6 +2797,7 @@ GGML_CALL bool ggml_backend_cuda_register_host_buffer(void * buffer, size_t size return false; } +#if CUDART_VERSION >= 11100 cudaError_t err = cudaHostRegister(buffer, size, cudaHostRegisterPortable | cudaHostRegisterReadOnly); if (err != cudaSuccess) { // clear the error @@ -2807,6 +2808,9 @@ GGML_CALL bool ggml_backend_cuda_register_host_buffer(void * buffer, size_t size return false; } return true; +#else + return false; +#endif } GGML_CALL void ggml_backend_cuda_unregister_host_buffer(void * buffer) {