-
Notifications
You must be signed in to change notification settings - Fork 731
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Remove plugin interface (#14145)
Co-authored-by: Callum Fare <[email protected]> Co-authored-by: omarahmed1111 <[email protected]> Co-authored-by: Kenneth Benzie (Benie) <[email protected]> Co-authored-by: Martin Morrison-Grant <[email protected]> Co-authored-by: omarahmed1111 <[email protected]>
- Loading branch information
1 parent
14aabdd
commit ebb3b4a
Showing
498 changed files
with
11,187 additions
and
34,720 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
# PI Unified Runtime plugin library. | ||
# | ||
# Either fetches UR from the appropriate repo or sets up variables based on user | ||
# preference. | ||
|
||
# TODO: taken from sycl/plugins/CMakeLists.txt - maybe we should handle this | ||
# within UR (although it is an obscure warning that the build system here | ||
# seems to specifically enable) | ||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang|IntelLLVM" ) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-covered-switch-default") | ||
endif() | ||
|
||
|
||
# Options to override the default behaviour of the FetchContent to include UR | ||
# source code. | ||
|
@@ -15,8 +23,11 @@ option(SYCL_PI_UR_USE_FETCH_CONTENT | |
set(SYCL_PI_UR_SOURCE_DIR | ||
"" CACHE PATH "Path to root of Unified Runtime repository") | ||
|
||
# Override default to enable building tests from unified-runtime | ||
set(UR_BUILD_TESTS OFF CACHE BOOL "Build unit tests.") | ||
# Here we override the defaults to disable building tests from unified-runtime | ||
set(UR_BUILD_EXAMPLES OFF CACHE BOOL "Build example applications." FORCE) | ||
set(UR_BUILD_TESTS OFF CACHE BOOL "Build unit tests." FORCE) | ||
set(UR_BUILD_XPTI_LIBS OFF) | ||
set(UR_ENABLE_TRACING ON) | ||
|
||
if("level_zero" IN_LIST SYCL_ENABLE_PLUGINS) | ||
set(UR_BUILD_ADAPTER_L0 ON) | ||
|
@@ -26,6 +37,9 @@ if("cuda" IN_LIST SYCL_ENABLE_PLUGINS) | |
endif() | ||
if("hip" IN_LIST SYCL_ENABLE_PLUGINS) | ||
set(UR_BUILD_ADAPTER_HIP ON) | ||
if (SYCL_ENABLE_KERNEL_FUSION) | ||
set(UR_ENABLE_COMGR ON) | ||
endif() | ||
endif() | ||
if("opencl" IN_LIST SYCL_ENABLE_PLUGINS) | ||
set(UR_BUILD_ADAPTER_OPENCL ON) | ||
|
@@ -99,13 +113,13 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT) | |
endfunction() | ||
|
||
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") | ||
# commit 2baf095188b235bb2b0a0140f0187d2041aef4b0 | ||
# Merge: 3d8fe8d2 58f85278 | ||
# commit b7b0c8b3d17aa7d511c67ec219d58091d07cfa60 | ||
# Merge: 2baf0951 5b8936da | ||
# Author: Piotr Balcer <[email protected]> | ||
# Date: Fri Jul 26 12:06:22 2024 +0200 | ||
# Merge pull request #1900 from kswiecicki/umf-version-bump | ||
# Bump UMF version | ||
set(UNIFIED_RUNTIME_TAG 58f85278a4ebf37742dd10afb3350580b0b1d9d7) | ||
# Date: Fri Jul 26 15:48:04 2024 +0200 | ||
# Merge pull request #1903 from kswiecicki/umf-version-bump | ||
# Bump UMF version again | ||
set(UNIFIED_RUNTIME_TAG b7b0c8b3d17aa7d511c67ec219d58091d07cfa60) | ||
|
||
set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES") | ||
# Due to the use of dependentloadflag and no installer for UMF and hwloc we need | ||
|
@@ -210,86 +224,69 @@ target_include_directories(UnifiedRuntime-Headers | |
|
||
find_package(Threads REQUIRED) | ||
|
||
set(UNIFIED_RUNTIME_PLUGIN_ARGS | ||
SOURCES | ||
# These are short-term shared with Unified Runtime | ||
# The two plugins define a few things differently so must | ||
# be built separately. This difference is spelled in | ||
# their "ur_bindings.hpp" files. | ||
"ur_bindings.hpp" | ||
"pi2ur.hpp" | ||
# These below belong to Unified Runtime PI Plugin only | ||
"pi_unified_runtime.hpp" | ||
"pi_unified_runtime.cpp" | ||
LIBRARIES | ||
Threads::Threads | ||
UnifiedRuntimeLoader | ||
UnifiedRuntime-Headers | ||
UnifiedRuntimeCommon | ||
INCLUDE_DIRS | ||
"${UNIFIED_RUNTIME_SRC_INCLUDE_DIR}" | ||
"${UNIFIED_RUNTIME_COMMON_INCLUDE_DIR}" | ||
"${SYCL_SOURCE_DIR}/source" # for compiler.hpp | ||
) | ||
|
||
# We need for #include <ze_api.h> in common.h | ||
if("level_zero" IN_LIST SYCL_ENABLE_PLUGINS) | ||
list(APPEND UNIFIED_RUNTIME_PLUGIN_ARGS LevelZeroLoader-Headers) | ||
endif() | ||
|
||
if("opencl" IN_LIST SYCL_ENABLE_PLUGINS) | ||
list(APPEND UNIFIED_RUNTIME_PLUGIN_ARGS OpenCL-ICD) | ||
endif() | ||
|
||
add_sycl_plugin(unified_runtime ${UNIFIED_RUNTIME_PLUGIN_ARGS}) | ||
|
||
if(TARGET UnifiedRuntimeLoader) | ||
set_target_properties(hello_world PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) | ||
# Install the UR loader. | ||
# TODO: this is piggy-backing on the existing target component level-zero-sycl-dev | ||
# When UR is moved to its separate repo perhaps we should introduce new component, | ||
# e.g. unified-runtime-sycl-dev. | ||
# See github issue #14598 | ||
install(TARGETS ur_loader | ||
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT level-zero-sycl-dev | ||
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT level-zero-sycl-dev | ||
RUNTIME DESTINATION "bin" COMPONENT level-zero-sycl-dev | ||
) | ||
endif() | ||
|
||
# Install the UR adapters too | ||
if("level_zero" IN_LIST SYCL_ENABLE_PLUGINS) | ||
add_dependencies(sycl-runtime-libraries ur_adapter_level_zero) | ||
add_custom_target(UnifiedRuntimeAdapters) | ||
|
||
# Install the UR adapters too | ||
install(TARGETS ur_adapter_level_zero | ||
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT level-zero-sycl-dev | ||
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT level-zero-sycl-dev | ||
RUNTIME DESTINATION "bin" COMPONENT level-zero-sycl-dev | ||
function(add_sycl_ur_adapter NAME) | ||
add_dependencies(UnifiedRuntimeAdapters ur_adapter_${NAME}) | ||
|
||
install(TARGETS ur_adapter_${NAME} | ||
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT ur_adapter_${NAME} | ||
RUNTIME DESTINATION "bin" COMPONENT ur_adapter_${NAME}) | ||
|
||
set(manifest_file | ||
${CMAKE_CURRENT_BINARY_DIR}/install_manifest_ur_adapter_${NAME}.txt) | ||
add_custom_command(OUTPUT ${manifest_file} | ||
COMMAND "${CMAKE_COMMAND}" | ||
"-DCMAKE_INSTALL_COMPONENT=ur_adapter_${NAME}" | ||
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake" | ||
COMMENT "Deploying component ur_adapter_${NAME}" | ||
USES_TERMINAL | ||
) | ||
add_custom_target(install-sycl-ur-adapter-${NAME} | ||
DEPENDS ${manifest_file} ur_adapter_${NAME} | ||
) | ||
|
||
set_property(GLOBAL APPEND PROPERTY | ||
SYCL_TOOLCHAIN_INSTALL_COMPONENTS ur_adapter_${NAME}) | ||
endfunction() | ||
|
||
if("level_zero" IN_LIST SYCL_ENABLE_PLUGINS) | ||
add_sycl_ur_adapter(level_zero) | ||
|
||
# TODO: L0 adapter does other... things in its cmake - make sure they get | ||
# added to the new build system | ||
endif() | ||
|
||
if("cuda" IN_LIST SYCL_ENABLE_PLUGINS) | ||
add_dependencies(sycl-runtime-libraries ur_adapter_cuda) | ||
add_sycl_ur_adapter(cuda) | ||
endif() | ||
|
||
if("hip" IN_LIST SYCL_ENABLE_PLUGINS) | ||
add_dependencies(sycl-runtime-libraries ur_adapter_hip) | ||
add_sycl_ur_adapter(hip) | ||
endif() | ||
|
||
if ("opencl" IN_LIST SYCL_ENABLE_PLUGINS) | ||
add_dependencies(sycl-runtime-libraries ur_adapter_opencl) | ||
|
||
# Install the UR adapters too | ||
install(TARGETS ur_adapter_opencl | ||
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT level-zero-sycl-dev | ||
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT level-zero-sycl-dev | ||
RUNTIME DESTINATION "bin" COMPONENT level-zero-sycl-dev | ||
) | ||
if("opencl" IN_LIST SYCL_ENABLE_PLUGINS) | ||
add_sycl_ur_adapter(opencl) | ||
endif() | ||
|
||
if ("native_cpu" IN_LIST SYCL_ENABLE_PLUGINS) | ||
add_dependencies(sycl-runtime-libraries ur_adapter_native_cpu) | ||
if("native_cpu" IN_LIST SYCL_ENABLE_PLUGINS) | ||
add_sycl_ur_adapter(native_cpu) | ||
|
||
# Deal with OCK option | ||
option(NATIVECPU_USE_OCK "Use the oneAPI Construction Kit for Native CPU" ON) | ||
|
||
if(NATIVECPU_USE_OCK) | ||
message(STATUS "Compiling Native CPU adapter with OCK support.") | ||
|
@@ -300,8 +297,6 @@ if ("native_cpu" IN_LIST SYCL_ENABLE_PLUGINS) | |
endif() | ||
endif() | ||
|
||
add_dependencies(sycl-runtime-libraries ur_umf) | ||
|
||
# TODO: this is piggy-backing on the existing target component level-zero-sycl-dev | ||
install(TARGETS umf | ||
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT level-zero-sycl-dev | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.