Skip to content

Commit 8ec7dea

Browse files
committed
address review comments
Signed-off-by: kbobrovs <[email protected]>
1 parent 464c23e commit 8ec7dea

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

sycl/include/CL/sycl/INTEL/esimd/detail/esimd_sycl_util.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,9 @@ struct is_sycl_accessor_with
7474
(is_sycl_accessor<T>::target == AccessTarget),
7575
std::true_type, std::false_type> {};
7676

77-
#define __ESIMD_ENABLE_IF_ACCESSOR(T, acc_capability, acc_target, ret_type) \
78-
sycl::detail::enable_if_t<detail::is_sycl_accessor_with< \
79-
T, detail::accessor_mode_cap::acc_capability, \
80-
sycl::access::target::acc_target>::value, \
81-
ret_type>
77+
template <typename T, accessor_mode_cap_val_t Capability, sycl::access::target AccessTarget, typename RetT>
78+
using EnableIfAccessor =
79+
sycl::detail::enable_if_t<detail::is_sycl_accessor_with<T, Capability, AccessTarget>::value, RetT>;
8280

8381
} // namespace detail
8482
} // namespace gpu

sycl/include/CL/sycl/INTEL/esimd/esimd.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,7 @@ template <typename Ty, int N> class simd {
503503
/// @param acc accessor to copy from.
504504
/// @param offset offset to copy from.
505505
template <typename AccessorT>
506-
ESIMD_INLINE __ESIMD_ENABLE_IF_ACCESSOR(AccessorT, can_read, global_buffer,
507-
void)
506+
ESIMD_INLINE EnableIfAccessor<AccessorT, accessor_mode_cap::can_read, sycl::access::target::global_buffer, void>
508507
copy_from(AccessorT acc, uint32_t offset) SYCL_ESIMD_FUNCTION;
509508

510509
/// Copy all vector elements of this object into a contiguous block in memory.
@@ -518,9 +517,8 @@ template <typename Ty, int N> class simd {
518517
/// @param acc accessor to copy from.
519518
/// @param offset offset to copy from.
520519
template <typename AccessorT>
521-
ESIMD_INLINE __ESIMD_ENABLE_IF_ACCESSOR(AccessorT, can_write, global_buffer,
522-
void)
523-
copy_to(AccessorT acc, uint32_t offset) SYCL_ESIMD_FUNCTION;
520+
ESIMD_INLINE EnableIfAccessor<AccessorT, accessor_mode_cap::can_write, sycl::access::target::global_buffer, void>
521+
copy_to(AccessorT acc, uint32_t offset) SYCL_ESIMD_FUNCTION;
524522

525523
/// @} // Memory operations
526524
private:
@@ -562,7 +560,7 @@ template <typename T, int N> void simd<T, N>::copy_from(const T *const addr) {
562560

563561
template <typename T, int N>
564562
template <typename AccessorT>
565-
__ESIMD_ENABLE_IF_ACCESSOR(AccessorT, can_read, global_buffer, void)
563+
ESIMD_INLINE EnableIfAccessor<AccessorT, accessor_mode_cap::can_read, sycl::access::target::global_buffer, void>
566564
simd<T, N>::copy_from(AccessorT acc, uint32_t offset) {
567565
constexpr unsigned Sz = sizeof(T) * N;
568566
static_assert(Sz >= detail::OperandSize::OWORD,
@@ -599,7 +597,7 @@ template <typename T, int N> void simd<T, N>::copy_to(T *addr) {
599597

600598
template <typename T, int N>
601599
template <typename AccessorT>
602-
__ESIMD_ENABLE_IF_ACCESSOR(AccessorT, can_write, global_buffer, void)
600+
ESIMD_INLINE EnableIfAccessor<AccessorT, accessor_mode_cap::can_write, sycl::access::target::global_buffer, void>
603601
simd<T, N>::copy_to(AccessorT acc, uint32_t offset) {
604602
constexpr unsigned Sz = sizeof(T) * N;
605603
static_assert(Sz >= detail::OperandSize::OWORD,

sycl/test/esimd/block_load_store.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,8 @@
88
using namespace sycl::INTEL::gpu;
99
using namespace cl::sycl;
1010

11-
#ifdef __SYCL_DEVICE_ONLY__
12-
#define __SYCL_DEVICE_ATTR __attribute__((sycl_device))
13-
#else
14-
#define __SYCL_DEVICE_ATTR
15-
#endif // __SYCL_DEVICE_ONLY__
16-
17-
void kernel1(accessor<int, 1, access::mode::read_write,
18-
access::target::global_buffer> &buf) __SYCL_DEVICE_ATTR {
11+
SYCL_EXTERNAL void kernel1(accessor<int, 1, access::mode::read_write,
12+
access::target::global_buffer> &buf) SYCL_ESIMD_FUNCTION {
1913
simd<int, 32> v1(0, 1);
2014
// expected-warning@+2 {{deprecated}}
2115
// expected-note@CL/sycl/INTEL/esimd/esimd_memory.hpp:188 {{}}
@@ -26,7 +20,7 @@ void kernel1(accessor<int, 1, access::mode::read_write,
2620
block_store<int, 32>(buf, 0, v0);
2721
}
2822

29-
void kernel2(int *ptr) __SYCL_DEVICE_ATTR {
23+
SYCL_EXTERNAL void kernel2(int *ptr) SYCL_ESIMD_FUNCTION {
3024
simd<int, 32> v1(0, 1);
3125
// expected-warning@+2 {{deprecated}}
3226
// expected-note@CL/sycl/INTEL/esimd/esimd_memory.hpp:169 {{}}

0 commit comments

Comments
 (0)