Skip to content

Commit

Permalink
Renaming esimd emu from esimd cpu (#4728)
Browse files Browse the repository at this point in the history
[SYCL][ESIMD][EMU] Renaming ESIMD_CPU to ESIMD_EMU
* Directory rename
* File rename
Co-authored-by: kbobrovs <Konstantin.S.Bobrovsky@intel.com>
  • Loading branch information
dongkyunahn-intel authored Oct 15, 2021
1 parent c7c99fc commit 30acaff
Show file tree
Hide file tree
Showing 23 changed files with 90 additions and 91 deletions.
2 changes: 1 addition & 1 deletion sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ endif()
# environment
if (NOT MSVC)
if (SYCL_BUILD_PI_ESIMD_EMULATOR)
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS pi_esimd_cpu libcmrt-headers)
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS pi_esimd_emulator libcmrt-headers)
if (MSVC)
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS libcmrt-libs libcmrt-dlls)
else()
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/__spirv/spirv_ops.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//==---------- spirv_ops.hpp --- SPIRV operations -------------------------==//
//==----------- spirv_ops.hpp --- SPIRV operations -------------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/__spirv/spirv_types.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===----------- spirv_types.hpp --- SPIRV types -------------------------===//
//===------------ spirv_types.hpp --- SPIRV types -------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/__spirv/spirv_vars.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//==---------- spirv_vars.hpp --- SPIRV variables -------------------------==//
//==----------- spirv_vars.hpp --- SPIRV variables -------------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/aspects.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//==-------------- aspects.hpp - SYCL Aspect Enums ------------*- C++ -*---==//
//==--------------- aspects.hpp - SYCL Aspect Enums ------------*- C++ -*---==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/detail/hip_definitions.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//==------------ hip_definitions.hpp - SYCL HIP backend -------------------==//
//==------------- hip_definitions.hpp - SYCL HIP backend -------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/detail/item_base.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//==---------- item_base.hpp --- SYCL iteration ItemBase ------------------==//
//==----------- item_base.hpp --- SYCL iteration ItemBase ------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
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_EMULATOR_PLUGIN_NAME "pi_esimd_emulator.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_EMULATOR_PLUGIN_NAME "libpi_esimd_emulator.so"
#define __SYCL_HIP_PLUGIN_NAME "libpi_hip.so"
#endif

Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/device_event.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//==---------- device_event.hpp --- SYCL device event ---------------------==//
//==----------- device_event.hpp --- SYCL device event ---------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/feature_test.hpp.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//==---- feature_test.hpp - SYCL Feature Test Definitions -----*- C++ -*---==//
//==----- feature_test.hpp - SYCL Feature Test Definitions -----*- C++ -*---==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/group_algorithm.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//==----------- group_algorithm.hpp ------------------------------------==//
//==------------------------ group_algorithm.hpp ---------------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/id.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//==----------- id.hpp --- SYCL iteration id -------------------------==//
//==-------------------- id.hpp --- SYCL iteration id ----------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
//==----- esimdcpu_device_interface.hpp - DPC++ Explicit SIMD API ---------==//
//==----- esimd_emulator_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_EMULATOR-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_EMULATOR specific-support therefore
/// it has to be defined and shared as include directory
///
/// \ingroup sycl_pi_esimd_cpu
/// \ingroup sycl_pi_esimd_emulator

#pragma once

#include <CL/sycl/detail/pi.hpp>

// cstdint-type fields such as 'uint32_t' are to be used in funtion
// pointer table file ('esimd_emu_functions_v1.h') included in 'struct
// pointer table file ('esimd_emulator_functions_v1.h') included in 'struct
// ESIMDDeviceInterface' definition.
#include <cstdint>
#include <mutex>
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_EMULATOR) to access LibCM CPU emulation functionalities
// from kernel application under emulation.

// Header files included in the structure contains only function
Expand All @@ -51,13 +51,13 @@ struct ESIMDDeviceInterface {
void *reserved;

ESIMDDeviceInterface();
#include "esimd_emu_functions_v1.h"
#include "esimd_emulator_functions_v1.h"
};

// Denotes the data version used by the implementation.
// Increment whenever the 'data' field interpretation within PluginOpaqueData is
// changed.
#define ESIMD_EMU_PLUGIN_OPAQUE_DATA_VERSION 0
#define ESIMD_EMULATOR_PLUGIN_OPAQUE_DATA_VERSION 0
/// This structure denotes a ESIMD EMU plugin-specific data returned via the
/// piextPluginGetOpaqueData PI call. Depending on the \c version field, the
/// second \c data field can be interpreted differently.
Expand All @@ -76,14 +76,13 @@ ESIMDDeviceInterface *getESIMDDeviceInterface() {
void *PIOpaqueData = nullptr;

PIOpaqueData =
getPluginOpaqueData<cl::sycl::backend::ext_oneapi_esimd_emulator>(
nullptr);
getPluginOpaqueData<cl::sycl::backend::ext_intel_esimd_emulator>(nullptr);

ESIMDEmuPluginOpaqueData *OpaqueData =
reinterpret_cast<ESIMDEmuPluginOpaqueData *>(PIOpaqueData);

// First check if opaque data version is compatible.
if (OpaqueData->version != ESIMD_EMU_PLUGIN_OPAQUE_DATA_VERSION) {
if (OpaqueData->version != ESIMD_EMULATOR_PLUGIN_OPAQUE_DATA_VERSION) {
// NOTE: the version check should always be '!=' as layouts of different
// versions of PluginOpaqueData is not backward compatible, unlike
// layout of the ESIMDDeviceInterface.
Expand All @@ -92,8 +91,8 @@ ESIMDDeviceInterface *getESIMDDeviceInterface() {
<< "Opaque data returned by ESIMD Emu plugin is incompatible with"
<< "the one used in current implementation." << std::endl
<< "Returned version : " << OpaqueData->version << std::endl
<< "Required version : " << ESIMD_EMU_PLUGIN_OPAQUE_DATA_VERSION
<< std::endl;
<< "Required version : "
<< ESIMD_EMULATOR_PLUGIN_OPAQUE_DATA_VERSION << std::endl;
throw cl::sycl::feature_not_supported();
}
// Opaque data version is OK, can cast the 'data' field.
Expand All @@ -115,7 +114,7 @@ ESIMDDeviceInterface *getESIMDDeviceInterface() {
}

#undef ESIMD_DEVICE_INTERFACE_VERSION
#undef ESIMD_EMU_PLUGIN_OPAQUE_DATA_VERSION
#undef ESIMD_EMULATOR_PLUGIN_OPAQUE_DATA_VERSION

} // namespace detail
} // namespace sycl
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
//==----- esimd_emu_functions_v1.h - DPC++ Explicit SIMD API ---------==//
//==----- esimd_emulator_functions_v1.h - 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 esimd_emu_functions_v1.h
/// \file esimd_emulator_functions_v1.h
///
/// \ingroup sycl_pi_esimd_cpu
/// \ingroup sycl_pi_esimd_emulator

#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
2 changes: 1 addition & 1 deletion sycl/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ add_subdirectory(level_zero)
# environment
if (NOT MSVC)
if (SYCL_BUILD_PI_ESIMD_EMULATOR)
add_subdirectory(esimd_cpu)
add_subdirectory(esimd_emulator)
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_emulator.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_emulator.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_emulator_deps/lib/libcm${CMAKE_STATIC_LIBRARY_SUFFIX})
set(LIBIGFXCMRT_EMU ${LLVM_BINARY_DIR}/pi_esimd_emulator_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_emulator_deps/lib/libcm${CMAKE_SHARED_LIBRARY_SUFFIX})
set(LIBIGFXCMRT_EMU ${LLVM_BINARY_DIR}/pi_esimd_emulator_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_emulator_deps && ${CMAKE_COMMAND} -E copy_directory <INSTALL_DIR>/ ${LLVM_BINARY_DIR}/pi_esimd_emulator_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_emulator_deps/include/igfxcmrt_emu)
include_directories(${LLVM_BINARY_DIR}/pi_esimd_emulator_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_emulator SHARED
"${sycl_inc_dir}/CL/sycl/detail/pi.h"
"pi_esimd_cpu.cpp"
"pi_esimd_emulator.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_emulator 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_emulator 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_emulator
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_emulator OpenCL-Headers)
add_dependencies(pi_esimd_emulator cm-emu)
add_dependencies(sycl-toolchain pi_esimd_emulator)

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_emulator PRIVATE sycl ${LIBCM} ${LIBIGFXCMRT_EMU})
set_target_properties(pi_esimd_emulator PROPERTIES LINKER_LANGUAGE CXX)

add_common_options(pi_esimd_cpu)
add_common_options(pi_esimd_emulator)

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_emulator
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT pi_esimd_emulator
RUNTIME DESTINATION "bin" COMPONENT pi_esimd_emulator)

# Copy CM Header files to $(INSTALL)/include/sycl/CL/
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install/include/libcm/cm/
Expand Down
Loading

0 comments on commit 30acaff

Please sign in to comment.