cuda : fix split buffer free

This commit is contained in:
slaren 2024-01-10 21:31:28 +01:00
parent 74066f8c41
commit c522c112b3

View file

@ -10092,9 +10092,13 @@ struct ggml_backend_cuda_split_buffer_context {
for (ggml_tensor_extra_gpu * extra : tensor_extras) { for (ggml_tensor_extra_gpu * extra : tensor_extras) {
for (int id = 0; id < g_device_count; ++id) { for (int id = 0; id < g_device_count; ++id) {
for (int64_t is = 0; is < MAX_STREAMS; ++is) { for (int64_t is = 0; is < MAX_STREAMS; ++is) {
CUDA_CHECK(cudaEventDestroy(extra->events[id][is])); if (extra->events[id][is] != nullptr) {
CUDA_CHECK(cudaEventDestroy(extra->events[id][is]));
}
}
if (extra->data_device[id] != nullptr) {
CUDA_CHECK(cudaFree(extra->data_device[id]));
} }
CUDA_CHECK(cudaFree(extra->data_device[id]));
} }
delete extra; delete extra;
} }