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
This commit is contained in:
Slava Primenko 2024-04-04 14:49:24 +02:00 committed by Georgi Gerganov
parent 43e8995e75
commit f77261a7c5
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

View File

@ -2617,6 +2617,7 @@ GGML_CALL bool ggml_backend_cuda_register_host_buffer(void * buffer, size_t size
return false; return false;
} }
#if CUDART_VERSION >= 11100
cudaError_t err = cudaHostRegister(buffer, size, cudaHostRegisterPortable | cudaHostRegisterReadOnly); cudaError_t err = cudaHostRegister(buffer, size, cudaHostRegisterPortable | cudaHostRegisterReadOnly);
if (err != cudaSuccess) { if (err != cudaSuccess) {
// clear the error // clear the error
@ -2627,6 +2628,9 @@ GGML_CALL bool ggml_backend_cuda_register_host_buffer(void * buffer, size_t size
return false; return false;
} }
return true; return true;
#else
return false;
#endif
} }
GGML_CALL void ggml_backend_cuda_unregister_host_buffer(void * buffer) { GGML_CALL void ggml_backend_cuda_unregister_host_buffer(void * buffer) {