-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL][ESIMD][EMU] URL for pre-built CM_EMU library package #6027
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e205b99
deb9552
157c4b6
8081fec
03c036b
44d34f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -14,29 +14,45 @@ include_directories(${OpenCL_INCLUDE_DIR}) | |||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_build) | ||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install) | ||||
|
||||
if (MSVC) | ||||
if (WIN32) | ||||
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_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) | ||||
# Using local CM directory for online building without downloading | ||||
if (MSVC) | ||||
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") | ||||
set (DEFAULT_CM_EMU_SOURCE_URL "https://github.com/intel/cm-cpu-emulation.git") | ||||
|
||||
if ((DEFINED USE_DEFAULT_CM_EMU_SOURCE) OR (DEFINED USE_LOCAL_CM_EMU_SOURCE)) | ||||
if (DEFINED USE_CM_EMU_PREBUILT_PACKAGE) | ||||
message(FATAL_ERROR "Configuration failure : Pre-built package and On-line building of CM_EMU library package cannot be applied together") | ||||
endif() | ||||
if ((DEFINED USE_DEFAULT_CM_EMU_SOURCE) AND (DEFINED USE_LOCAL_CM_EMU_SOURCE)) | ||||
message(FATAL_ERROR "Configuration failure : Either default CM_EMU source or local source can be used for on-line CM building - not together") | ||||
endif() | ||||
if (WIN32) | ||||
message(FATAL_ERROR "Configuration failure : Online-building of CM_EMU library is not supported under Windows environment") | ||||
endif() | ||||
|
||||
if (DEFINED USE_DEFAULT_CM_EMU_SOURCE) | ||||
message(STATUS "CM_EMU library package will be built online with source codes downloaded from ${DEFAULT_CM_EMU_SOURCE_URL}") | ||||
ExternalProject_Add(cm-emu | ||||
DOWNLOAD_COMMAND "" | ||||
SOURCE_DIR ${CM_LOCAL_SOURCE_DIR} | ||||
GIT_REPOSITORY ${DEFAULT_CM_EMU_SOURCE_URL} | ||||
GIT_TAG f9d167edbcb995e713d5a8 | ||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_build | ||||
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install | ||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> | ||||
CMAKE_ARGS -DLIBVA_INSTALL_PATH=/usr | ||||
-D__SYCL_EXPLICIT_SIMD_PLUGIN__=true | ||||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> | ||||
BUILD_BYPRODUCTS ${LIBCM} ${LIBIGFXCMRT_EMU} | ||||
) | ||||
else() | ||||
elseif (DEFINED USE_LOCAL_CM_EMU_SOURCE) | ||||
message(STATUS "CM_EMU library package will be built online with source codes from ${USE_LOCAL_CM_EMU_SOURCE}") | ||||
ExternalProject_Add(cm-emu | ||||
DOWNLOAD_COMMAND "" | ||||
SOURCE_DIR ${CM_LOCAL_SOURCE_DIR} | ||||
SOURCE_DIR ${USE_LOCAL_CM_EMU_SOURCE} | ||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_build | ||||
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install | ||||
CMAKE_ARGS -DLIBVA_INSTALL_PATH=/usr | ||||
|
@@ -45,42 +61,25 @@ if (DEFINED CM_LOCAL_SOURCE_DIR) | |||
BUILD_BYPRODUCTS ${LIBCM} ${LIBIGFXCMRT_EMU} | ||||
) | ||||
endif() | ||||
else () | ||||
if (DEFINED CM_PACKAGE_URL) | ||||
# Downloading pre-built CM Package | ||||
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install) | ||||
ExternalProject_Add(cm-emu | ||||
URL ${CM_PACKAGE_URL} | ||||
CONFIGURE_COMMAND "" | ||||
BUILD_COMMAND "" | ||||
UPDATE_COMMAND "" | ||||
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install | ||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/cm-emu-prefix/src/cm-emu/ <INSTALL_DIR> | ||||
BUILD_BYPRODUCTS ${LIBCM} ${LIBIGFXCMRT_EMU} | ||||
) | ||||
else() | ||||
set(ACTUAL_CM_EMU_PREBUILT_PACKAGE ${DEFAULT_CM_EMU_PREBUILT_PACKAGE}) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest to add a message here so that users can see what |
||||
if (DEFINED USE_CM_EMU_PREBUILT_PACKAGE) | ||||
set(ACTUAL_CM_EMU_PREBUILT_PACKAGE ${USE_CM_EMU_PREBUILT_PACKAGE}) | ||||
else() | ||||
# Build from CM source tree fetched from github | ||||
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 f9d167edbcb995e713d5a8 | ||||
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> | ||||
BUILD_BYPRODUCTS ${LIBCM} ${LIBIGFXCMRT_EMU} | ||||
) | ||||
endif() | ||||
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}") | ||||
endif() | ||||
endif () | ||||
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install) | ||||
ExternalProject_Add(cm-emu | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, please add a TODO then too |
||||
URL ${ACTUAL_CM_EMU_PREBUILT_PACKAGE} | ||||
CONFIGURE_COMMAND "" | ||||
BUILD_COMMAND "" | ||||
UPDATE_COMMAND "" | ||||
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install | ||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/cm-emu-prefix/src/cm-emu/ <INSTALL_DIR> | ||||
BUILD_BYPRODUCTS ${LIBCM} ${LIBIGFXCMRT_EMU} | ||||
) | ||||
endif() | ||||
|
||||
ExternalProject_Add_Step(cm-emu llvminstall | ||||
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" | ||||
|
@@ -97,7 +96,7 @@ set(CMAKE_CXX_STANDARD 17) | |||
|
||||
# Compilation option modification to prevent build termination caused by | ||||
# warnings from CM-imported files | ||||
if (MSVC) | ||||
if (WIN32) | ||||
string(REPLACE "/W4" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||||
else() | ||||
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 | |||
) | ||||
|
||||
# Copy '.so' files to '$(INSTALL)/lib' | ||||
if (MSVC) | ||||
if (WIN32) | ||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install/lib/ | ||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib | ||||
COMPONENT libcmrt-libs | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it documented anywhere? Is it set from anywhere, e.g. buildbot/congigure.py?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to look up, but @pvchupin confirmed that this is typo. #5799 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding it's initialized at this specific point. Everything configure.py is doing is adding esimd_emulator to SYCL_ENABLE_PLUGINS under the switch.
I'm not sure if we are using SYCL_BUILD_PI_ESIMD_EMULATOR anywhere, but it seems there are a few occurrences in in LIT infra.