diff --git a/src/blas/backends/cublas/cublas_scope_handle.cpp b/src/blas/backends/cublas/cublas_scope_handle.cpp index 05d1c1935..1f84de776 100644 --- a/src/blas/backends/cublas/cublas_scope_handle.cpp +++ b/src/blas/backends/cublas/cublas_scope_handle.cpp @@ -35,8 +35,13 @@ namespace cublas { * takes place if no other element in the container has a key equivalent to * the one being emplaced (keys in a map container are unique). */ +#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +thread_local cublas_handle CublasScopedContextHandler::handle_helper = + cublas_handle{}; +#else thread_local cublas_handle CublasScopedContextHandler::handle_helper = cublas_handle{}; +#endif CublasScopedContextHandler::CublasScopedContextHandler(sycl::queue queue, sycl::interop_handle &ih) : ih(ih), @@ -92,7 +97,11 @@ cublasHandle_t CublasScopedContextHandler::get_handle(const sycl::queue &queue) CUresult cuErr; CUcontext desired; CUDA_ERROR_FUNC(cuDevicePrimaryCtxRetain, cuErr, &desired, cudaDevice); +#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED + auto piPlacedContext_ = reinterpret_cast(desired); +#else auto piPlacedContext_ = reinterpret_cast(desired); +#endif CUstream streamId = get_stream(queue); cublasStatus_t err; auto it = handle_helper.cublas_handle_mapper_.find(piPlacedContext_); diff --git a/src/blas/backends/cublas/cublas_scope_handle.hpp b/src/blas/backends/cublas/cublas_scope_handle.hpp index 7648130be..341316d2f 100644 --- a/src/blas/backends/cublas/cublas_scope_handle.hpp +++ b/src/blas/backends/cublas/cublas_scope_handle.hpp @@ -28,12 +28,23 @@ #include #endif #include -#include #else #include #include +#endif + +// After Plugin Interface removal in DPC++ ur.hpp is the new include +#if __has_include() +#include +#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#endif +#elif __has_include() +#include +#else #include #endif + #include #include #include @@ -77,7 +88,11 @@ class CublasScopedContextHandler { sycl::context *placedContext_; bool needToRecover_; sycl::interop_handle &ih; +#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED + static thread_local cublas_handle handle_helper; +#else static thread_local cublas_handle handle_helper; +#endif CUstream get_stream(const sycl::queue &queue); sycl::context get_context(const sycl::queue &queue); diff --git a/src/blas/backends/cublas/cublas_task.hpp b/src/blas/backends/cublas/cublas_task.hpp index e5cf0d7c2..a486aafee 100644 --- a/src/blas/backends/cublas/cublas_task.hpp +++ b/src/blas/backends/cublas/cublas_task.hpp @@ -32,13 +32,21 @@ #include "oneapi/mkl/types.hpp" #ifndef __HIPSYCL__ #include "cublas_scope_handle.hpp" -#if __has_include() +#else +#include "cublas_scope_handle_hipsycl.hpp" + +// After Plugin Interface removal in DPC++ ur.hpp is the new include +#if __has_include() +#include +#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#endif +#elif __has_include() #include #else #include #endif -#else -#include "cublas_scope_handle_hipsycl.hpp" + namespace sycl { using interop_handler = sycl::interop_handle; } diff --git a/src/blas/backends/rocblas/rocblas_scope_handle.cpp b/src/blas/backends/rocblas/rocblas_scope_handle.cpp index 404d1fc06..5edca96f7 100644 --- a/src/blas/backends/rocblas/rocblas_scope_handle.cpp +++ b/src/blas/backends/rocblas/rocblas_scope_handle.cpp @@ -50,8 +50,13 @@ rocblas_handle_container::~rocblas_handle_container() noexcept(false) { * takes place if no other element in the container has a key equivalent to * the one being emplaced (keys in a map container are unique). */ +#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +thread_local rocblas_handle_container + RocblasScopedContextHandler::handle_helper = rocblas_handle_container{}; +#else thread_local rocblas_handle_container RocblasScopedContextHandler::handle_helper = rocblas_handle_container{}; +#endif RocblasScopedContextHandler::RocblasScopedContextHandler(sycl::queue queue, sycl::interop_handle &ih) @@ -108,7 +113,11 @@ rocblas_handle RocblasScopedContextHandler::get_handle(const sycl::queue &queue) hipError_t hipErr; hipCtx_t desired; HIP_ERROR_FUNC(hipDevicePrimaryCtxRetain, hipErr, &desired, hipDevice); +#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED + auto piPlacedContext_ = reinterpret_cast(desired); +#else auto piPlacedContext_ = reinterpret_cast(desired); +#endif hipStream_t streamId = get_stream(queue); rocblas_status err; auto it = handle_helper.rocblas_handle_container_mapper_.find(piPlacedContext_); diff --git a/src/blas/backends/rocblas/rocblas_scope_handle.hpp b/src/blas/backends/rocblas/rocblas_scope_handle.hpp index 908d4c05c..734e58fb1 100644 --- a/src/blas/backends/rocblas/rocblas_scope_handle.hpp +++ b/src/blas/backends/rocblas/rocblas_scope_handle.hpp @@ -26,6 +26,18 @@ #include #include "rocblas_helper.hpp" +// After Plugin Interface removal in DPC++ ur.hpp is the new include +#if __has_include() +#include +#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#endif +#elif __has_include() +#include +#else +#include +#endif + namespace oneapi { namespace mkl { namespace blas { @@ -43,7 +55,11 @@ class RocblasScopedContextHandler { sycl::context *placedContext_; bool needToRecover_; sycl::interop_handle &interop_h; +#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED + static thread_local rocblas_handle_container handle_helper; +#else static thread_local rocblas_handle_container handle_helper; +#endif sycl::context get_context(const sycl::queue &queue); hipStream_t get_stream(const sycl::queue &queue); diff --git a/src/blas/backends/rocblas/rocblas_task.hpp b/src/blas/backends/rocblas/rocblas_task.hpp index 94e2b2b4a..a52bd4c2e 100644 --- a/src/blas/backends/rocblas/rocblas_task.hpp +++ b/src/blas/backends/rocblas/rocblas_task.hpp @@ -30,15 +30,22 @@ #include "oneapi/mkl/types.hpp" #ifndef __HIPSYCL__ #include "rocblas_scope_handle.hpp" -#if __has_include() +#else +#include "rocblas_scope_handle_hipsycl.hpp" +#endif + +// After Plugin Interface removal in DPC++ ur.hpp is the new include +#if __has_include() +#include +#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#endif +#elif __has_include() #include #else #include #endif -#else -#include "rocblas_scope_handle_hipsycl.hpp" -#endif namespace oneapi { namespace mkl { namespace blas { diff --git a/src/lapack/backends/cusolver/cusolver_scope_handle.cpp b/src/lapack/backends/cusolver/cusolver_scope_handle.cpp index 0bc3ebdb0..a0c9c6b6f 100644 --- a/src/lapack/backends/cusolver/cusolver_scope_handle.cpp +++ b/src/lapack/backends/cusolver/cusolver_scope_handle.cpp @@ -35,8 +35,13 @@ namespace cusolver { * takes place if no other element in the container has a key equivalent to * the one being emplaced (keys in a map container are unique). */ +#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +thread_local cusolver_handle CusolverScopedContextHandler::handle_helper = + cusolver_handle{}; +#else thread_local cusolver_handle CusolverScopedContextHandler::handle_helper = cusolver_handle{}; +#endif CusolverScopedContextHandler::CusolverScopedContextHandler(sycl::queue queue, sycl::interop_handle &ih) @@ -93,7 +98,11 @@ cusolverDnHandle_t CusolverScopedContextHandler::get_handle(const sycl::queue &q CUresult cuErr; CUcontext desired; CUDA_ERROR_FUNC(cuDevicePrimaryCtxRetain, cuErr, &desired, cudaDevice); +#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED + auto piPlacedContext_ = reinterpret_cast(desired); +#else auto piPlacedContext_ = reinterpret_cast(desired); +#endif CUstream streamId = get_stream(queue); cusolverStatus_t err; auto it = handle_helper.cusolver_handle_mapper_.find(piPlacedContext_); diff --git a/src/lapack/backends/cusolver/cusolver_scope_handle.hpp b/src/lapack/backends/cusolver/cusolver_scope_handle.hpp index 585b4995a..390f9bb46 100644 --- a/src/lapack/backends/cusolver/cusolver_scope_handle.hpp +++ b/src/lapack/backends/cusolver/cusolver_scope_handle.hpp @@ -28,11 +28,9 @@ #include #endif #include -#include #else #include #include -#include #endif #include #include @@ -41,6 +39,18 @@ #include "cusolver_helper.hpp" #include "cusolver_handle.hpp" +// After Plugin Interface removal in DPC++ ur.hpp is the new include +#if __has_include() +#include +#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#endif +#elif __has_include() +#include +#else +#include +#endif + namespace oneapi { namespace mkl { namespace lapack { @@ -82,7 +92,11 @@ class CusolverScopedContextHandler { sycl::context *placedContext_; bool needToRecover_; sycl::interop_handle &ih; +#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED + static thread_local cusolver_handle handle_helper; +#else static thread_local cusolver_handle handle_helper; +#endif CUstream get_stream(const sycl::queue &queue); sycl::context get_context(const sycl::queue &queue); diff --git a/src/lapack/backends/cusolver/cusolver_task.hpp b/src/lapack/backends/cusolver/cusolver_task.hpp index 9d319be64..00e6e26be 100644 --- a/src/lapack/backends/cusolver/cusolver_task.hpp +++ b/src/lapack/backends/cusolver/cusolver_task.hpp @@ -30,11 +30,19 @@ #endif #include "oneapi/mkl/types.hpp" #include "cusolver_scope_handle.hpp" -#if __has_include() + +// After Plugin Interface removal in DPC++ ur.hpp is the new include +#if __has_include() +#include +#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#endif +#elif __has_include() #include #else #include #endif + namespace oneapi { namespace mkl { namespace lapack { diff --git a/src/lapack/backends/rocsolver/rocsolver_scope_handle.cpp b/src/lapack/backends/rocsolver/rocsolver_scope_handle.cpp index 42e262e7b..480ee9fc3 100644 --- a/src/lapack/backends/rocsolver/rocsolver_scope_handle.cpp +++ b/src/lapack/backends/rocsolver/rocsolver_scope_handle.cpp @@ -37,8 +37,13 @@ namespace rocsolver { * takes place if no other element in the container has a key equivalent to * the one being emplaced (keys in a map container are unique). */ +#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +thread_local rocsolver_handle RocsolverScopedContextHandler::handle_helper = + rocsolver_handle{}; +#else thread_local rocsolver_handle RocsolverScopedContextHandler::handle_helper = rocsolver_handle{}; +#endif RocsolverScopedContextHandler::RocsolverScopedContextHandler(sycl::queue queue, sycl::interop_handle &ih) @@ -95,7 +100,11 @@ rocblas_handle RocsolverScopedContextHandler::get_handle(const sycl::queue &queu hipError_t hipErr; hipCtx_t desired; HIP_ERROR_FUNC(hipDevicePrimaryCtxRetain, hipErr, &desired, hipDevice); +#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED + auto piPlacedContext_ = reinterpret_cast(desired); +#else auto piPlacedContext_ = reinterpret_cast(desired); +#endif hipStream_t streamId = get_stream(queue); rocblas_status err; auto it = handle_helper.rocsolver_handle_mapper_.find(piPlacedContext_); diff --git a/src/lapack/backends/rocsolver/rocsolver_scope_handle.hpp b/src/lapack/backends/rocsolver/rocsolver_scope_handle.hpp index 9f1bc068a..1be98a3b9 100644 --- a/src/lapack/backends/rocsolver/rocsolver_scope_handle.hpp +++ b/src/lapack/backends/rocsolver/rocsolver_scope_handle.hpp @@ -33,6 +33,18 @@ #include "rocsolver_helper.hpp" #include "rocsolver_handle.hpp" +// After Plugin Interface removal in DPC++ ur.hpp is the new include +#if __has_include() +#include +#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#endif +#elif __has_include() +#include +#else +#include +#endif + namespace oneapi { namespace mkl { namespace lapack { @@ -43,7 +55,11 @@ class RocsolverScopedContextHandler { sycl::context *placedContext_; bool needToRecover_; sycl::interop_handle &ih; +#ifdef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED + static thread_local rocsolver_handle handle_helper; +#else static thread_local rocsolver_handle handle_helper; +#endif hipStream_t get_stream(const sycl::queue &queue); sycl::context get_context(const sycl::queue &queue); diff --git a/src/lapack/backends/rocsolver/rocsolver_task.hpp b/src/lapack/backends/rocsolver/rocsolver_task.hpp index 08f8e5cea..902b2f080 100644 --- a/src/lapack/backends/rocsolver/rocsolver_task.hpp +++ b/src/lapack/backends/rocsolver/rocsolver_task.hpp @@ -32,7 +32,14 @@ #endif #include "oneapi/mkl/types.hpp" #include "rocsolver_scope_handle.hpp" -#if __has_include() + +// After Plugin Interface removal in DPC++ ur.hpp is the new include +#if __has_include() +#include +#ifndef ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#define ONEAPI_ONEMKL_PI_INTERFACE_REMOVED +#endif +#elif __has_include() #include #else #include