Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
2 changes: 1 addition & 1 deletion sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ set( SYCL_TOOLCHAIN_DEPLOY_COMPONENTS
sycl-headers-extras
sycl
pi_opencl
pi_level0
pi_level_zero
libsycldevice
)
if(OpenCL_INSTALL_KHRONOS_ICD_LOADER AND TARGET ocl-icd)
Expand Down
4 changes: 2 additions & 2 deletions sycl/doc/EnvironmentVariables.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Environment Variables

This document describes environment variables that are having effect on DPC++
This document describes environment variables that are having effect on DPC++
compiler and runtime.

## Controlling DPC++ RT
Expand All @@ -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_LEVEL0, PI_CUDA | Force SYCL RT to consider only devices of the specified backend during the device selection. |
| SYCL_BE | PI_OPENCL, PI_LEVEL_ZERO, 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
22 changes: 11 additions & 11 deletions sycl/include/CL/sycl/backend/level_zero.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@
__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {

template <> struct interop<backend::level0, platform> {
template <> struct interop<backend::level_zero, platform> {
using type = ze_driver_handle_t;
};

template <> struct interop<backend::level0, device> {
template <> struct interop<backend::level_zero, device> {
using type = ze_device_handle_t;
};

template <> struct interop<backend::level0, queue> {
template <> struct interop<backend::level_zero, queue> {
using type = ze_command_queue_handle_t;
};

template <> struct interop<backend::level0, program> {
template <> struct interop<backend::level_zero, program> {
using type = ze_module_handle_t;
};

template <typename DataT, int Dimensions, access::mode AccessMode>
struct interop<backend::level0, accessor<DataT, Dimensions, AccessMode,
struct interop<backend::level_zero, accessor<DataT, Dimensions, AccessMode,
access::target::global_buffer,
access::placeholder::false_t>> {
using type = char *;
};

namespace level0 {
namespace level_zero {

// Implementation of various "make" functions resides in libsycl.so
platform make_platform(pi_native_handle NativeHandle);
Expand All @@ -48,34 +48,34 @@ queue make_queue(const context &Context, pi_native_handle InteropHandle);
// Construction of SYCL platform.
template <typename T, typename std::enable_if<
std::is_same<T, platform>::value>::type * = nullptr>
T make(typename interop<backend::level0, T>::type Interop) {
T make(typename interop<backend::level_zero, T>::type Interop) {
return make_platform(reinterpret_cast<pi_native_handle>(Interop));
}

// Construction of SYCL device.
template <typename T, typename std::enable_if<
std::is_same<T, device>::value>::type * = nullptr>
T make(const platform &Platform,
typename interop<backend::level0, T>::type Interop) {
typename interop<backend::level_zero, T>::type Interop) {
return make_device(Platform, reinterpret_cast<pi_native_handle>(Interop));
}

// Construction of SYCL program.
template <typename T, typename std::enable_if<
std::is_same<T, program>::value>::type * = nullptr>
T make(const context &Context,
typename interop<backend::level0, T>::type Interop) {
typename interop<backend::level_zero, T>::type Interop) {
return make_program(Context, reinterpret_cast<pi_native_handle>(Interop));
}

// Construction of SYCL queue.
template <typename T, typename std::enable_if<
std::is_same<T, queue>::value>::type * = nullptr>
T make(const context &Context,
typename interop<backend::level0, T>::type Interop) {
typename interop<backend::level_zero, T>::type Interop) {
return make_queue(Context, reinterpret_cast<pi_native_handle>(Interop));
}

} // namespace level0
} // namespace level_zero
} // namespace sycl
} // __SYCL_INLINE_NAMESPACE(cl)
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/detail/pi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +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 LEVEL_ZERO_PLUGIN_NAME "pi_level_zero.dll"
#define CUDA_PLUGIN_NAME "pi_cuda.dll"
#else
#define OPENCL_PLUGIN_NAME "libpi_opencl.so"
#define LEVEL0_PLUGIN_NAME "libpi_level0.so"
#define LEVEL_ZERO_PLUGIN_NAME "libpi_level_zero.so"
#define CUDA_PLUGIN_NAME "libpi_cuda.so"
#endif

Expand Down
30 changes: 15 additions & 15 deletions sycl/plugins/level_zero/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PI Level0 plugin library
# PI Level Zero plugin library

if(MSVC)
set(L0_LOADER
Expand Down Expand Up @@ -66,44 +66,44 @@ target_include_directories(L0Loader-Headers
include_directories("${sycl_inc_dir}")
include_directories(${OPENCL_INCLUDE})

add_library(pi_level0 SHARED
add_library(pi_level_zero SHARED
"${sycl_inc_dir}/CL/sycl/detail/pi.h"
"${CMAKE_CURRENT_SOURCE_DIR}/pi_level0.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/pi_level0.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/pi_level_zero.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/pi_level_zero.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)
target_compile_definitions(pi_level_zero 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)
target_compile_options(pi_level_zero 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
target_link_libraries( pi_level_zero
PRIVATE "-Wl,--version-script=${linker_script}"
)
endif()

if (TARGET l0-loader)
Copy link
Contributor

Choose a reason for hiding this comment

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

"l0"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

add_dependencies(pi_level0 l0-loader)
add_dependencies(pi_level_zero l0-loader)
endif()
add_dependencies(sycl-toolchain pi_level0)
add_dependencies(sycl-toolchain pi_level_zero)

target_link_libraries(pi_level0 PRIVATE "${L0_LOADER}")
target_link_libraries(pi_level_zero PRIVATE "${L0_LOADER}")
Copy link
Contributor

Choose a reason for hiding this comment

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

"L0"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

if (UNIX)
target_link_libraries(pi_level0 PRIVATE pthread)
target_link_libraries(pi_level_zero PRIVATE pthread)
endif()

add_common_options(pi_level0)
add_common_options(pi_level_zero)

install(TARGETS pi_level0
LIBRARY DESTINATION "lib" COMPONENT pi_level0
RUNTIME DESTINATION "bin" COMPONENT pi_level0)
install(TARGETS pi_level_zero
LIBRARY DESTINATION "lib" COMPONENT pi_level_zero
RUNTIME DESTINATION "bin" COMPONENT pi_level_zero)
Loading