Skip to content

[ESIMD] Add slm_init<compile_time_constant>() version. #6083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions sycl/include/sycl/ext/intel/esimd/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,13 @@ __ESIMD_API void barrier() {
/// @{

/// Declare per-work-group slm size.
/// @tparam SLMSize Shared Local Memory (SLM) size
template <uint32_t SLMSize> __ESIMD_API void slm_init() {
__esimd_slm_init(SLMSize);
}

/// Declare per-work-group slm size. Non-constant argument version to be used
/// with specialization constants only.
/// @param size Shared Local Memory (SLM) size
__ESIMD_API void slm_init(uint32_t size) { __esimd_slm_init(size); }

Expand Down
5 changes: 2 additions & 3 deletions sycl/test/esimd/genx_func_attr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// RUN: FileCheck %s -input-file=%t_esimd_0.ll

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

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

SYCL_ESIMD_FUNCTION SYCL_EXTERNAL ESIMD_NOINLINE void callee(int x) {
slm_init(1234);
slm_init<1234>();
sycl::ext::intel::experimental::esimd::named_barrier_init<13>();
}

Expand All @@ -30,7 +29,7 @@ void caller_abc(int x) {
// inherits only NBarrierCount from callee
void caller_xyz(int x) {
kernel<class kernel_xyz>([=]() SYCL_ESIMD_KERNEL {
slm_init(1235);
slm_init(1235); // also works in non-O0
callee(x);
});
// CHECK: define dso_local spir_kernel void @_ZTSZ10caller_xyziE10kernel_xyz(i32 noundef "VCArgumentIOKind"="0" %{{.*}}) local_unnamed_addr #3
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/esimd/slm_gather_scatter_rgba.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void caller() SYCL_ESIMD_FUNCTION {
simd<uint32_t, 32> offsets(0, sizeof(int) * 4);
simd<int, 128> v1(0, 1);

slm_init(1024);
slm_init<1024>();

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

Expand Down