]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
cuda : clear error after buffer allocation failure (llama/7376)
authorslaren <redacted>
Sun, 19 May 2024 12:19:37 +0000 (14:19 +0200)
committerGeorgi Gerganov <redacted>
Tue, 28 May 2024 11:41:08 +0000 (14:41 +0300)
src/ggml-cuda.cu

index 754611bf307ad2c1b2869f8995f65ced5c5c64a8..b82167cbf7227ba10374f6318498f0dc3c7f869d 100644 (file)
@@ -539,6 +539,8 @@ GGML_CALL static ggml_backend_buffer_t ggml_backend_cuda_buffer_type_alloc_buffe
     void * dev_ptr;
     cudaError_t err = cudaMalloc(&dev_ptr, size);
     if (err != cudaSuccess) {
+        // clear the error
+        cudaGetLastError();
         GGML_CUDA_LOG_ERROR("%s: allocating %.2f MiB on device %d: cudaMalloc failed: %s\n", __func__, size / 1024.0 / 1024.0, buft_ctx->device, cudaGetErrorString(err));
         return nullptr;
     }