From: Slava Primenko Date: Thu, 4 Apr 2024 12:49:24 +0000 (+0200) Subject: ggml: bypass code incompatible with CUDA < 11.1 (whisper/2020) X-Git-Tag: upstream/0.0.1642~782 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=e9aa302cd18e29b5c48f6b5a2fe67000737e1bd5;p=pkg%2Fggml%2Fsources%2Fggml ggml: bypass code incompatible with CUDA < 11.1 (whisper/2020) `cudaHostRegisterReadOnly` parameter was only introduced in CUDA 11.1 See this issue for more details: https://github.com/ggerganov/examples/whisper/whisper.cpp/issues/2007 --- diff --git a/src/ggml-cuda.cu b/src/ggml-cuda.cu index f51b2042..ce28cb55 100644 --- a/src/ggml-cuda.cu +++ b/src/ggml-cuda.cu @@ -2617,6 +2617,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 @@ -2627,6 +2628,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) {