Skip to content

Commit 5f0eeba

Browse files
authored
[ESIMD] Add slm_init<compile_time_constant>() version. (#6083)
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
1 parent 9749efa commit 5f0eeba

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,13 @@ __ESIMD_API void barrier() {
798798
/// @{
799799

800800
/// Declare per-work-group slm size.
801+
/// @tparam SLMSize Shared Local Memory (SLM) size
802+
template <uint32_t SLMSize> __ESIMD_API void slm_init() {
803+
__esimd_slm_init(SLMSize);
804+
}
805+
806+
/// Declare per-work-group slm size. Non-constant argument version to be used
807+
/// with specialization constants only.
801808
/// @param size Shared Local Memory (SLM) size
802809
__ESIMD_API void slm_init(uint32_t size) { __esimd_slm_init(size); }
803810

sycl/test/esimd/genx_func_attr.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// RUN: FileCheck %s -input-file=%t_esimd_0.ll
44

55
// Checks ESIMD intrinsic translation.
6-
// NOTE: must be run in -O0, as optimizer optimizes away some of the code
76

87
#include <CL/sycl.hpp>
98
#include <CL/sycl/detail/image_ocl_types.hpp>
@@ -17,7 +16,7 @@ __attribute__((sycl_kernel)) void kernel(Func kernelFunc) {
1716
}
1817

1918
SYCL_ESIMD_FUNCTION SYCL_EXTERNAL ESIMD_NOINLINE void callee(int x) {
20-
slm_init(1234);
19+
slm_init<1234>();
2120
sycl::ext::intel::experimental::esimd::named_barrier_init<13>();
2221
}
2322

@@ -30,7 +29,7 @@ void caller_abc(int x) {
3029
// inherits only NBarrierCount from callee
3130
void caller_xyz(int x) {
3231
kernel<class kernel_xyz>([=]() SYCL_ESIMD_KERNEL {
33-
slm_init(1235);
32+
slm_init(1235); // also works in non-O0
3433
callee(x);
3534
});
3635
// CHECK: define dso_local spir_kernel void @_ZTSZ10caller_xyziE10kernel_xyz(i32 noundef "VCArgumentIOKind"="0" %{{.*}}) local_unnamed_addr #3

sycl/test/esimd/slm_gather_scatter_rgba.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void caller() SYCL_ESIMD_FUNCTION {
1111
simd<uint32_t, 32> offsets(0, sizeof(int) * 4);
1212
simd<int, 128> v1(0, 1);
1313

14-
slm_init(1024);
14+
slm_init<1024>();
1515

1616
auto v0 = slm_gather_rgba<int, 32, rgba_channel_mask::ABGR>(offsets);
1717

0 commit comments

Comments
 (0)