Skip to content

Commit bd1560b

Browse files
committed
Fix BLAS compilation with AdaptiveCpp
1. Remove unused function enqueue_deallocate in helper.h (left over from refactoring). 2. Add missing BLAS_ENABLE_COMPLEX protection in Gemm::store_packet. 3. Skip second template parameter in vec::load and vec::store when compiling with AdaptiveCpp, which doesn't support it. 4. Improve detection of using AdaptiveCpp in CMake configuration to disable complex data support.
1 parent f09710d commit bd1560b

File tree

3 files changed

+16
-25
lines changed

3 files changed

+16
-25
lines changed

onemath/sycl/blas/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ option(BLAS_ENABLE_EXTENSIONS "Whether to enable BLAS extensions" ON)
6565
option(BLAS_ENABLE_COMPLEX "Whether to enable complex data type for GEMM" ON)
6666
option(BLAS_ENABLE_HALF "Whether to enable sycl::half data type for supported operators" ON)
6767

68-
if (SYCL_COMPILER MATCHES "adaptivecpp")
68+
if (SYCL_COMPILER MATCHES "adaptivecpp" OR ${CMAKE_CXX_COMPILER} MATCHES "acpp|syclcc")
6969
if(BLAS_ENABLE_COMPLEX)
70-
message(STATUS "SYCL Complex data is not supported on AdaptiveCpp/hipSYCL. Complex
71-
data type is disabled")
70+
message(STATUS "SYCL Complex data is not supported on AdaptiveCpp/hipSYCL. Complex data type is disabled")
7271
set(BLAS_ENABLE_COMPLEX OFF)
7372
endif()
7473
endif()

onemath/sycl/blas/include/helper.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,6 @@ using add_const = typename std::conditional<
8888
typename std::remove_pointer<container_t>::type>::type>::type,
8989
container_t>::type;
9090

91-
template <typename container_t>
92-
typename std::enable_if<std::is_same<
93-
container_t, typename AllocHelper<typename ValueType<container_t>::type,
94-
AllocType::usm>::type>::value>::type
95-
enqueue_deallocate(std::vector<sycl::event> dependencies, container_t mem,
96-
sycl::queue q) {
97-
#ifdef SB_ENABLE_USM
98-
auto event = q.submit([&](sycl::handler &cgh) {
99-
cgh.depends_on(dependencies);
100-
cgh.host_task([=]() { sycl::free(mem, q); });
101-
});
102-
#endif
103-
return;
104-
}
105-
106-
template <typename container_t>
107-
typename std::enable_if<std::is_same<
108-
container_t, typename AllocHelper<typename ValueType<container_t>::type,
109-
AllocType::buffer>::type>::value>::type
110-
enqueue_deallocate(std::vector<sycl::event>, container_t mem, sycl::queue q) {}
111-
11291
inline bool has_local_memory(sycl::queue &q) {
11392
return (
11493
q.get_device().template get_info<sycl::info::device::local_mem_type>() ==

onemath/sycl/blas/src/operations/blas3/gemm_local.hpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ class Gemm<input_t, output_t, DoubleBuffer, NbcA, NbcB, ClSize, TileType,
527527
element_t *reg, OutputPointerType out_ptr) {
528528
vector_out_t out_vec{};
529529

530+
#ifdef BLAS_ENABLE_COMPLEX
530531
// This if-statement is necessary starting from late 2024 nightly, because
531532
// an update made casting raw pointers of sycl::complex to multi_ptr
532533
// ambiguous.
@@ -542,14 +543,26 @@ class Gemm<input_t, output_t, DoubleBuffer, NbcA, NbcB, ClSize, TileType,
542543

543544
out_vec.template store<address_t::global_space,
544545
sycl::access::decorated::legacy>(0, out_ptr);
545-
} else {
546+
} else
547+
#endif
548+
{
549+
#ifdef __ADAPTIVECPP__
550+
// AdaptiveCpp 24.10 doesn't support IsDecorated template parameter here
551+
out_vec.template load<address_t::private_space>(
552+
#else
546553
out_vec.template load<address_t::private_space,
547554
sycl::access::decorated::legacy>(
555+
#endif
548556
0, sycl::multi_ptr<const element_t, address_t::private_space>(reg));
549557
out_vec *= alpha_;
550558

559+
#ifdef __ADAPTIVECPP__
560+
// AdaptiveCpp 24.10 doesn't support IsDecorated template parameter here
561+
out_vec.template store<address_t::global_space>(
562+
#else
551563
out_vec.template store<address_t::global_space,
552564
sycl::access::decorated::legacy>(
565+
#endif
553566
0, sycl::multi_ptr<element_t, address_t::global_space>(out_ptr));
554567
}
555568
}

0 commit comments

Comments
 (0)