Skip to content

Commit ed596ec

Browse files
authored
[SYCL][Matrix] Make sure joint matrix API is only used by CUDA and SPIR backends (#8042)
Adding static assert to make sure joint matrix API is only used by CUDA, SPIR backends
1 parent 77d25cd commit ed596ec

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

sycl/include/sycl/detail/defines.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
#define __SYCL_TYPE(x)
4141
#endif
4242

43+
// joint matrix should only be included by default for SPIR or NVPTX backends
44+
#if defined __SPIR__ || defined __NVPTX__ || !defined __SYCL_DEVICE_ONLY__
4345
#ifndef SYCL_EXT_ONEAPI_MATRIX_VERSION
4446
#define SYCL_EXT_ONEAPI_MATRIX_VERSION 4
4547
#endif // SYCL_EXT_ONEAPI_MATRIX_VERSION
48+
#endif // __SPIR__ || __NVPTX__ || !__SYCL_DEVICE_ONLY

sycl/include/sycl/ext/oneapi/matrix/matrix-unified.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ struct joint_matrix {
2424
#if defined(__NVPTX__)
2525
sycl::ext::oneapi::detail::joint_matrix_cuda<T, Use, Rows, Cols, Layout>
2626
cuda_impl;
27-
#else
27+
#elif defined(__SPIR__)
2828
__spv::__spirv_JointMatrixINTEL<
2929
T, Rows, Cols, spv_matrix_layout_traits<Layout>::value,
3030
spv_scope_traits<Group>::value, spv_matrix_use_traits<Use>::value> *spvm;
31+
#else
32+
static_assert(
33+
false,
34+
"The joint_matrix API is only supported by the Intel and CUDA backends");
3135
#endif // defined(__NVPTX__)
3236
#endif // defined(__SYCL_DEVICE_ONLY__)
3337

0 commit comments

Comments
 (0)