Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion mlx/backend/cuda/cuda_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ class CudaHandle {
if (cudaPeekAtLastError() != cudaSuccess) {
return;
}
reset();
// Not reset(): it throws via CHECK_CUDA_ERROR, and a throw escaping a
// destructor terminates. At exit the runtime may already be unloading, so
// Destroy fails and the handle can no longer be reclaimed or reported on.
if (handle_ != nullptr) {
Destroy(handle_);
handle_ = nullptr;
}
}

CudaHandle(const CudaHandle&) = delete;
Expand Down