Skip to content

Commit 09f066f

Browse files
[SYCLomatic][DPCT] Decouple sycl version check from oneDPL (#596)
Signed-off-by: Dan Hoeflinger <[email protected]>
1 parent 59e63e6 commit 09f066f

File tree

2 files changed

+24
-2
lines changed
  • clang

2 files changed

+24
-2
lines changed

clang/runtime/dpct-rt/include/dpl_extras/memory.h.inc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,27 @@ struct make_allocatable<void>
6868
};
6969
// DPCT_LABEL_END
7070

71+
// DPCT_LABEL_BEGIN|_DPCT_LIBSYCL_VERSION|dpct::detail
72+
// DPCT_DEPENDENCY_EMPTY
73+
// DPCT_CODE
74+
#if defined(__LIBSYCL_MAJOR_VERSION) && defined(__LIBSYCL_MINOR_VERSION) && \
75+
defined(__LIBSYCL_PATCH_VERSION)
76+
#define _DPCT_LIBSYCL_VERSION \
77+
(__LIBSYCL_MAJOR_VERSION * 10000 + __LIBSYCL_MINOR_VERSION * 100 + \
78+
__LIBSYCL_PATCH_VERSION)
79+
#else
80+
#define _DPCT_LIBSYCL_VERSION 0
81+
#endif
82+
// DPCT_LABEL_END
83+
7184
// DPCT_LABEL_BEGIN|__buffer_allocator|dpct::detail
7285
// DPCT_DEPENDENCY_BEGIN
7386
// DplExtrasMemory|make_allocatable
7487
// DPCT_DEPENDENCY_END
7588
// DPCT_CODE
7689
template <typename _DataT>
7790
using __buffer_allocator =
78-
#if _ONEDPL_LIBSYCL_VERSION >= 50707
91+
#if _DPCT_LIBSYCL_VERSION >= 60000
7992
sycl::buffer_allocator<typename make_allocatable<_DataT>::type>;
8093
#else
8194
sycl::buffer_allocator;

clang/test/dpct/helper_files_ref/include/dpl_extras/memory.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,18 @@ struct make_allocatable<void>
2828
using type = dpct::byte_t;
2929
};
3030

31+
#if defined(__LIBSYCL_MAJOR_VERSION) && defined(__LIBSYCL_MINOR_VERSION) && \
32+
defined(__LIBSYCL_PATCH_VERSION)
33+
#define _DPCT_LIBSYCL_VERSION \
34+
(__LIBSYCL_MAJOR_VERSION * 10000 + __LIBSYCL_MINOR_VERSION * 100 + \
35+
__LIBSYCL_PATCH_VERSION)
36+
#else
37+
#define _DPCT_LIBSYCL_VERSION 0
38+
#endif
39+
3140
template <typename _DataT>
3241
using __buffer_allocator =
33-
#if _ONEDPL_LIBSYCL_VERSION >= 50707
42+
#if _DPCT_LIBSYCL_VERSION >= 60000
3443
sycl::buffer_allocator<typename make_allocatable<_DataT>::type>;
3544
#else
3645
sycl::buffer_allocator;

0 commit comments

Comments
 (0)