Skip to content

Commit

Permalink
[ESIMD] Enable esimd emulator build by default (#5058)
Browse files Browse the repository at this point in the history
* Enabled ESIMD_EMU support build by default
* Replaced ESIMD_EMU with ESIMDCPU for legacy CM_EMU
* Updated PI Device info
* Removed command line option for esimd_cpu_emulation
* Reduced overhead on command creation for ESIMD_EMULATOR BE
* ESIMD_EMULATOR plug-in update for bringing-up intel/llvm-test-suite
* CM-EMU Device version info composition
* Changes to suppress warning messages
* Single-point-of-return for EnqueueKernel
* Added command line option for disabling ESIMD_EMULATOR build
  • Loading branch information
dongkyunahn-intel authored Jan 19, 2022
1 parent b0c145a commit 50ccce9
Show file tree
Hide file tree
Showing 7 changed files with 335 additions and 116 deletions.
8 changes: 4 additions & 4 deletions buildbot/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def do_configure(args):
libclc_targets_to_build = ''
libclc_gen_remangled_variants = 'OFF'
sycl_build_pi_cuda = 'OFF'
sycl_build_pi_esimd_emulator = 'OFF'
sycl_build_pi_esimd_emulator = 'ON'
sycl_build_pi_hip = 'OFF'
sycl_build_pi_hip_platform = 'AMD'
sycl_clang_extra_flags = ''
Expand All @@ -50,8 +50,8 @@ def do_configure(args):
if args.arm:
llvm_targets_to_build = 'ARM;AArch64'

if args.enable_esimd_cpu_emulation:
sycl_build_pi_esimd_emulator = 'ON'
if args.disable_esimd_emulator:
sycl_build_pi_esimd_emulator = 'OFF'

if args.cuda or args.hip:
llvm_enable_projects += ';libclc'
Expand Down Expand Up @@ -213,7 +213,7 @@ def main():
parser.add_argument("--hip-platform", type=str, choices=['AMD', 'NVIDIA'], default='AMD', help="choose hardware platform for HIP backend")
parser.add_argument("--hip-amd-arch", type=str, help="Sets AMD gpu architecture for llvm lit tests, this is only needed for the HIP backend and AMD platform")
parser.add_argument("--arm", action='store_true', help="build ARM support rather than x86")
parser.add_argument("--enable-esimd-cpu-emulation", action='store_true', help="build with ESIMD_CPU emulation support")
parser.add_argument("--disable-esimd-emulator", action='store_true', help="exclude ESIMD_EMULATOR support")
parser.add_argument("--no-assertions", action='store_true', help="build without assertions")
parser.add_argument("--docs", action='store_true', help="build Doxygen documentation")
parser.add_argument("--no-werror", action='store_true', help="Don't treat warnings as errors")
Expand Down
14 changes: 4 additions & 10 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -336,17 +336,11 @@ if(SYCL_BUILD_PI_HIP)
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS libspirv-builtins pi_hip)
endif()

if (SYCL_BUILD_PI_ESIMD_EMULATOR)
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS pi_esimd_emulator libcmrt-headers)
if (MSVC)
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS libcmrt-libs libcmrt-dlls)
else()
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS libcmrt-sos)
endif()
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS pi_esimd_emulator libcmrt-headers)
if (MSVC)
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS libcmrt-libs libcmrt-dlls)
else()
# TODO/FIXME : Removing empty header file (cm_rt.h) generation when
# the ESIMD_EMULATOR support is enabled by default
file (TOUCH ${SYCL_INCLUDE_BUILD_DIR}/sycl/CL/cm_rt.h)
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS libcmrt-sos)
endif()

# Use it as fake dependency in order to force another command(s) to execute.
Expand Down
8 changes: 4 additions & 4 deletions sycl/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ endif()
add_subdirectory(opencl)
add_subdirectory(level_zero)

# TODO : Remove 'if (NOT MSVC)' when CM_EMU supports Windows
# environment
if (NOT MSVC)
if (SYCL_BUILD_PI_ESIMD_EMULATOR)
if(SYCL_BUILD_PI_ESIMD_EMULATOR)
# TODO : Remove 'if (NOT MSVC)' when CM_EMU supports Windows
# environment
if (NOT MSVC)
add_subdirectory(esimd_emulator)
endif()
endif()
8 changes: 7 additions & 1 deletion sycl/plugins/esimd_emulator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,16 @@ else ()
if (MSVC)
message(FATAL_ERROR "Online-building of CM_EMU library is not supported under Windows environment")
else()
# Arguments for online patching to suppress log message from CM_EMU
# Replacing CM_EMU's log print-out macro controlled by 'GFX_EMU_WITH_FLAGS_'
# with blank space from $CM_EMU_SRC/common/emu_log.h
set (replacing_pattern s/{\ ?GFX_EMU_WITH_FLAGS_.*//g)
ExternalProject_Add(cm-emu
GIT_REPOSITORY https://github.com/intel/cm-cpu-emulation.git
GIT_TAG c19234cea13bdfc32b5ed9
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_build
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install
PATCH_COMMAND perl -pi.back -e ${replacing_pattern} ${CMAKE_CURRENT_BINARY_DIR}/cm-emu-prefix/src/cm-emu/common/emu_log.h
CMAKE_ARGS -DLIBVA_INSTALL_PATH=/usr
-D__SYCL_EXPLICIT_SIMD_PLUGIN__=true
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
Expand Down Expand Up @@ -139,7 +145,7 @@ install(TARGETS pi_esimd_emulator

# Copy CM Header files to $(INSTALL)/include/sycl/CL/
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install/include/libcm/cm/
DESTINATION ${SYCL_INCLUDE_DIR}/CL
DESTINATION ${SYCL_INCLUDE_DIR}/sycl/CL
COMPONENT libcmrt-headers
FILES_MATCHING PATTERN "*.h"
)
Expand Down
Loading

0 comments on commit 50ccce9

Please sign in to comment.