Skip to content

Commit

Permalink
ggml: bypass code incompatible with CUDA < 11.1 (whisper/2020)
Browse files Browse the repository at this point in the history
`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
  • Loading branch information
primenko-v authored and ggerganov committed Apr 7, 2024
1 parent 43e8995 commit f77261a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ggml-cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit f77261a

Please sign in to comment.