Skip to content

Commit d019f29

Browse files
[SYCL][ESIMD][EMU] URL for pre-built CM_EMU library package (#6027)
* [SYCL][ESIMD][EMU] URL for pre-built CM_EMU library package - For ESIMD_EMULATOR, URL for pre-built CM_EMU library package is provided with 'ESIMD_EMU_USE_PREBUILT_CM_PACKAGE' cmake argument
1 parent 256d2cc commit d019f29

File tree

2 files changed

+45
-46
lines changed

2 files changed

+45
-46
lines changed

sycl/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ if ("hip" IN_LIST SYCL_ENABLE_PLUGINS)
146146
set(SYCL_BUILD_PI_HIP ON)
147147
endif()
148148
if ("esimd_emulator" IN_LIST SYCL_ENABLE_PLUGINS)
149-
set(SYCL_BUILD_PI_HIP ON)
149+
set(SYCL_BUILD_PI_ESIMD_EMULATOR ON)
150150
endif()
151151

152152
# Configure SYCL version macro

sycl/plugins/esimd_emulator/CMakeLists.txt

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,45 @@ include_directories(${OpenCL_INCLUDE_DIR})
1414
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_build)
1515
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install)
1616

17-
if (MSVC)
17+
if (WIN32)
1818
set(LIBCM ${LLVM_BINARY_DIR}/pi_esimd_emulator_deps/lib/libcm${CMAKE_STATIC_LIBRARY_SUFFIX})
1919
set(LIBIGFXCMRT_EMU ${LLVM_BINARY_DIR}/pi_esimd_emulator_deps/lib/igfxcmrt64_emu${CMAKE_STATIC_LIBRARY_SUFFIX})
2020
else()
2121
set(LIBCM ${LLVM_BINARY_DIR}/pi_esimd_emulator_deps/lib/libcm${CMAKE_SHARED_LIBRARY_SUFFIX})
2222
set(LIBIGFXCMRT_EMU ${LLVM_BINARY_DIR}/pi_esimd_emulator_deps/lib/libigfxcmrt_emu${CMAKE_SHARED_LIBRARY_SUFFIX})
2323
endif()
2424

25-
if (DEFINED CM_LOCAL_SOURCE_DIR)
26-
# Using local CM directory for online building without downloading
27-
if (MSVC)
25+
set (DEFAULT_CM_EMU_PREBUILT_PACKAGE "https://github.com/intel/cm-cpu-emulation/releases/download/v2022-05-06/intel-cmemu-1.0.22.u20.04-release.x86_64.tar.xz")
26+
set (DEFAULT_CM_EMU_SOURCE_URL "https://github.com/intel/cm-cpu-emulation.git")
27+
28+
if ((DEFINED USE_DEFAULT_CM_EMU_SOURCE) OR (DEFINED USE_LOCAL_CM_EMU_SOURCE))
29+
if (DEFINED USE_CM_EMU_PREBUILT_PACKAGE)
30+
message(FATAL_ERROR "Configuration failure : Pre-built package and On-line building of CM_EMU library package cannot be applied together")
31+
endif()
32+
if ((DEFINED USE_DEFAULT_CM_EMU_SOURCE) AND (DEFINED USE_LOCAL_CM_EMU_SOURCE))
33+
message(FATAL_ERROR "Configuration failure : Either default CM_EMU source or local source can be used for on-line CM building - not together")
34+
endif()
35+
if (WIN32)
36+
message(FATAL_ERROR "Configuration failure : Online-building of CM_EMU library is not supported under Windows environment")
37+
endif()
38+
39+
if (DEFINED USE_DEFAULT_CM_EMU_SOURCE)
40+
message(STATUS "CM_EMU library package will be built online with source codes downloaded from ${DEFAULT_CM_EMU_SOURCE_URL}")
2841
ExternalProject_Add(cm-emu
29-
DOWNLOAD_COMMAND ""
30-
SOURCE_DIR ${CM_LOCAL_SOURCE_DIR}
42+
GIT_REPOSITORY ${DEFAULT_CM_EMU_SOURCE_URL}
43+
GIT_TAG f9d167edbcb995e713d5a8
3144
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_build
3245
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install
33-
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
46+
CMAKE_ARGS -DLIBVA_INSTALL_PATH=/usr
47+
-D__SYCL_EXPLICIT_SIMD_PLUGIN__=true
48+
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
3449
BUILD_BYPRODUCTS ${LIBCM} ${LIBIGFXCMRT_EMU}
3550
)
36-
else()
51+
elseif (DEFINED USE_LOCAL_CM_EMU_SOURCE)
52+
message(STATUS "CM_EMU library package will be built online with source codes from ${USE_LOCAL_CM_EMU_SOURCE}")
3753
ExternalProject_Add(cm-emu
3854
DOWNLOAD_COMMAND ""
39-
SOURCE_DIR ${CM_LOCAL_SOURCE_DIR}
55+
SOURCE_DIR ${USE_LOCAL_CM_EMU_SOURCE}
4056
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_build
4157
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install
4258
CMAKE_ARGS -DLIBVA_INSTALL_PATH=/usr
@@ -45,42 +61,25 @@ if (DEFINED CM_LOCAL_SOURCE_DIR)
4561
BUILD_BYPRODUCTS ${LIBCM} ${LIBIGFXCMRT_EMU}
4662
)
4763
endif()
48-
else ()
49-
if (DEFINED CM_PACKAGE_URL)
50-
# Downloading pre-built CM Package
51-
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install)
52-
ExternalProject_Add(cm-emu
53-
URL ${CM_PACKAGE_URL}
54-
CONFIGURE_COMMAND ""
55-
BUILD_COMMAND ""
56-
UPDATE_COMMAND ""
57-
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install
58-
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/cm-emu-prefix/src/cm-emu/ <INSTALL_DIR>
59-
BUILD_BYPRODUCTS ${LIBCM} ${LIBIGFXCMRT_EMU}
60-
)
64+
else()
65+
set(ACTUAL_CM_EMU_PREBUILT_PACKAGE ${DEFAULT_CM_EMU_PREBUILT_PACKAGE})
66+
if (DEFINED USE_CM_EMU_PREBUILT_PACKAGE)
67+
set(ACTUAL_CM_EMU_PREBUILT_PACKAGE ${USE_CM_EMU_PREBUILT_PACKAGE})
6168
else()
62-
# Build from CM source tree fetched from github
63-
if (MSVC)
64-
message(FATAL_ERROR "Online-building of CM_EMU library is not supported under Windows environment")
65-
else()
66-
# Arguments for online patching to suppress log message from CM_EMU
67-
# Replacing CM_EMU's log print-out macro controlled by 'GFX_EMU_WITH_FLAGS_'
68-
# with blank space from $CM_EMU_SRC/common/emu_log.h
69-
set (replacing_pattern s/{\ ?GFX_EMU_WITH_FLAGS_.*//g)
70-
ExternalProject_Add(cm-emu
71-
GIT_REPOSITORY https://github.com/intel/cm-cpu-emulation.git
72-
GIT_TAG f9d167edbcb995e713d5a8
73-
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_build
74-
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install
75-
PATCH_COMMAND perl -pi.back -e ${replacing_pattern} ${CMAKE_CURRENT_BINARY_DIR}/cm-emu-prefix/src/cm-emu/common/emu_log.h
76-
CMAKE_ARGS -DLIBVA_INSTALL_PATH=/usr
77-
-D__SYCL_EXPLICIT_SIMD_PLUGIN__=true
78-
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
79-
BUILD_BYPRODUCTS ${LIBCM} ${LIBIGFXCMRT_EMU}
80-
)
81-
endif()
69+
message(STATUS "Neither of USE_DEFAULT_CM_EMU_SOURCE, USE_LOCAL_CM_EMU_SOURCE, USE_CM_EMU_PREBUILT_PACKAGE is set, using prebuilt libCM from ${DEFAULT_CM_EMU_PREBUILT_PACKAGE}")
8270
endif()
83-
endif ()
71+
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install)
72+
ExternalProject_Add(cm-emu
73+
URL ${ACTUAL_CM_EMU_PREBUILT_PACKAGE}
74+
CONFIGURE_COMMAND ""
75+
BUILD_COMMAND ""
76+
UPDATE_COMMAND ""
77+
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install
78+
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/cm-emu-prefix/src/cm-emu/ <INSTALL_DIR>
79+
BUILD_BYPRODUCTS ${LIBCM} ${LIBIGFXCMRT_EMU}
80+
)
81+
endif()
82+
8483
ExternalProject_Add_Step(cm-emu llvminstall
8584
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
8685
COMMENT "Installing cm-emu into the LLVM binary directory"
@@ -97,7 +96,7 @@ set(CMAKE_CXX_STANDARD 17)
9796

9897
# Compilation option modification to prevent build termination caused by
9998
# warnings from CM-imported files
100-
if (MSVC)
99+
if (WIN32)
101100
string(REPLACE "/W4" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
102101
else()
103102
string(REPLACE "-pedantic" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@@ -127,7 +126,7 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install/include/libcm/cm
127126
)
128127

129128
# Copy '.so' files to '$(INSTALL)/lib'
130-
if (MSVC)
129+
if (WIN32)
131130
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install/lib/
132131
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
133132
COMPONENT libcmrt-libs

0 commit comments

Comments
 (0)