cuda : disable host register by default (#6206)

This commit is contained in:
slaren 2024-03-21 19:54:28 +01:00 committed by GitHub
parent f372c49ccd
commit d0a71233fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11646,7 +11646,7 @@ GGML_CALL void ggml_backend_cuda_get_device_memory(int device, size_t * free, si
} }
GGML_CALL bool ggml_backend_cuda_register_host_buffer(void * buffer, size_t size) { GGML_CALL bool ggml_backend_cuda_register_host_buffer(void * buffer, size_t size) {
if (getenv("GGML_CUDA_NO_PINNED") != nullptr) { if (getenv("GGML_CUDA_REGISTER_HOST") == nullptr) {
return false; return false;
} }
@ -11663,6 +11663,10 @@ GGML_CALL bool ggml_backend_cuda_register_host_buffer(void * buffer, size_t size
} }
GGML_CALL void ggml_backend_cuda_unregister_host_buffer(void * buffer) { GGML_CALL void ggml_backend_cuda_unregister_host_buffer(void * buffer) {
if (getenv("GGML_CUDA_REGISTER_HOST") == nullptr) {
return;
}
cudaError_t err = cudaHostUnregister(buffer); cudaError_t err = cudaHostUnregister(buffer);
if (err != cudaSuccess) { if (err != cudaSuccess) {
// clear the error // clear the error