Skip to content
Merged
4 changes: 2 additions & 2 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ endif()
# TODO : Remove 'if (NOT MSVC)' when CM_EMU supports Windows
# environment
if (NOT MSVC)
if (SYCL_BUILD_PI_ESIMD_CPU)
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS pi_esimd_cpu libcmrt-headers)
if (SYCL_BUILD_PI_ESIMD_EMU)
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS pi_esimd_emu libcmrt-headers)
if (MSVC)
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS libcmrt-libs libcmrt-dlls)
else()
Expand Down
6 changes: 3 additions & 3 deletions sycl/include/CL/sycl/backend_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ enum class backend : char {
ext_oneapi_level_zero,
cuda = 3,
all = 4,
esimd_cpu = 5,
esimd_emu = 5,
hip = 6,
};

Expand Down Expand Up @@ -55,8 +55,8 @@ inline std::ostream &operator<<(std::ostream &Out, backend be) {
case backend::cuda:
Out << "cuda";
break;
case backend::esimd_cpu:
Out << "esimd_cpu";
case backend::esimd_emu:
Out << "esimd_emu";
break;
case backend::hip:
Out << "hip";
Expand Down
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/detail/pi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ bool trace(TraceLevel level);
#define __SYCL_OPENCL_PLUGIN_NAME "pi_opencl.dll"
#define __SYCL_LEVEL_ZERO_PLUGIN_NAME "pi_level_zero.dll"
#define __SYCL_CUDA_PLUGIN_NAME "pi_cuda.dll"
#define __SYCL_ESIMD_CPU_PLUGIN_NAME "pi_esimd_cpu.dll"
#define __SYCL_ESIMD_EMU_PLUGIN_NAME "pi_esimd_emu.dll"
#define __SYCL_HIP_PLUGIN_NAME "libpi_hip.dll"
#else
#define __SYCL_OPENCL_PLUGIN_NAME "libpi_opencl.so"
#define __SYCL_LEVEL_ZERO_PLUGIN_NAME "libpi_level_zero.so"
#define __SYCL_CUDA_PLUGIN_NAME "libpi_cuda.so"
#define __SYCL_ESIMD_CPU_PLUGIN_NAME "libpi_esimd_cpu.so"
#define __SYCL_ESIMD_EMU_PLUGIN_NAME "libpi_esimd_emu.so"
#define __SYCL_HIP_PLUGIN_NAME "libpi_hip.so"
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

/// \file esimd_emu_functions_v1.h
///
/// \ingroup sycl_pi_esimd_cpu
/// \ingroup sycl_pi_esimd_emu

#pragma once

// <cstdint> for 'uint32_t' type is included in upper-level device
// interface file ('esimdcpu_device_interface.hpp')
// interface file ('esimdemu_device_interface.hpp')

// This file defines function interfaces for ESIMD CPU Emulation
// (ESIMD_CPU) to access LibCM CPU emulation functionalities from
// (ESIMD_EMU) to access LibCM CPU emulation functionalities from
// kernel applications running under emulation

// CM CPU Emulation Info :
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
//==----- esimdcpu_device_interface.hpp - DPC++ Explicit SIMD API ---------==//
//==----- esimdemu_device_interface.hpp - DPC++ Explicit SIMD API ---------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

/// \file esimdcpu_device_interface.hpp
/// Declarations for ESIMD_CPU-device specific definitions.
/// \file esimdemu_device_interface.hpp
/// Declarations for ESIMD_EMU-device specific definitions.
/// ESIMD intrinsic and LibCM functionalities required by intrinsic defined
///
/// This interface is for ESIMD intrinsic emulation implementations
/// such as slm_access to access ESIMD_CPU specific-support therefore
/// such as slm_access to access ESIMD_EMU specific-support therefore
/// it has to be defined and shared as include directory
///
/// \ingroup sycl_pi_esimd_cpu
/// \ingroup sycl_pi_esimd_emu

#pragma once

Expand All @@ -35,7 +35,7 @@ namespace detail {
#define ESIMD_DEVICE_INTERFACE_VERSION 1

// 'ESIMDDeviceInterface' structure defines interface for ESIMD CPU
// emulation (ESIMD_CPU) to access LibCM CPU emulation functionalities
// emulation (ESIMD_EMU) to access LibCM CPU emulation functionalities
// from kernel application under emulation.

// Header files included in the structure contains only function
Expand Down Expand Up @@ -75,7 +75,7 @@ ESIMDDeviceInterface *getESIMDDeviceInterface() {
// tight loop)
void *PIOpaqueData = nullptr;

PIOpaqueData = getPluginOpaqueData<cl::sycl::backend::esimd_cpu>(nullptr);
PIOpaqueData = getPluginOpaqueData<cl::sycl::backend::esimd_emu>(nullptr);

ESIMDEmuPluginOpaqueData *OpaqueData =
reinterpret_cast<ESIMDEmuPluginOpaqueData *>(PIOpaqueData);
Expand Down
4 changes: 2 additions & 2 deletions sycl/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ add_subdirectory(level_zero)
# TODO : Remove 'if (NOT MSVC)' when CM_EMU supports Windows
# environment
if (NOT MSVC)
if (SYCL_BUILD_PI_ESIMD_CPU)
add_subdirectory(esimd_cpu)
if (SYCL_BUILD_PI_ESIMD_EMU)
add_subdirectory(esimd_emu)
endif()
endif()
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

# PI Esimd CPU library
# Create Shared library for libpi_esimd_cpu.so.
# Create Shared library for libpi_esimd_emu.so.

include(ExternalProject)

include_directories("${sycl_inc_dir}")
# FIXME/TODO: 'pi.h' is included in 'pi_esimd_cpu.cpp', and CL_*_INTEL
# FIXME/TODO: 'pi.h' is included in 'pi_esimd_emu.cpp', and CL_*_INTEL
# and CL_*_KHR definitions in 'pi.h' are from
# ${OPENCL_INCLUDE}. Remove build dependency on OpenCL
include_directories(${OpenCL_INCLUDE_DIR})
Expand All @@ -14,11 +14,11 @@ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_build)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install)

if (MSVC)
set(LIBCM ${LLVM_BINARY_DIR}/pi_esimd_cpu_deps/lib/libcm${CMAKE_STATIC_LIBRARY_SUFFIX})
set(LIBIGFXCMRT_EMU ${LLVM_BINARY_DIR}/pi_esimd_cpu_deps/lib/igfxcmrt64_emu${CMAKE_STATIC_LIBRARY_SUFFIX})
set(LIBCM ${LLVM_BINARY_DIR}/pi_esimd_emu_deps/lib/libcm${CMAKE_STATIC_LIBRARY_SUFFIX})
set(LIBIGFXCMRT_EMU ${LLVM_BINARY_DIR}/pi_esimd_emu_deps/lib/igfxcmrt64_emu${CMAKE_STATIC_LIBRARY_SUFFIX})
else()
set(LIBCM ${LLVM_BINARY_DIR}/pi_esimd_cpu_deps/lib/libcm${CMAKE_SHARED_LIBRARY_SUFFIX})
set(LIBIGFXCMRT_EMU ${LLVM_BINARY_DIR}/pi_esimd_cpu_deps/lib/libigfxcmrt_emu${CMAKE_SHARED_LIBRARY_SUFFIX})
set(LIBCM ${LLVM_BINARY_DIR}/pi_esimd_emu_deps/lib/libcm${CMAKE_SHARED_LIBRARY_SUFFIX})
set(LIBIGFXCMRT_EMU ${LLVM_BINARY_DIR}/pi_esimd_emu_deps/lib/libigfxcmrt_emu${CMAKE_SHARED_LIBRARY_SUFFIX})
endif()

if (DEFINED CM_LOCAL_SOURCE_DIR)
Expand Down Expand Up @@ -75,13 +75,13 @@ else ()
endif()
endif ()
ExternalProject_Add_Step(cm-emu llvminstall
COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVM_BINARY_DIR}/pi_esimd_cpu_deps && ${CMAKE_COMMAND} -E copy_directory <INSTALL_DIR>/ ${LLVM_BINARY_DIR}/pi_esimd_cpu_deps
COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVM_BINARY_DIR}/pi_esimd_emu_deps && ${CMAKE_COMMAND} -E copy_directory <INSTALL_DIR>/ ${LLVM_BINARY_DIR}/pi_esimd_emu_deps
COMMENT "Installing cm-emu into the LLVM binary directory"
DEPENDEES install
)

include_directories(${LLVM_BINARY_DIR}/pi_esimd_cpu_deps/include/igfxcmrt_emu)
include_directories(${LLVM_BINARY_DIR}/pi_esimd_cpu_deps/include/libcm/cm)
include_directories(${LLVM_BINARY_DIR}/pi_esimd_emu_deps/include/igfxcmrt_emu)
include_directories(${LLVM_BINARY_DIR}/pi_esimd_emu_deps/include/libcm/cm)

# Compilation flag to exclude lines in header files imported from CM
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__SYCL_EXPLICIT_SIMD_PLUGIN__")
Expand All @@ -96,43 +96,43 @@ else()
string(REPLACE "-pedantic" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()

add_library(pi_esimd_cpu SHARED
add_library(pi_esimd_emu SHARED
"${sycl_inc_dir}/CL/sycl/detail/pi.h"
"pi_esimd_cpu.cpp"
"pi_esimd_emu.cpp"
)

if (MSVC)
# by defining __SYCL_BUILD_SYCL_DLL, we can use __declspec(dllexport)
# which are individually tagged for all pi* symbols in pi.h
target_compile_definitions(pi_esimd_cpu PRIVATE __SYCL_BUILD_SYCL_DLL)
target_compile_definitions(pi_esimd_emu PRIVATE __SYCL_BUILD_SYCL_DLL)
else()
# we set the visibility of all symbols 'hidden' by default.
# In pi.h file, we set exported symbols with visibility==default individually
target_compile_options(pi_esimd_cpu PUBLIC -fvisibility=hidden)
target_compile_options(pi_esimd_emu PUBLIC -fvisibility=hidden)

# This script file is used to allow exporting pi* symbols only.
# All other symbols are regarded as local (hidden)
set(linker_script "${CMAKE_CURRENT_SOURCE_DIR}/../ld-version-script.txt")

# Filter symbols based on the scope defined in the script file,
# and export pi* function symbols in the library.
target_link_libraries( pi_esimd_cpu
target_link_libraries( pi_esimd_emu
PRIVATE "-Wl,--version-script=${linker_script}"
)
endif()

add_dependencies(pi_esimd_cpu OpenCL-Headers)
add_dependencies(pi_esimd_cpu cm-emu)
add_dependencies(sycl-toolchain pi_esimd_cpu)
add_dependencies(pi_esimd_emu OpenCL-Headers)
add_dependencies(pi_esimd_emu cm-emu)
add_dependencies(sycl-toolchain pi_esimd_emu)

target_link_libraries(pi_esimd_cpu PRIVATE sycl ${LIBCM} ${LIBIGFXCMRT_EMU})
set_target_properties(pi_esimd_cpu PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(pi_esimd_emu PRIVATE sycl ${LIBCM} ${LIBIGFXCMRT_EMU})
set_target_properties(pi_esimd_emu PROPERTIES LINKER_LANGUAGE CXX)

add_common_options(pi_esimd_cpu)
add_common_options(pi_esimd_emu)

install(TARGETS pi_esimd_cpu
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT pi_esimd_cpu
RUNTIME DESTINATION "bin" COMPONENT pi_esimd_cpu)
install(TARGETS pi_esimd_emu
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT pi_esimd_emu
RUNTIME DESTINATION "bin" COMPONENT pi_esimd_emu)

# Copy CM Header files to $(INSTALL)/include/sycl/CL/
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install/include/libcm/cm/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
//===---------- pi_esimd_cpu.cpp - CM Emulation Plugin --------------------===//
//===---------- pi_esimd_emu.cpp - CM Emulation Plugin --------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

/// \file pi_esimd_cpu.cpp
/// \file pi_esimd_emu.cpp
/// Declarations for CM Emulation Plugin. It is the interface between the
/// device-agnostic SYCL runtime layer and underlying CM Emulation
///
/// \ingroup sycl_pi_esimd_cpu
/// \ingroup sycl_pi_esimd_emu

#include <stdint.h>

Expand All @@ -28,7 +28,7 @@
#include <CL/sycl/nd_item.hpp>
#include <CL/sycl/range.hpp>

#include <esimdcpu_support.h>
#include <esimdemu_support.h>

#include <cstdarg>
#include <cstdio>
Expand All @@ -40,7 +40,7 @@
#include <thread>
#include <utility>

#include "pi_esimd_cpu.hpp"
#include "pi_esimd_emu.hpp"

namespace {

Expand Down Expand Up @@ -108,7 +108,7 @@ class ReturnHelper {
// Controls PI level tracing prints.
static bool PrintPiTrace = false;

// Global variables used in PI_esimd_cpu
// Global variables used in PI_esimd_emu
// Note we only create a simple pointer variables such that C++ RT won't
// deallocate them automatically at the end of the main program.
// The heap memory allocated for this global variable reclaimed only when
Expand Down Expand Up @@ -242,9 +242,9 @@ template <int DIMS> class libCMBatch {
GroupDim[I] = (uint32_t)(GlobalSize[I] / LocalSize[I]);
}

ESimdCPUKernel ESimdCPU((fptrVoid)InvokeLambda<DIMS>, GroupDim, SpaceDim);
EsimdemuKernel Esimdemu((fptrVoid)InvokeLambda<DIMS>, GroupDim, SpaceDim);

ESimdCPU.launchMT(sizeof(struct LambdaWrapper<DIMS>), WrappedLambda.get());
Esimdemu.launchMT(sizeof(struct LambdaWrapper<DIMS>), WrappedLambda.get());
}
};

Expand Down Expand Up @@ -276,7 +276,7 @@ void sycl_get_cm_image_params(void *PtrInput, char **BaseAddr, uint32_t *Width,
*MtxLock = &(Img->mutexLock);
}

/// Implementation for ESIMD_CPU device interface accessing ESIMD
/// Implementation for ESIMD_EMU device interface accessing ESIMD
/// intrinsics and LibCM functionalties requred by intrinsics
sycl::detail::ESIMDDeviceInterface::ESIMDDeviceInterface() {
version = ESIMDEmuPluginInterfaceVersion;
Expand Down Expand Up @@ -392,7 +392,7 @@ pi_result piPlatformGetInfo(pi_platform Platform, pi_platform_info ParamName,

switch (ParamName) {
case PI_PLATFORM_INFO_NAME:
return ReturnValue("Intel(R) ESIMD_CPU/GPU");
return ReturnValue("Intel(R) ESIMD_EMU/GPU");

case PI_PLATFORM_INFO_VENDOR:
return ReturnValue("Intel(R) Corporation");
Expand Down Expand Up @@ -495,7 +495,7 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName,
case PI_DEVICE_INFO_PLATFORM:
return ReturnValue(Device->Platform);
case PI_DEVICE_INFO_NAME:
return ReturnValue("ESIMD_CPU");
return ReturnValue("ESIMD_EMU");
case PI_DEVICE_INFO_IMAGE_SUPPORT:
return ReturnValue(pi_bool{true});
case PI_DEVICE_INFO_DRIVER_VERSION:
Expand All @@ -517,7 +517,7 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName,
#define UNSUPPORTED_INFO(info) \
case info: \
std::cerr << std::endl \
<< "Unsupported device info = " << #info << " from ESIMD_CPU" \
<< "Unsupported device info = " << #info << " from ESIMD_EMU" \
<< std::endl; \
DIE_NO_IMPLEMENTATION; \
break;
Expand Down Expand Up @@ -740,7 +740,7 @@ pi_result piQueueRelease(pi_queue Queue) {
}

pi_result piQueueFinish(pi_queue) {
// No-op as enqueued commands with ESIMD_CPU plugin are blocking
// No-op as enqueued commands with ESIMD_EMU plugin are blocking
// ones that do not return until their completion - kernel execution
// and memory read.
CONTINUE_NO_IMPLEMENTATION;
Expand Down Expand Up @@ -1078,7 +1078,7 @@ pi_result piEventGetProfilingInfo(pi_event Event, pi_profiling_info ParamName,
size_t ParamValueSize, void *ParamValue,
size_t *ParamValueSizeRet) {
if (PrintPiTrace) {
std::cerr << "Warning : Profiling Not supported under PI_ESIMD_CPU"
std::cerr << "Warning : Profiling Not supported under PI_ESIMD_EMU"
<< std::endl;
}
return PI_SUCCESS;
Expand Down Expand Up @@ -1181,7 +1181,7 @@ pi_result piEnqueueMemBufferRead(pi_queue Queue, pi_mem Src,
/// TODO : Support Blocked read, 'Queue' handling
if (BlockingRead) {
assert(false &&
"ESIMD_CPU support for blocking piEnqueueMemBufferRead is NYI");
"ESIMD_EMU support for blocking piEnqueueMemBufferRead is NYI");
}
if (NumEventsInWaitList != 0) {
return PI_INVALID_EVENT_WAIT_LIST;
Expand Down Expand Up @@ -1277,7 +1277,7 @@ pi_result piEnqueueMemImageRead(pi_queue CommandQueue, pi_mem Image,
pi_event *Event) {
/// TODO : Support Blocked read, 'Queue' handling
if (BlockingRead) {
assert(false && "ESIMD_CPU does not support Blocking Read");
assert(false && "ESIMD_EMU does not support Blocking Read");
}
_pi_image *PiImg = static_cast<_pi_image *>(Image);

Expand Down Expand Up @@ -1508,7 +1508,7 @@ pi_result piextDeviceSelectBinary(pi_device, pi_device_binary *,
/// for the images
if (RawImgSize != 1) {
if (PrintPiTrace) {
std::cerr << "Only single device binary image is supported in ESIMD_CPU"
std::cerr << "Only single device binary image is supported in ESIMD_EMU"
<< std::endl;
}
return PI_INVALID_VALUE;
Expand Down Expand Up @@ -1547,7 +1547,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
strncpy(PluginInit->PluginVersion, _PI_H_VERSION_STRING, PluginVersionSize);

PiESimdDeviceAccess = new sycl::detail::ESIMDEmuPluginOpaqueData();
// 'version' to be compared with 'ESIMD_CPU_DEVICE_REQUIRED_VER' defined in
// 'version' to be compared with 'ESIMD_EMU_DEVICE_REQUIRED_VER' defined in
// device interface file
PiESimdDeviceAccess->version = ESIMDEmuPluginDataVersion;
PiESimdDeviceAccess->data =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
//===---------- pi_esimd_cpu.hpp - CM Emulation Plugin --------------------===//
//===---------- pi_esimd_emu.hpp - CM Emulation Plugin --------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

/// \file pi_esimd_cpu.hpp
/// \file pi_esimd_emu.hpp
/// Declarations for CM Emulation Plugin. It is the interface between the
/// device-agnostic SYCL runtime layer and underlying CM Emulation
///
/// \ingroup sycl_pi_esimd_cpu
/// \ingroup sycl_pi_esimd_emu

#pragma once

Expand Down Expand Up @@ -160,4 +160,4 @@ struct _pi_kernel : _pi_object {
_pi_kernel() {}
};

#include <sycl/ext/intel/experimental/esimd/emu/detail/esimdcpu_device_interface.hpp>
#include <sycl/ext/intel/experimental/esimd/emu/detail/esimdemu_device_interface.hpp>
Loading