-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] Introduce the Level Zero plugin #1718
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
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
ba2ecb4
[SYCL] Introduce the Level Zero plugin
againull b0fabec
[SYCL] Don't use SYCL device libs when backend is L0
againull e59ed9a
Minor fixes
againull a4b5c7c
Fix build on Windows and export only pi* symbols in libpi_level0.so
againull 120ee9c
Fix naming of env variables
againull 5ff2e4d
Update documentation
againull 8866e2c
Merge remote-tracking branch 'origin/sycl' into l0_plugin
againull 097c595
Update dependency.conf with info about Level Zero
againull 4e56b22
Fix directory name
againull 8c655b8
Address review comments
againull 0fd2f79
Handle bad_alloc and other errors which could happend during new()
againull e8722f5
Address review comments
againull 0a0aabf
Fix formatting problem
againull 9db2a3b
Address comments
againull d76ea58
Address review comments
againull a1f740d
Apply suggestion for MaxNumEventsPerPool
againull 3d70ee3
Fix check for l0-loader target in cmake file
againull 8c75284
Minor fix
againull 6b02205
Remove segfault handling during zeInit.
againull aebdfe0
Use unordered_map for errors mapping
againull 88559cf
Merge remote-tracking branch 'origin/sycl' into fork_l0_plugin
againull 3a92906
Fixes to address fails after merge with master branch
againull 77e8a78
Merge branch 'sycl' into l0_plugin
againull d2164f7
Make ErrorMapping static
againull 5cc9836
Merge remote-tracking branch 'origin/sycl' into l0_plugin
6a85a39
Merge remote-tracking branch 'origin/sycl' into l0_plugin
againull 41ea7e2
Merge remote-tracking branch 'origin/sycl' into l0_plugin_merge
a303cad
Merge remote-tracking branch 'origin/sycl' into l0_plugin
againull b792fce
Merge remote-tracking branch 'origin/sycl' into l0_plugin
againull File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -5,3 +5,4 @@ if(SYCL_BUILD_PI_CUDA) | |
endif() | ||
|
||
add_subdirectory(opencl) | ||
add_subdirectory(level_zero) |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# PI Level0 plugin library | ||
|
||
if (NOT DEFINED L0_LIBRARY OR NOT DEFINED L0_INCLUDE_DIR) | ||
message(STATUS "Download Level Zero loader and headers from github.com") | ||
if(MSVC) | ||
set(L0_LIBRARY | ||
"${LLVM_LIBRARY_OUTPUT_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ze_loader${CMAKE_STATIC_LIBRARY_SUFFIX}") | ||
else() | ||
set(L0_LIBRARY | ||
"${LLVM_LIBRARY_OUTPUT_INTDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}ze_loader${CMAKE_SHARED_LIBRARY_SUFFIX}") | ||
endif() | ||
if (CMAKE_C_COMPILER) | ||
list(APPEND AUX_CMAKE_FLAGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}) | ||
endif() | ||
if (CMAKE_CXX_COMPILER) | ||
list(APPEND AUX_CMAKE_FLAGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}) | ||
endif() | ||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/l0_loader_build) | ||
ExternalProject_Add(l0-loader | ||
GIT_REPOSITORY https://github.com/oneapi-src/level-zero.git | ||
GIT_TAG origin/master | ||
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/Level0/l0_loader" | ||
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/l0_loader_build" | ||
INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/l0_loader_install" | ||
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} | ||
-DOpenCL_INCLUDE_DIR=${OpenCL_INCLUDE_DIRS} | ||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> | ||
-DCMAKE_INSTALL_LIBDIR:PATH=lib${LLVM_LIBDIR_SUFFIX} | ||
${AUX_CMAKE_FLAGS} | ||
STEP_TARGETS configure,build,install | ||
DEPENDS ocl-headers | ||
BUILD_BYPRODUCTS ${L0_LIBRARY} | ||
) | ||
ExternalProject_Add_Step(l0-loader llvminstall | ||
COMMAND ${CMAKE_COMMAND} -E copy_directory <INSTALL_DIR>/ ${LLVM_BINARY_DIR} | ||
COMMENT "Installing l0-loader into the LLVM binary directory" | ||
DEPENDEES install | ||
) | ||
|
||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/l0_loader_install/" | ||
DESTINATION "." | ||
COMPONENT l0-loader | ||
) | ||
|
||
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS l0-loader) | ||
else() | ||
include_directories("${L0_INCLUDE_DIR}") | ||
endif() | ||
|
||
include_directories("${sycl_inc_dir}") | ||
include_directories(${OPENCL_INCLUDE}) | ||
|
||
add_library(pi_level0 SHARED | ||
"${sycl_inc_dir}/CL/sycl/detail/pi.h" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/pi_level0.cpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/pi_level0.hpp" | ||
) | ||
|
||
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_level0 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_level0 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_level0 | ||
PRIVATE "-Wl,--version-script=${linker_script}" | ||
) | ||
endif() | ||
|
||
if (TARGET l0-loader) | ||
add_dependencies(pi_level0 l0-loader) | ||
endif() | ||
add_dependencies(sycl-toolchain pi_level0) | ||
|
||
target_link_libraries(pi_level0 PRIVATE "${L0_LIBRARY}") | ||
if (UNIX) | ||
target_link_libraries(pi_level0 PRIVATE pthread) | ||
endif() | ||
|
||
add_common_options(pi_level0) | ||
|
||
install(TARGETS pi_level0 | ||
LIBRARY DESTINATION "lib" COMPONENT pi_level0 | ||
RUNTIME DESTINATION "bin" COMPONENT pi_level0) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.