Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ba2ecb4
[SYCL] Introduce the Level Zero plugin
againull May 19, 2020
b0fabec
[SYCL] Don't use SYCL device libs when backend is L0
againull May 19, 2020
e59ed9a
Minor fixes
againull May 19, 2020
a4b5c7c
Fix build on Windows and export only pi* symbols in libpi_level0.so
againull May 20, 2020
120ee9c
Fix naming of env variables
againull May 20, 2020
5ff2e4d
Update documentation
againull May 20, 2020
8866e2c
Merge remote-tracking branch 'origin/sycl' into l0_plugin
againull May 20, 2020
097c595
Update dependency.conf with info about Level Zero
againull May 20, 2020
4e56b22
Fix directory name
againull May 20, 2020
8c655b8
Address review comments
againull May 20, 2020
0fd2f79
Handle bad_alloc and other errors which could happend during new()
againull May 20, 2020
e8722f5
Address review comments
againull May 20, 2020
0a0aabf
Fix formatting problem
againull May 20, 2020
9db2a3b
Address comments
againull May 21, 2020
d76ea58
Address review comments
againull May 22, 2020
a1f740d
Apply suggestion for MaxNumEventsPerPool
againull May 28, 2020
3d70ee3
Fix check for l0-loader target in cmake file
againull May 28, 2020
8c75284
Minor fix
againull May 28, 2020
6b02205
Remove segfault handling during zeInit.
againull May 29, 2020
aebdfe0
Use unordered_map for errors mapping
againull Jun 1, 2020
88559cf
Merge remote-tracking branch 'origin/sycl' into fork_l0_plugin
againull Jun 1, 2020
3a92906
Fixes to address fails after merge with master branch
againull Jun 1, 2020
77e8a78
Merge branch 'sycl' into l0_plugin
againull Jun 2, 2020
d2164f7
Make ErrorMapping static
againull Jun 2, 2020
5cc9836
Merge remote-tracking branch 'origin/sycl' into l0_plugin
Jun 3, 2020
6a85a39
Merge remote-tracking branch 'origin/sycl' into l0_plugin
againull Jun 4, 2020
41ea7e2
Merge remote-tracking branch 'origin/sycl' into l0_plugin_merge
Jun 4, 2020
a303cad
Merge remote-tracking branch 'origin/sycl' into l0_plugin
againull Jun 5, 2020
b792fce
Merge remote-tracking branch 'origin/sycl' into l0_plugin
againull Jun 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ set( SYCL_TOOLCHAIN_DEPLOY_COMPONENTS
sycl-headers-extras
sycl
pi_opencl
pi_level0
libsycldevice
)
if(OpenCL_INSTALL_KHRONOS_ICD_LOADER AND TARGET ocl-icd)
Expand Down
2 changes: 1 addition & 1 deletion sycl/doc/EnvironmentVariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ subject to change. Do not rely on these variables in production code.
| Environment variable | Values | Description |
| -------------------- | ------ | ----------- |
| SYCL_PI_TRACE | Described [below](#sycl_pi_trace-options) | Enable specified level of tracing for PI. |
| SYCL_BE | PI_OPENCL, PI_CUDA | Force SYCL RT to consider only devices of the specified backend during the device selection. |
| SYCL_BE | PI_OPENCL, PI_LEVEL0, PI_CUDA | Force SYCL RT to consider only devices of the specified backend during the device selection. |
| SYCL_DEVICE_TYPE | One of: CPU, GPU, ACC, HOST | Force SYCL to use the specified device type. If unset, default selection rules are applied. If set to any unlisted value, this control has no effect. If the requested device type is not found, a `cl::sycl::runtime_error` exception is thrown. If a non-default device selector is used, a device must satisfy both the selector and this control to be chosen. This control only has effect on devices created with a selector. |
| SYCL_PROGRAM_COMPILE_OPTIONS | String of valid OpenCL compile options | Override compile options for all programs. |
| SYCL_PROGRAM_LINK_OPTIONS | String of valid OpenCL link options | Override link options for all programs. |
Expand Down
8 changes: 6 additions & 2 deletions sycl/doc/GetStartedGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,15 @@ which contains all the symbols required.
To run DPC++ applications on OpenCL devices, OpenCL implementation(s) must be
present in the system.

To run DPC++ applications on Level Zero devices, Level Zero implementation(s)
must be present in the system.

Please, refer to [the Release Notes](../ReleaseNotes.md) for recommended Intel
runtime versions.

The `GPU` runtime that is needed to run DPC++ application on Intel `GPU` devices
can be downloaded from the following web pages:
To run DPC++ application on Intel `GPU` devices the OpenCL `GPU` runtime or the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1699 have this wording changed a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx, according to new wording I just need to specify the version of the L0 runtime in buildbot/dependency.conf. I am not sure if the purpose of this file is just to provide information about version or if it used in some scripts. I will ask people working on CI and then will update this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildbot/dependency.conf is used in CI scripts. Added comment to this file explaining that there is a same driver for Level Zero and OpenCL,

Level Zero `GPU` runtime is needed. They can be downloaded from the following web
pages:

* Linux: [Intel® Graphics Compute Runtime for
OpenCL™](https://github.com/intel/compute-runtime/releases)
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/backend_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {

enum class backend { host, opencl, cuda };
enum class backend { host, opencl, level0, cuda };

template <backend name, typename SYCLObjectT> struct interop;

Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/detail/pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ struct pi_buffer_region_struct {
size_t origin;
size_t size;
};
using pi_buffer_region_struct *pi_buffer_region;
using pi_buffer_region = pi_buffer_region_struct *;

// Offload binaries descriptor version supported by this library.
static const uint16_t PI_DEVICE_BINARIES_VERSION = 1;
Expand Down
2 changes: 2 additions & 0 deletions sycl/include/CL/sycl/detail/pi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ bool trace(TraceLevel level);

#ifdef SYCL_RT_OS_WINDOWS
#define OPENCL_PLUGIN_NAME "pi_opencl.dll"
#define LEVEL0_PLUGIN_NAME "pi_level0.dll"
#define CUDA_PLUGIN_NAME "pi_cuda.dll"
#else
#define OPENCL_PLUGIN_NAME "libpi_opencl.so"
#define LEVEL0_PLUGIN_NAME "libpi_level0.so"
#define CUDA_PLUGIN_NAME "libpi_cuda.so"
#endif

Expand Down
1 change: 1 addition & 0 deletions sycl/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ if(SYCL_BUILD_PI_CUDA)
endif()

add_subdirectory(opencl)
add_subdirectory(Intel_level0)
61 changes: 61 additions & 0 deletions sycl/plugins/Intel_level0/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# PI Level0 plugin library

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
)

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"
)

add_dependencies(pi_level0 l0-loader)
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)
Loading