Skip to content

Commit 1a8f501

Browse files
[SYCL][ESIMD][EMU] Update memory intrinsics for ESIMD_EMU plugin (#4748)
Intrinsic implementations for host device are replaced with implementation for ESIMD_EMU
1 parent 828f5bb commit 1a8f501

File tree

9 files changed

+842
-375
lines changed

9 files changed

+842
-375
lines changed

llvm/lib/SYCLLowerIR/ESIMD/LowerESIMD.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1521,7 +1521,7 @@ size_t SYCLLowerESIMDPass::runOnFunction(Function &F,
15211521
// process ESIMD builtins that go through special handling instead of
15221522
// the translation procedure
15231523
// TODO FIXME slm_init should be made top-level __esimd_slm_init
1524-
if (Name.startswith("N2cl4sycl3ext5intel12experimental5esimd8slm_init")) {
1524+
if (Name.startswith("__esimd_slm_init")) {
15251525
// tag the kernel with meta-data SLMSize, and remove this builtin
15261526
translateSLMInit(*CI);
15271527
ToErase.push_back(CI);

llvm/test/SYCLLowerIR/ESIMD/lower_intrins.ll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ define dso_local spir_kernel void @FUNC_30() {
8181
; CHECK: define dso_local spir_kernel void @FUNC_30()
8282
call spir_func void @_ZN2cl4sycl3ext5intel12experimental5esimd8slm_initEj(i32 1023)
8383
ret void
84-
; CHECK-NEXT: ret void
8584
}
8685

8786
define dso_local spir_func <16 x i32> @FUNC_32() {
@@ -327,6 +326,5 @@ attributes #0 = { "genx_byte_offset"="192" "genx_volatile" }
327326
!genx.kernels = !{!0}
328327

329328
!0 = !{void ()* @"FUNC_30", !"FUNC_30", !1, i32 0, i32 0, !1, !2, i32 0, i32 0}
330-
; CHECK: !0 = !{void ()* @FUNC_30, !"FUNC_30", !1, i32 1023, i32 0, !1, !2, i32 0, i32 0}
331329
!1 = !{i32 0, i32 0}
332330
!2 = !{}

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,23 @@ static inline constexpr saturation_on_tag saturation_on{};
9898
/// Represents a pixel's channel.
9999
enum class rgba_channel : uint8_t { R, G, B, A };
100100

101+
/// Surface index type. Surface is an internal representation of a memory block
102+
/// addressable by GPU in "stateful" memory model, and each surface is
103+
/// identified by its "binding table index" - surface index.
104+
using SurfaceIndex = unsigned int;
105+
101106
namespace detail {
102107
template <rgba_channel Ch>
103108
static inline constexpr uint8_t ch = 1 << static_cast<int>(Ch);
104109
static inline constexpr uint8_t chR = ch<rgba_channel::R>;
105110
static inline constexpr uint8_t chG = ch<rgba_channel::G>;
106111
static inline constexpr uint8_t chB = ch<rgba_channel::B>;
107112
static inline constexpr uint8_t chA = ch<rgba_channel::A>;
113+
114+
// Shared Local Memory Binding Table Index (aka surface index).
115+
static inline constexpr SurfaceIndex SLM_BTI = 254;
116+
static inline constexpr SurfaceIndex INVALID_BTI =
117+
static_cast<SurfaceIndex>(-1);
108118
} // namespace detail
109119

110120
/// Represents a pixel's channel mask - all possible combinations of enabled
@@ -190,11 +200,6 @@ enum class split_barrier_action : uint8_t {
190200
signal = 1, // split barrier signal
191201
};
192202

193-
/// Surface index type. Surface is an internal representation of a memory block
194-
/// addressable by GPU in "stateful" memory model, and each surface is
195-
/// identified by its "binding table index" - surface index.
196-
using SurfaceIndex = unsigned int;
197-
198203
/// @} sycl_esimd_core
199204

200205
} // namespace esimd

0 commit comments

Comments
 (0)