Skip to content

Commit fe8d852

Browse files
authored
[SYCL] Add 64-bit type support to load/store sub-group functions (#1999)
Also, correct select_cl_scalar_integral_xxx type transformation naming typo. Signed-off-by: Dmitri Mokhov <[email protected]>
1 parent 15e37a8 commit fe8d852

File tree

4 files changed

+39
-11
lines changed

4 files changed

+39
-11
lines changed

sycl/include/CL/__spirv/spirv_ops.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,15 @@ __SYCL_CONVERGENT__ extern SYCL_EXTERNAL void
205205
__spirv_SubgroupBlockWriteINTEL(__attribute__((opencl_global)) uint32_t *Ptr,
206206
dataT Data) noexcept;
207207

208+
template <typename dataT>
209+
__SYCL_CONVERGENT__ extern SYCL_EXTERNAL dataT __spirv_SubgroupBlockReadINTEL(
210+
const __attribute__((opencl_global)) uint64_t *Ptr) noexcept;
211+
212+
template <typename dataT>
213+
__SYCL_CONVERGENT__ extern SYCL_EXTERNAL void
214+
__spirv_SubgroupBlockWriteINTEL(__attribute__((opencl_global)) uint64_t *Ptr,
215+
dataT Data) noexcept;
216+
208217
template <typename dataT>
209218
extern SYCL_EXTERNAL int32_t __spirv_ReadPipe(RPipeTy<dataT> Pipe, dataT *Data,
210219
int32_t Size,

sycl/include/CL/sycl/detail/generic_type_traits.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,12 @@ using select_apply_cl_scalar_t =
367367

368368
// Shortcuts for selecting scalar int/unsigned int/fp type.
369369
template <typename T>
370-
using select_cl_scalar_intergal_signed_t =
370+
using select_cl_scalar_integral_signed_t =
371371
select_apply_cl_scalar_t<T, sycl::cl_char, sycl::cl_short, sycl::cl_int,
372372
sycl::cl_long>;
373373

374374
template <typename T>
375-
using select_cl_scalar_intergal_unsigned_t =
375+
using select_cl_scalar_integral_unsigned_t =
376376
select_apply_cl_scalar_t<T, sycl::cl_uchar, sycl::cl_ushort, sycl::cl_uint,
377377
sycl::cl_ulong>;
378378

@@ -382,16 +382,16 @@ using select_cl_scalar_float_t =
382382
sycl::cl_double>;
383383

384384
template <typename T>
385-
using select_cl_scalar_intergal_t =
385+
using select_cl_scalar_integral_t =
386386
conditional_t<std::is_signed<T>::value,
387-
select_cl_scalar_intergal_signed_t<T>,
388-
select_cl_scalar_intergal_unsigned_t<T>>;
387+
select_cl_scalar_integral_signed_t<T>,
388+
select_cl_scalar_integral_unsigned_t<T>>;
389389

390390
// select_cl_scalar_t picks corresponding cl_* type for input
391391
// scalar T or returns T if T is not scalar.
392392
template <typename T>
393393
using select_cl_scalar_t = conditional_t<
394-
std::is_integral<T>::value, select_cl_scalar_intergal_t<T>,
394+
std::is_integral<T>::value, select_cl_scalar_integral_t<T>,
395395
conditional_t<
396396
std::is_floating_point<T>::value, select_cl_scalar_float_t<T>,
397397
// half is a special case: it is implemented differently on host and

sycl/include/CL/sycl/intel/sub_group.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,9 @@ __SYCL_SG_GENERATE_BODY_2ARG(shuffle_up, SubgroupShuffleUpINTEL)
5555

5656
#undef __SYCL_SG_GENERATE_BODY_2ARG
5757

58-
// Selects 8-bit, 16-bit or 32-bit type depending on size of T. If T doesn't
59-
// maps to mentioned types, then void is returned
58+
// Selects 8, 16, 32, or 64-bit type depending on size of scalar type T.
6059
template <typename T>
61-
using SelectBlockT =
62-
select_apply_cl_scalar_t<T, uint8_t, uint16_t, uint32_t, void>;
60+
using SelectBlockT = select_cl_scalar_integral_unsigned_t<T>;
6361

6462
template <typename T, access::address_space Space>
6563
using AcceptableForGlobalLoadStore =

sycl/test/sub_group/load_store.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ template <typename T> void check(queue &Queue) {
158158
int main() {
159159
queue Queue;
160160
if (!Queue.get_device().has_extension("cl_intel_subgroups") &&
161-
!Queue.get_device().has_extension("cl_intel_subgroups_short")) {
161+
!Queue.get_device().has_extension("cl_intel_subgroups_short") &&
162+
!Queue.get_device().has_extension("cl_intel_subgroups_long")) {
162163
std::cout << "Skipping test\n";
163164
return 0;
164165
}
@@ -200,6 +201,26 @@ int main() {
200201
check<aligned_half, 8>(Queue);
201202
}
202203
}
204+
if (Queue.get_device().has_extension("cl_intel_subgroups_long")) {
205+
typedef long aligned_long __attribute__((aligned(16)));
206+
check<aligned_long>(Queue);
207+
check<aligned_long, 1>(Queue);
208+
check<aligned_long, 2>(Queue);
209+
check<aligned_long, 4>(Queue);
210+
check<aligned_long, 8>(Queue);
211+
typedef unsigned long aligned_ulong __attribute__((aligned(16)));
212+
check<aligned_ulong>(Queue);
213+
check<aligned_ulong, 1>(Queue);
214+
check<aligned_ulong, 2>(Queue);
215+
check<aligned_ulong, 4>(Queue);
216+
check<aligned_ulong, 8>(Queue);
217+
typedef double aligned_double __attribute__((aligned(16)));
218+
check<aligned_double>(Queue);
219+
check<aligned_double, 1>(Queue);
220+
check<aligned_double, 2>(Queue);
221+
check<aligned_double, 4>(Queue);
222+
check<aligned_double, 8>(Queue);
223+
}
203224
std::cout << "Test passed." << std::endl;
204225
return 0;
205226
}

0 commit comments

Comments
 (0)