From d012fc4e92c790d38f42a6c87442e0268a779093 Mon Sep 17 00:00:00 2001 From: "Tu, Peng" Date: Fri, 12 Apr 2024 17:55:16 -0700 Subject: [PATCH 1/3] Call mkl_sycl_destructor before deleting SYCL queue --- deps/src/onemkl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deps/src/onemkl.cpp b/deps/src/onemkl.cpp index 09b5fb9c..8dda09a8 100644 --- a/deps/src/onemkl.cpp +++ b/deps/src/onemkl.cpp @@ -4320,9 +4320,10 @@ extern "C" int onemklXsparse_matmat(syclQueue_t device_queue, matrix_handle_t A, // oneMKL keeps a cache of SYCL queues and tries to destroy them when unloading the library. // that is incompatible with oneAPI.jl destroying queues before that, so call mkl_free_buffers -// to manually wipe the device cache when we're destroying queues. +// and mkl_sycl_destructor to manually cleanup oneMKL cache when we're destroying queues. extern "C" int onemklDestroy() { mkl_free_buffers(); + mkl_sycl_destructor(); return 0; } From 587bdc644e6ebc8e55ddfa6e5446ea74aa0b927e Mon Sep 17 00:00:00 2001 From: "Tu, Peng" Date: Fri, 12 Apr 2024 22:12:47 -0700 Subject: [PATCH 2/3] Expose mkl_sycl_destructor --- deps/src/onemkl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/deps/src/onemkl.h b/deps/src/onemkl.h index f73ba92e..77936d48 100644 --- a/deps/src/onemkl.h +++ b/deps/src/onemkl.h @@ -2572,6 +2572,7 @@ int onemklXsparse_matmat(syclQueue_t device_queue, matrix_handle_t A, matrix_han matrix_handle_t C, onemklMatmatRequest req, matmat_descr_t descr, int64_t *sizeTempBuffer, void *tempBuffer); +void mkl_sycl_destructor(void); int onemklDestroy(void); #ifdef __cplusplus } From 91ed2a5a53407b6e962de51782cb9befca26100a Mon Sep 17 00:00:00 2001 From: "Tu, Peng" Date: Mon, 15 Apr 2024 07:33:53 -0700 Subject: [PATCH 3/3] Revert "Also call mkl_sycl_destructor before deleting SYCL queue (#420)" This reverts commit 89d5df6ff0333da0d0b61ab03adf3e05b41ec9b3. --- deps/src/onemkl.cpp | 3 +-- deps/src/onemkl.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/deps/src/onemkl.cpp b/deps/src/onemkl.cpp index 0dc0b79c..ca814607 100644 --- a/deps/src/onemkl.cpp +++ b/deps/src/onemkl.cpp @@ -4234,10 +4234,9 @@ extern "C" int onemklXsparse_matmat(syclQueue_t device_queue, matrix_handle_t A, // oneMKL keeps a cache of SYCL queues and tries to destroy them when unloading the library. // that is incompatible with oneAPI.jl destroying queues before that, so call mkl_free_buffers -// and mkl_sycl_destructor to manually cleanup oneMKL cache when we're destroying queues. +// to manually wipe the device cache when we're destroying queues. extern "C" int onemklDestroy() { mkl_free_buffers(); - mkl_sycl_destructor(); return 0; } diff --git a/deps/src/onemkl.h b/deps/src/onemkl.h index 009aa69c..0bf42533 100644 --- a/deps/src/onemkl.h +++ b/deps/src/onemkl.h @@ -2574,7 +2574,6 @@ int onemklXsparse_matmat(syclQueue_t device_queue, matrix_handle_t A, matrix_han matrix_handle_t C, onemklMatmatRequest req, matmat_descr_t descr, int64_t *sizeTempBuffer, void *tempBuffer); -void mkl_sycl_destructor(void); int onemklDestroy(void); #ifdef __cplusplus }