Skip to content

Commit e9a6bf9

Browse files
Allowed 1- and 2-byte types in slm_load/store
1 parent ea04ef5 commit e9a6bf9

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

sycl/include/sycl/ext/intel/experimental/esimd/memory.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ SYCL_EXTERNAL SYCL_ESIMD_FUNCTION void slm_init(uint32_t size);
654654
/// Only allow simd-16 and simd-32.
655655
template <typename T, int n>
656656
ESIMD_INLINE ESIMD_NODEBUG
657-
typename sycl::detail::enable_if_t<(n == 16 || n == 32) && (sizeof(T) == 4),
657+
typename sycl::detail::enable_if_t<(n == 16 || n == 32) && (sizeof(T) <= 4),
658658
simd<T, n>>
659659
slm_load(simd<uint32_t, n> offsets, simd<uint16_t, n> pred = 1) {
660660
return __esimd_slm_read<T, n>(offsets.data(), pred.data());
@@ -663,7 +663,7 @@ ESIMD_INLINE ESIMD_NODEBUG
663663
/// SLM scatter.
664664
template <typename T, int n>
665665
ESIMD_INLINE ESIMD_NODEBUG
666-
typename sycl::detail::enable_if_t<(n == 16 || n == 32) && (sizeof(T) == 4),
666+
typename sycl::detail::enable_if_t<(n == 16 || n == 32) && (sizeof(T) <= 4),
667667
void>
668668
slm_store(simd<T, n> vals, simd<uint32_t, n> offsets,
669669
simd<uint16_t, n> pred = 1) {

sycl/test/esimd/slm_load.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ void kernel() __attribute__((sycl_device)) {
1313
simd<int, 32> v1(0, 1);
1414

1515
auto v0 = slm_load<int, 32>(offsets);
16-
auto v2 = slm_load<float, 32>(offsets);
17-
// expected-error@+2 {{no matching function for call to 'slm_load'}}
18-
// expected-note@sycl/ext/intel/experimental/esimd/memory.hpp:* {{candidate template ignored}}
19-
auto v3 = slm_load<double, 32>(offsets);
2016

2117
esimd_fence(3);
2218
esimd_barrier();
@@ -25,3 +21,23 @@ void kernel() __attribute__((sycl_device)) {
2521

2622
slm_store<int, 32>(v0, offsets);
2723
}
24+
25+
void slm_supported_types() __attribute__((sycl_device)) {
26+
simd<uint32_t, 32> offsets(0, 1);
27+
auto v1 = slm_load<char, 32>(offsets);
28+
auto v2 = slm_load<short, 32>(offsets);
29+
auto v3 = slm_load<int, 32>(offsets);
30+
auto v4 = slm_load<float, 32>(offsets);
31+
// expected-error@+2 {{no matching function for call to 'slm_load'}}
32+
// expected-note@sycl/ext/intel/experimental/esimd/memory.hpp:* {{candidate template ignored}}
33+
auto v5 = slm_load<double, 32>(offsets);
34+
35+
slm_store<char, 32>(v1, offsets);
36+
slm_store<short, 32>(v2, offsets);
37+
slm_store<int, 32>(v3, offsets);
38+
slm_store<float, 32>(v4, offsets);
39+
simd<double, 32> v6(0, 1);
40+
// expected-error@+2 {{no matching function for call to 'slm_store'}}
41+
// expected-note@sycl/ext/intel/experimental/esimd/memory.hpp:* {{candidate template ignored}}
42+
slm_store<double, 32>(v6, offsets);
43+
}

0 commit comments

Comments
 (0)