2121#define _GENERIC_BLAS_COMMON_HPP_
2222
2323#include " onemath_sycl_blas.hpp"
24+ #include " oneapi/math/detail/config.hpp"
2425#include " oneapi/math/types.hpp"
2526#include " oneapi/math/exceptions.hpp"
2627
@@ -40,9 +41,11 @@ using handle_t = ::blas::SB_Handle;
4041template <typename ElemT>
4142using buffer_iterator_t = ::blas::BufferIterator<ElemT>;
4243
44+ #ifdef ONEMATH_GENERIC_BLAS_ENABLE_COMPLEX
4345// sycl complex data type (experimental)
4446template <typename ElemT>
4547using sycl_complex_t = sycl::ext::oneapi::experimental::complex <ElemT>;
48+ #endif
4649
4750/* * A trait for obtaining equivalent onemath_sycl_blas API types from oneMath API
4851 * types.
@@ -68,8 +71,10 @@ DEF_GENERIC_BLAS_TYPE(oneapi::math::transpose, char)
6871DEF_GENERIC_BLAS_TYPE (oneapi::math::uplo, char )
6972DEF_GENERIC_BLAS_TYPE (oneapi::math::side, char )
7073DEF_GENERIC_BLAS_TYPE (oneapi::math::diag, char )
74+ #ifdef ONEMATH_GENERIC_BLAS_ENABLE_COMPLEX
7175DEF_GENERIC_BLAS_TYPE (std::complex <float >, sycl_complex_t <float >)
7276DEF_GENERIC_BLAS_TYPE(std::complex <double >, sycl_complex_t <double >)
77+ #endif
7378// Passthrough of onemath_sycl_blas arg types for more complex wrapping.
7479DEF_GENERIC_BLAS_TYPE (::blas::gemm_batch_type_t , ::blas::gemm_batch_type_t )
7580
@@ -85,6 +90,7 @@ struct generic_type<ElemT*> {
8590 using type = ElemT*;
8691};
8792
93+ #ifdef ONEMATH_GENERIC_BLAS_ENABLE_COMPLEX
8894// USM Complex
8995template <typename ElemT>
9096struct generic_type <std::complex <ElemT>*> {
@@ -95,6 +101,7 @@ template <typename ElemT>
95101struct generic_type <const std::complex <ElemT>*> {
96102 using type = const sycl_complex_t <ElemT>*;
97103};
104+ #endif
98105
99106template <>
100107struct generic_type <std::vector<sycl::event>> {
@@ -210,6 +217,10 @@ struct throw_if_unsupported_by_device {
210217 throw unimplemented (" blas" , " onemath_sycl_blas function" ); \
211218 }
212219
220+ #ifndef ONEMATH_GENERIC_BLAS_ENABLE_USM
221+ #define CALL_GENERIC_BLAS_USM_FN (genericFunc, ...) \
222+ throw unimplemented (" blas" , " onemath_sycl_blas USM API" , " - unsupported compiler" );
223+ #else
213224#define CALL_GENERIC_BLAS_USM_FN (genericFunc, ...) \
214225 if constexpr (is_column_major()) { \
215226 detail::throw_if_unsupported_by_device<double , sycl::aspect::fp64>{}( \
@@ -230,6 +241,7 @@ struct throw_if_unsupported_by_device {
230241 else { \
231242 throw unimplemented (" blas" , " onemath_sycl_blas function" ); \
232243 }
244+ #endif
233245
234246} // namespace generic
235247} // namespace blas
0 commit comments