From 215f591ade97aed616c4094a467e5dcbebc45d6b Mon Sep 17 00:00:00 2001 From: Gail Lyons <59890131+glyons-intel@users.noreply.github.com> Date: Thu, 30 Jul 2020 10:34:36 -0400 Subject: [PATCH] [SYCL] Changed sycl::backend::level0 to sycl::backend::level_zero (#2025) PI_LEVEL0 -> PI_LEVEL_ZERO. PI_LEVEL0 is still accepted and handled correctly. Signed-off-by: Gail Lyons --- sycl/CMakeLists.txt | 4 +- sycl/ReleaseNotes.md | 2 +- sycl/doc/EnvironmentVariables.md | 4 +- sycl/include/CL/sycl/backend/level_zero.hpp | 32 ++-- sycl/include/CL/sycl/backend_types.hpp | 4 +- sycl/include/CL/sycl/detail/pi.hpp | 4 +- sycl/plugins/level_zero/CMakeLists.txt | 84 ++++----- .../{pi_level0.cpp => pi_level_zero.cpp} | 161 +++++++++--------- .../{pi_level0.hpp => pi_level_zero.hpp} | 69 ++++---- sycl/source/backend/level_zero.cpp | 18 +- sycl/source/detail/config.hpp | 12 +- sycl/source/detail/pi.cpp | 12 +- .../program_manager/program_manager.cpp | 8 +- sycl/source/device_selector.cpp | 4 +- sycl/test/CMakeLists.txt | 8 +- ...k.dump => pi_level_zero_symbol_check.dump} | 2 +- sycl/test/abi/sycl_symbols_linux.dump | 20 +-- .../basic_tests/buffer/buffer_full_copy.cpp | 2 +- sycl/test/basic_tests/buffer/reinterpret.cpp | 2 +- sycl/test/basic_tests/get_backend.cpp | 3 +- .../basic_tests/image_accessor_readwrite.cpp | 2 +- .../image_accessor_readwrite_half.cpp | 2 +- sycl/test/basic_tests/kernel_info.cpp | 4 +- .../basic_tests/parallel_for_indexers.cpp | 2 +- sycl/test/basic_tests/parallel_for_range.cpp | 2 +- .../host-task-dependency.cpp | 2 +- .../host-task-two-queues.cpp | 2 +- sycl/test/host-interop-task/interop-task.cpp | 2 +- sycl/test/lit.cfg.py | 16 +- sycl/test/plugins/sycl-ls-gpu-default.cpp | 2 +- sycl/test/regression/fsycl-save-temps.cpp | 4 +- sycl/test/regression/image_access.cpp | 4 +- sycl/test/regression/static-buffer-dtor.cpp | 2 +- sycl/test/spec_const/spec_const_hw.cpp | 2 +- .../spec_const/spec_const_hw_accelerator.cpp | 2 +- sycl/test/spec_const/spec_const_neg.cpp | 2 +- sycl/test/spec_const/spec_const_redefine.cpp | 2 +- .../spec_const_redefine_accelerator.cpp | 2 +- sycl/tools/CMakeLists.txt | 10 +- sycl/tools/get_device_count_by_type.cpp | 4 +- sycl/unittests/pi/BackendString.hpp | 2 +- 41 files changed, 267 insertions(+), 260 deletions(-) rename sycl/plugins/level_zero/{pi_level0.cpp => pi_level_zero.cpp} (96%) rename sycl/plugins/level_zero/{pi_level0.hpp => pi_level_zero.hpp} (86%) mode change 100755 => 100644 rename sycl/test/abi/{pi_level0_symbol_check.dump => pi_level_zero_symbol_check.dump} (98%) diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txt index d540c23ea0a64..1b7ae47f7b7fb 100644 --- a/sycl/CMakeLists.txt +++ b/sycl/CMakeLists.txt @@ -14,7 +14,7 @@ include(AddSYCLExecutable) set(SYCL_MAJOR_VERSION 2) set(SYCL_MINOR_VERSION 1) set(SYCL_PATCH_VERSION 0) -set(SYCL_DEV_ABI_VERSION 3) +set(SYCL_DEV_ABI_VERSION 4) if (SYCL_ADD_DEV_VERSION_POSTFIX) set(SYCL_VERSION_POSTFIX "-${SYCL_DEV_ABI_VERSION}") endif() @@ -326,7 +326,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) diff --git a/sycl/ReleaseNotes.md b/sycl/ReleaseNotes.md index 70d30cf3cfd5b..7c6963777fb30 100644 --- a/sycl/ReleaseNotes.md +++ b/sycl/ReleaseNotes.md @@ -62,7 +62,7 @@ Release notes for the commit range ba404be..24726df - Added a cache for PI plugins, so subsequent calls for `sycl::device` creation should be cheaper [03dd60d] - A SYCL program will be aborted now if program linking is requested when - using L0 plugin. This is done because L0 doesn't support program linking + using Level Zero plugin. This is done because L0 doesn't support program linking [d4a5b71] - Added a diagnostic on attempt to use `sycl::program::set_spec_constant` when the program is already in compiled or linked state [e2e3d3d] diff --git a/sycl/doc/EnvironmentVariables.md b/sycl/doc/EnvironmentVariables.md index 3d8d5cb41f741..b353135ecb9db 100644 --- a/sycl/doc/EnvironmentVariables.md +++ b/sycl/doc/EnvironmentVariables.md @@ -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 @@ -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. | diff --git a/sycl/include/CL/sycl/backend/level_zero.hpp b/sycl/include/CL/sycl/backend/level_zero.hpp index 3dd6fa2b8677b..82de4eb4c6a78 100644 --- a/sycl/include/CL/sycl/backend/level_zero.hpp +++ b/sycl/include/CL/sycl/backend/level_zero.hpp @@ -14,37 +14,37 @@ __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { -template <> struct interop { +template <> struct interop { using type = ze_driver_handle_t; }; -template <> struct interop { +template <> struct interop { using type = ze_device_handle_t; }; -template <> struct interop { +template <> struct interop { using type = ze_command_queue_handle_t; }; -template <> struct interop { +template <> struct interop { using type = ze_module_handle_t; }; template -struct interop> { +struct interop> { using type = char *; }; template -struct interop> { +struct interop> { using type = char *; }; -namespace level0 { +namespace level_zero { // Implementation of various "make" functions resides in libsycl.so platform make_platform(pi_native_handle NativeHandle); @@ -55,7 +55,7 @@ queue make_queue(const context &Context, pi_native_handle InteropHandle); // Construction of SYCL platform. template ::value>::type * = nullptr> -T make(typename interop::type Interop) { +T make(typename interop::type Interop) { return make_platform(reinterpret_cast(Interop)); } @@ -63,7 +63,7 @@ T make(typename interop::type Interop) { template ::value>::type * = nullptr> T make(const platform &Platform, - typename interop::type Interop) { + typename interop::type Interop) { return make_device(Platform, reinterpret_cast(Interop)); } @@ -71,7 +71,7 @@ T make(const platform &Platform, template ::value>::type * = nullptr> T make(const context &Context, - typename interop::type Interop) { + typename interop::type Interop) { return make_program(Context, reinterpret_cast(Interop)); } @@ -79,10 +79,10 @@ T make(const context &Context, template ::value>::type * = nullptr> T make(const context &Context, - typename interop::type Interop) { + typename interop::type Interop) { return make_queue(Context, reinterpret_cast(Interop)); } -} // namespace level0 +} // namespace level_zero } // namespace sycl } // __SYCL_INLINE_NAMESPACE(cl) diff --git a/sycl/include/CL/sycl/backend_types.hpp b/sycl/include/CL/sycl/backend_types.hpp index 362c6d9d9b5b9..655bbf89d8d39 100644 --- a/sycl/include/CL/sycl/backend_types.hpp +++ b/sycl/include/CL/sycl/backend_types.hpp @@ -18,7 +18,7 @@ __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { -enum class backend : char { host, opencl, level0, cuda }; +enum class backend : char { host, opencl, level_zero, cuda }; template struct interop; @@ -30,7 +30,7 @@ inline std::ostream &operator<<(std::ostream &Out, backend be) { case backend::opencl: Out << std::string("opencl"); break; - case backend::level0: + case backend::level_zero: Out << std::string("level-zero"); break; case backend::cuda: diff --git a/sycl/include/CL/sycl/detail/pi.hpp b/sycl/include/CL/sycl/detail/pi.hpp index 5301dd288502a..c106c5cba35bd 100644 --- a/sycl/include/CL/sycl/detail/pi.hpp +++ b/sycl/include/CL/sycl/detail/pi.hpp @@ -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 diff --git a/sycl/plugins/level_zero/CMakeLists.txt b/sycl/plugins/level_zero/CMakeLists.txt index b7e89af870b48..a90dfc8ac841f 100755 --- a/sycl/plugins/level_zero/CMakeLists.txt +++ b/sycl/plugins/level_zero/CMakeLists.txt @@ -1,14 +1,14 @@ -# PI Level0 plugin library +# PI Level Zero plugin library if(MSVC) - set(L0_LOADER + set(LEVEL_ZERO_LOADER "${LLVM_LIBRARY_OUTPUT_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ze_loader${CMAKE_STATIC_LIBRARY_SUFFIX}") else() - set(L0_LOADER + set(LEVEL_ZERO_LOADER "${LLVM_LIBRARY_OUTPUT_INTDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}ze_loader${CMAKE_SHARED_LIBRARY_SUFFIX}") endif() -if (NOT DEFINED L0_LIBRARY OR NOT DEFINED L0_INCLUDE_DIR) +if (NOT DEFINED LEVEL_ZERO_LIBRARY OR NOT DEFINED LEVEL_ZERO_INCLUDE_DIR) message(STATUS "Download Level Zero loader and headers from github.com") if (CMAKE_C_COMPILER) list(APPEND AUX_CMAKE_FLAGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}) @@ -16,18 +16,18 @@ if (NOT DEFINED L0_LIBRARY OR NOT DEFINED L0_INCLUDE_DIR) 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) - set(L0_LOADER_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/Level0/l0_loader") - if (NOT DEFINED SYCL_EP_L0_LOADER_SKIP_AUTO_UPDATE) - set(SYCL_EP_L0_LOADER_SKIP_AUTO_UPDATE ${SYCL_EXTERNAL_PROJECTS_SKIP_AUTO_UPDATE}) + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/level_zero_loader_build) + set(LEVEL_ZERO_LOADER_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/level_zero/level_zero_loader") + if (NOT DEFINED SYCL_EP_LEVEL_ZERO_LOADER_SKIP_AUTO_UPDATE) + set(SYCL_EP_LEVEL_ZERO_LOADER_SKIP_AUTO_UPDATE ${SYCL_EXTERNAL_PROJECTS_SKIP_AUTO_UPDATE}) endif() - ExternalProject_Add(l0-loader + ExternalProject_Add(level-zero-loader GIT_REPOSITORY https://github.com/oneapi-src/level-zero.git GIT_TAG v0.91.21 - UPDATE_DISCONNECTED ${SYCL_EP_L0_LOADER_SKIP_AUTO_UPDATE} - SOURCE_DIR ${L0_LOADER_SOURCE_DIR} - BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/l0_loader_build" - INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/l0_loader_install" + UPDATE_DISCONNECTED ${SYCL_EP_LEVEL_ZERO_LOADER_SKIP_AUTO_UPDATE} + SOURCE_DIR ${LEVEL_ZERO_LOADER_SOURCE_DIR} + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/level_zero_loader_build" + INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/level_zero_loader_install" CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DOpenCL_INCLUDE_DIR=${OpenCL_INCLUDE_DIRS} @@ -36,50 +36,50 @@ if (NOT DEFINED L0_LIBRARY OR NOT DEFINED L0_INCLUDE_DIR) ${AUX_CMAKE_FLAGS} STEP_TARGETS configure,build,install DEPENDS ocl-headers - BUILD_BYPRODUCTS ${L0_LOADER} + BUILD_BYPRODUCTS ${LEVEL_ZERO_LOADER} ) - ExternalProject_Add_Step(l0-loader llvminstall + ExternalProject_Add_Step(level-zero-loader llvminstall COMMAND ${CMAKE_COMMAND} -E copy_directory / ${LLVM_BINARY_DIR} - COMMENT "Installing l0-loader into the LLVM binary directory" + COMMENT "Installing level-zero-loader into the LLVM binary directory" DEPENDEES install ) - install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/l0_loader_install/" + install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/level_zero_loader_install/" DESTINATION "." - COMPONENT l0-loader + COMPONENT level-zero-loader ) - list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS l0-loader) + list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS level-zero-loader) else() - include_directories("${L0_INCLUDE_DIR}") - file(GLOB L0_LIBRARY_SRC "${L0_LIBRARY}*") - file(COPY ${L0_LIBRARY_SRC} DESTINATION ${LLVM_LIBRARY_OUTPUT_INTDIR}) - add_custom_target(l0-loader DEPENDS ${L0_LIBRARY} COMMENT "Copying Level Zero Loader ...") + include_directories("${LEVEL_ZERO_INCLUDE_DIR}") + file(GLOB LEVEL_ZERO_LIBRARY_SRC "${LEVEL_ZERO_LIBRARY}*") + file(COPY ${LEVEL_ZERO_LIBRARY_SRC} DESTINATION ${LLVM_LIBRARY_OUTPUT_INTDIR}) + add_custom_target(level-zero-loader DEPENDS ${LEVEL_ZERO_LIBRARY} COMMENT "Copying Level Zero Loader ...") endif() -add_library (L0Loader-Headers INTERFACE) -add_library (L0Loader::Headers ALIAS L0Loader-Headers) -target_include_directories(L0Loader-Headers - INTERFACE "${L0_INCLUDE_DIR}" +add_library (LevelZeroLoader-Headers INTERFACE) +add_library (LevelZeroLoader::Headers ALIAS LevelZeroLoader-Headers) +target_include_directories(LevelZeroLoader-Headers + INTERFACE "${LEVEL_ZERO_INCLUDE_DIR}" ) 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) @@ -87,23 +87,23 @@ else() # 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) - add_dependencies(pi_level0 l0-loader) +if (TARGET level-zero-loader) + add_dependencies(pi_level_zero level-zero-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 "${LEVEL_ZERO_LOADER}") 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) diff --git a/sycl/plugins/level_zero/pi_level0.cpp b/sycl/plugins/level_zero/pi_level_zero.cpp similarity index 96% rename from sycl/plugins/level_zero/pi_level0.cpp rename to sycl/plugins/level_zero/pi_level_zero.cpp index 47042442f1c45..a77719a2220ae 100644 --- a/sycl/plugins/level_zero/pi_level0.cpp +++ b/sycl/plugins/level_zero/pi_level_zero.cpp @@ -1,17 +1,17 @@ -//===----------- pi_level0.cpp - Level Zero Plugin--------------------------==// +//===-------- pi_level_zero.cpp - Level Zero Plugin --------------------==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -//===----------------------------------------------------------------------===// +//===------------------------------------------------------------------===// -/// \file pi_level0.cpp +/// \file pi_level_zero.cpp /// Implementation of Level Zero Plugin. /// -/// \ingroup sycl_pi_level0 +/// \ingroup sycl_pi_level_zero -#include "pi_level0.hpp" +#include "pi_level_zero.hpp" #include #include #include @@ -26,8 +26,8 @@ namespace { -// Controls L0 calls serialization to w/a L0 driver being not MT ready. -// Recognized values (can be used as a bit mask): +// Controls Level Zero calls serialization to w/a Level Zero driver being not MT +// ready. Recognized values (can be used as a bit mask): enum { ZeSerializeNone = 0, // no locking or blocking (except when SYCL RT requested blocking) @@ -37,10 +37,10 @@ enum { }; static pi_uint32 ZeSerialize = 0; -// This class encapsulates actions taken along with a call to L0 API. +// This class encapsulates actions taken along with a call to Level Zero API. class ZeCall { private: - // The global mutex that is used for total serialization of L0 calls. + // The global mutex that is used for total serialization of Level Zero calls. static std::mutex GlobalLock; public: @@ -61,7 +61,7 @@ class ZeCall { }; std::mutex ZeCall::GlobalLock; -// Controls L0 calls tracing in zePrint. +// Controls Level Zero calls tracing in zePrint. static bool ZeDebug = false; static void zePrint(const char *Format, ...) { @@ -233,12 +233,12 @@ _pi_context::decrementAliveEventsInPool(ze_event_pool_handle_t ZePool) { return ZE_RESULT_SUCCESS; } -// Some opencl extensions we know are supported by all Level0 devices. +// Some opencl extensions we know are supported by all Level Zero devices. constexpr char ZE_SUPPORTED_EXTENSIONS[] = "cl_khr_il_program cl_khr_subgroups cl_intel_subgroups " "cl_intel_subgroups_short cl_intel_required_subgroup_size "; -// Map L0 runtime error code to PI error code +// Map Level Zero runtime error code to PI error code static pi_result mapError(ze_result_t ZeResult) { // TODO: these mapping need to be clarified and synced with the PI API return // values, which is TBD. @@ -373,7 +373,7 @@ pi_result _pi_device::initialize() { // Crate a new command list to be used in a PI call pi_result _pi_device::createCommandList(ze_command_list_handle_t *ZeCommandList) { - // Create the command list, because in L0 commands are added to + // Create the command list, because in Level Zero commands are added to // the command lists, and later are then added to the command queue. // // TODO: Figure out how to lower the overhead of creating a new list @@ -448,7 +448,7 @@ pi_result piPlatformsGet(pi_uint32 NumEntries, pi_platform *Platforms, return PI_INVALID_VALUE; } - // This is a good time to initialize L0. + // This is a good time to initialize Level Zero. // TODO: We can still safely recover if something goes wrong during the init. // Implement handling segfault using sigaction. // TODO: We should not call zeInit multiples times ever, so @@ -467,7 +467,7 @@ pi_result piPlatformsGet(pi_uint32 NumEntries, pi_platform *Platforms, return mapError(ZeResult); } - // L0 does not have concept of Platforms, but L0 driver is the + // Level Zero does not have concept of Platforms, but Level Zero driver is the // closest match. if (Platforms && NumEntries > 0) { uint32_t ZeDriverCount = 0; @@ -533,10 +533,10 @@ pi_result piPlatformGetInfo(pi_platform Platform, pi_platform_info ParamName, switch (ParamName) { case PI_PLATFORM_INFO_NAME: - // TODO: Query L0 driver when relevant info is added there. + // TODO: Query Level Zero driver when relevant info is added there. return ReturnValue("Intel(R) Level-Zero"); case PI_PLATFORM_INFO_VENDOR: - // TODO: Query L0 driver when relevant info is added there. + // TODO: Query Level Zero driver when relevant info is added there. return ReturnValue("Intel(R) Corporation"); case PI_PLATFORM_INFO_EXTENSIONS: // Convention adopted from OpenCL: @@ -547,7 +547,7 @@ pi_result piPlatformGetInfo(pi_platform Platform, pi_platform_info ParamName, // // TODO: Check the common extensions supported by all connected devices and // return them. For now, hardcoding some extensions we know are supported by - // all Level0 devices. + // all Level Zero devices. return ReturnValue(ZE_SUPPORTED_EXTENSIONS); case PI_PLATFORM_INFO_PROFILE: // TODO: figure out what this means and how is this used @@ -575,7 +575,7 @@ pi_result piextPlatformGetNativeHandle(pi_platform Platform, assert(NativeHandle); auto ZeDriver = pi_cast(NativeHandle); - // Extract the L0 driver handle from the given PI platform + // Extract the Level Zero driver handle from the given PI platform *ZeDriver = Platform->ZeDriver; return PI_SUCCESS; } @@ -585,7 +585,7 @@ pi_result piextPlatformCreateWithNativeHandle(pi_native_handle NativeHandle, assert(NativeHandle); assert(Platform); - // Create PI platform from the given L0 driver handle. + // Create PI platform from the given Level Zero driver handle. auto ZeDriver = pi_cast(NativeHandle); *Platform = new _pi_platform(ZeDriver); return PI_SUCCESS; @@ -598,7 +598,7 @@ pi_result piDevicesGet(pi_platform Platform, pi_device_type DeviceType, assert(Platform); ze_driver_handle_t ZeDriver = Platform->ZeDriver; - // Get number of devices supporting L0 + // Get number of devices supporting Level Zero uint32_t ZeDeviceCount = 0; const bool AskingForGPU = (DeviceType & PI_DEVICE_TYPE_GPU); const bool AskingForDefault = (DeviceType == PI_DEVICE_TYPE_DEFAULT); @@ -718,7 +718,7 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName, return ReturnValue(PI_DEVICE_TYPE_GPU); } case PI_DEVICE_INFO_PARENT_DEVICE: - // TODO: all L0 devices are parent ? + // TODO: all Level Zero devices are parent ? return ReturnValue(pi_device{0}); case PI_DEVICE_INFO_PLATFORM: return ReturnValue(Device->Platform); @@ -729,8 +729,8 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName, // "Returns a space separated list of extension names (the extension // names themselves do not contain any spaces) supported by the device." // - // TODO: Use proper mechanism to get this information from Level0 after - // it is added to Level0. + // TODO: Use proper mechanism to get this information from Level Zero after + // it is added to Level Zero. // Hardcoding the few we know are supported by the current hardware. // // @@ -754,7 +754,8 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName, // cl_khr_3d_image_writes - Extension to enable writes to 3D image memory // objects. // - // Hardcoding some extensions we know are supported by all Level0 devices. + // Hardcoding some extensions we know are supported by all Level Zero + // devices. SupportedExtensions += (ZE_SUPPORTED_EXTENSIONS); if (ZeDeviceKernelProperties.fp16Supported) SupportedExtensions += ("cl_khr_fp16 "); @@ -784,7 +785,7 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName, return ReturnValue(pi_uint32{MaxComputeUnits}); } case PI_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS: - // L0 spec defines only three dimensions + // Level Zero spec defines only three dimensions return ReturnValue(pi_uint32{3}); case PI_DEVICE_INFO_MAX_WORK_GROUP_SIZE: return ReturnValue( @@ -845,7 +846,7 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName, return ReturnValue(pi_uint32{Device->RefCount}); case PI_DEVICE_INFO_PARTITION_PROPERTIES: { // It is debatable if SYCL sub-device and partitioning APIs sufficient to - // expose Level0 sub-devices? We start with support of + // expose Level Zero sub-devices? We start with support of // "partition_by_affinity_domain" and "numa" but if that doesn't seem to // be a good fit we could look at adding a more descriptive partitioning // type. @@ -913,7 +914,7 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName, case PI_DEVICE_INFO_MEM_BASE_ADDR_ALIGN: // SYCL/OpenCL spec is vague on what this means exactly, but seems to // be for "alignment requirement (in bits) for sub-buffer offsets." - // An OpenCL implementation returns 8*128, but L0 can do just 8, + // An OpenCL implementation returns 8*128, but Level Zero can do just 8, // meaning unaligned access for values of types larger than 8 bits. return ReturnValue(pi_uint32{8}); case PI_DEVICE_INFO_MAX_SAMPLERS: @@ -995,24 +996,24 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName, return ReturnValue(pi_uint64{DoubleFPValue}); } case PI_DEVICE_INFO_IMAGE2D_MAX_WIDTH: - // Until L0 provides needed info, hardcode default minimum values required - // by the SYCL specification. + // Until Level Zero provides needed info, hardcode default minimum values + // required by the SYCL specification. return ReturnValue(size_t{8192}); case PI_DEVICE_INFO_IMAGE2D_MAX_HEIGHT: - // Until L0 provides needed info, hardcode default minimum values required - // by the SYCL specification. + // Until Level Zero provides needed info, hardcode default minimum values + // required by the SYCL specification. return ReturnValue(size_t{8192}); case PI_DEVICE_INFO_IMAGE3D_MAX_WIDTH: - // Until L0 provides needed info, hardcode default minimum values required - // by the SYCL specification. + // Until Level Zero provides needed info, hardcode default minimum values + // required by the SYCL specification. return ReturnValue(size_t{2048}); case PI_DEVICE_INFO_IMAGE3D_MAX_HEIGHT: - // Until L0 provides needed info, hardcode default minimum values required - // by the SYCL specification. + // Until Level Zero provides needed info, hardcode default minimum values + // required by the SYCL specification. return ReturnValue(size_t{2048}); case PI_DEVICE_INFO_IMAGE3D_MAX_DEPTH: - // Until L0 provides needed info, hardcode default minimum values required - // by the SYCL specification. + // Until Level Zero provides needed info, hardcode default minimum values + // required by the SYCL specification. return ReturnValue(size_t{2048}); case PI_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE: return ReturnValue(size_t{ZeDeviceImageProperties.maxImageBufferSize}); @@ -1106,7 +1107,7 @@ pi_result piDevicePartition(pi_device Device, const pi_device_partition_property *Properties, pi_uint32 NumDevices, pi_device *OutDevices, pi_uint32 *OutNumDevices) { - // Other partitioning ways are not supported by L0 + // Other partitioning ways are not supported by Level Zero if (Properties[0] != PI_DEVICE_PARTITION_BY_AFFINITY_DOMAIN || Properties[1] != PI_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE) { return PI_INVALID_VALUE; @@ -1139,7 +1140,7 @@ pi_result piDevicePartition(pi_device Device, auto ZeSubdevices = new ze_device_handle_t[Count]; ZE_CALL(zeDeviceGetSubDevices(Device->ZeDevice, &Count, ZeSubdevices)); - // Wrap the L0 sub-devices into PI sub-devices, and write them out. + // Wrap the Level Zero sub-devices into PI sub-devices, and write them out. for (uint32_t I = 0; I < Count; ++I) { OutDevices[I] = new _pi_device(ZeSubdevices[I], Device->Platform, true /* isSubDevice */); @@ -1183,7 +1184,7 @@ pi_result piextDeviceGetNativeHandle(pi_device Device, assert(NativeHandle); auto ZeDevice = pi_cast(NativeHandle); - // Extract the L0 module handle from the given PI device + // Extract the Level Zero module handle from the given PI device *ZeDevice = Device->ZeDevice; return PI_SUCCESS; } @@ -1195,7 +1196,7 @@ pi_result piextDeviceCreateWithNativeHandle(pi_native_handle NativeHandle, assert(Device); assert(Platform); - // Create PI device from the given L0 device handle. + // Create PI device from the given Level Zero device handle. auto ZeDevice = pi_cast(NativeHandle); *Device = new _pi_device(ZeDevice, Platform); return (*Device)->initialize(); @@ -1208,7 +1209,7 @@ pi_result piContextCreate(const pi_context_properties *Properties, void *UserData), void *UserData, pi_context *RetContext) { - // L0 does not have notion of contexts. + // Level Zero does not have notion of contexts. // Return the device handle (only single device is allowed) as a context // handle. if (NumDevices != 1) { @@ -1387,7 +1388,7 @@ pi_result piextQueueGetNativeHandle(pi_queue Queue, assert(NativeHandle); auto ZeQueue = pi_cast(NativeHandle); - // Extract the L0 queue handle from the given PI queue + // Extract the Level Zero queue handle from the given PI queue *ZeQueue = Queue->ZeCommandQueue; return PI_SUCCESS; } @@ -1437,9 +1438,9 @@ pi_result piMemBufferCreate(pi_context Context, pi_mem_flags Flags, size_t Size, auto HostPtrOrNull = (Flags & PI_MEM_FLAGS_HOST_PTR_USE) ? pi_cast(HostPtr) : nullptr; try { - *RetMem = new _pi_buffer(Context->Device->Platform, - pi_cast(Ptr) /* L0 Memory Handle */, - HostPtrOrNull); + *RetMem = new _pi_buffer( + Context->Device->Platform, + pi_cast(Ptr) /* Level Zero Memory Handle */, HostPtrOrNull); } catch (const std::bad_alloc &) { return PI_OUT_OF_HOST_MEMORY; } catch (...) { @@ -1660,8 +1661,8 @@ pi_result piProgramCreate(pi_context Context, const void *IL, size_t Length, assert(Context); assert(Program); - // NOTE: the L0 module creation is also building the program, so we are - // deferring it until the program is ready to be built in piProgramBuild + // NOTE: the Level Zero module creation is also building the program, so we + // are deferring it until the program is ready to be built in piProgramBuild // and piProgramCompile. Also it is only then we know the build options. // ze_module_desc_t ZeModuleDesc = {}; @@ -1726,7 +1727,7 @@ pi_result piclProgramCreateWithSource(pi_context Context, pi_uint32 Count, const size_t *Lengths, pi_program *RetProgram) { - zePrint("piclProgramCreateWithSource: not supported in L0\n"); + zePrint("piclProgramCreateWithSource: not supported in Level Zero\n"); return PI_INVALID_OPERATION; } @@ -1740,7 +1741,7 @@ pi_result piProgramGetInfo(pi_program Program, pi_program_info ParamName, case PI_PROGRAM_INFO_REFERENCE_COUNT: return ReturnValue(pi_uint32{Program->RefCount}); case PI_PROGRAM_INFO_NUM_DEVICES: - // L0 Module is always for a single device. + // Level Zero Module is always for a single device. return ReturnValue(pi_uint32{1}); case PI_PROGRAM_INFO_DEVICES: return ReturnValue(Program->Context->Device); @@ -1764,7 +1765,7 @@ pi_result piProgramGetInfo(pi_program Program, pi_program_info ParamName, case PI_PROGRAM_INFO_KERNEL_NAMES: try { // There are extra allocations/copying here dictated by the difference - // in L0 and PI interfaces. + // in Level Zero and PI interfaces. uint32_t Count = 0; ZE_CALL(zeModuleGetKernelNames(Program->ZeModule, &Count, nullptr)); char **PNames = new char *[Count]; @@ -1795,7 +1796,9 @@ pi_result piProgramLink(pi_context Context, pi_uint32 NumDevices, const pi_program *InputPrograms, void (*PFnNotify)(pi_program Program, void *UserData), void *UserData, pi_program *RetProgram) { - // TODO: L0 does not [yet] support linking so dummy implementation here. + + // TODO: Level Zero does not [yet] support linking so dummy implementation + // here. assert(NumInputPrograms == 1 && InputPrograms); assert(RetProgram); *RetProgram = InputPrograms[0]; @@ -1812,7 +1815,7 @@ pi_result piProgramCompile( assert(NumInputHeaders == 0); assert(!InputHeaders); - // There is no support foe linking yet in L0 so "compile" actually + // There is no support for linking yet in Level Zero so "compile" actually // does the "build". return piProgramBuild(Program, NumDevices, DeviceList, Options, PFnNotify, UserData); @@ -1858,6 +1861,7 @@ pi_result piProgramBuild(pi_program Program, pi_uint32 NumDevices, ze_device_handle_t ZeDevice = Program->Context->Device->ZeDevice; ZE_CALL(zeModuleCreate(ZeDevice, &Program->ZeModuleDesc, &Program->ZeModule, &Program->ZeBuildLog)); + return PI_SUCCESS; } @@ -1868,14 +1872,14 @@ pi_result piProgramGetBuildInfo(pi_program Program, pi_device Device, ReturnHelper ReturnValue(ParamValueSize, ParamValue, ParamValueSizeRet); if (ParamName == CL_PROGRAM_BINARY_TYPE) { - // TODO: is this the only supported binary type in L0? + // TODO: is this the only supported binary type in Level Zero? // We should probably return CL_PROGRAM_BINARY_TYPE_NONE if asked // before the program was compiled. return ReturnValue( cl_program_binary_type{CL_PROGRAM_BINARY_TYPE_EXECUTABLE}); } if (ParamName == CL_PROGRAM_BUILD_OPTIONS) { - // TODO: how to get module build options out of L0? + // TODO: how to get module build options out of Level Zero? // For the programs that we compiled we can remember the options // passed with piProgramCompile/piProgramBuild, but what can we // return for programs that were built outside and registered @@ -1909,7 +1913,7 @@ pi_result piProgramRelease(pi_program Program) { delete[] Program->ZeModuleDesc.pInputModule; if (Program->ZeBuildLog) zeModuleBuildLogDestroy(Program->ZeBuildLog); - // TODO: call zeModuleDestroy for non-interop L0 modules + // TODO: call zeModuleDestroy for non-interop Level Zero modules delete Program; } return PI_SUCCESS; @@ -1921,7 +1925,7 @@ pi_result piextProgramGetNativeHandle(pi_program Program, assert(NativeHandle); auto ZeModule = pi_cast(NativeHandle); - // Extract the L0 module handle from the given PI program + // Extract the Level Zero module handle from the given PI program *ZeModule = Program->ZeModule; return PI_SUCCESS; } @@ -1935,9 +1939,9 @@ pi_result piextProgramCreateWithNativeHandle(pi_native_handle NativeHandle, auto ZeModule = pi_cast(NativeHandle); - // Create PI program from the given L0 module handle. + // Create PI program from the given Level Zero module handle. // - // TODO: We don't have the real L0 module descriptor with + // TODO: We don't have the real Level Zero module descriptor with // which it was created, but that's only needed for zeModuleCreate, // which we don't expect to be called on the interop program. // @@ -2050,9 +2054,9 @@ pi_result piKernelGetInfo(pi_kernel Kernel, pi_kernel_info ParamName, case PI_KERNEL_INFO_PROGRAM: return ReturnValue(pi_program{Kernel->Program}); case PI_KERNEL_INFO_FUNCTION_NAME: - // TODO: Replace with the line in the comment once bug in the L0 driver will - // be fixed. Problem is that currently L0 driver truncates name of the - // returned kernel if it is longer than 256 symbols. + // TODO: Replace with the line in the comment once bug in the Level Zero + // driver will be fixed. Problem is that currently Level Zero driver + // truncates name of the returned kernel if it is longer than 256 symbols. // // return ReturnValue(ZeKernelProperties.name); return ReturnValue(Kernel->KernelName.c_str()); @@ -2376,7 +2380,7 @@ pi_result piEventGetProfilingInfo(pi_event Event, pi_profiling_info ParamName, } case PI_PROFILING_INFO_COMMAND_QUEUED: case PI_PROFILING_INFO_COMMAND_SUBMIT: - // TODO: Support these when L0 supported is added. + // TODO: Support these when Level Zero supported is added. return ReturnValue(uint64_t{0}); default: zePrint("piEventGetProfilingInfo: not supported ParamName\n"); @@ -3016,8 +3020,8 @@ piEnqueueMemBufferMap(pi_queue Queue, pi_mem Buffer, pi_bool BlockingMap, ZE_CALL(zeCommandListAppendWaitOnEvents(ZeCommandList, NumEventsInWaitList, ZeEventWaitList)); - // TODO: L0 is missing the memory "mapping" capabilities, so we are left - // to doing new memory allocation and a copy (read). + // TODO: Level Zero is missing the memory "mapping" capabilities, so we are + // left to doing new memory allocation and a copy (read). // // TODO: check if the input buffer is already allocated in shared // memory and thus is accessible from the host as is. Can we get SYCL RT @@ -3087,8 +3091,8 @@ pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem MemObj, void *MappedPtr, ZE_CALL(zeCommandListAppendWaitOnEvents(ZeCommandList, NumEventsInWaitList, ZeEventWaitList)); - // TODO: L0 is missing the memory "mapping" capabilities, so we are left - // to doing copy (write back to the device). + // TODO: Level Zero is missing the memory "mapping" capabilities, so we are + // left to doing copy (write back to the device). // // NOTE: Keep this in sync with the implementation of // piEnqueueMemBufferMap/piEnqueueMemImageMap. @@ -3204,7 +3208,7 @@ enqueueMemImageCommandHelper(pi_command_type CommandType, pi_queue Queue, const ze_image_region_t ZeSrcRegion = getImageRegionHelper(SrcMem, SrcOrigin, Region); - // TODO: L0 does not support row_pitch/slice_pitch for images yet. + // TODO: Level Zero does not support row_pitch/slice_pitch for images yet. // Check that SYCL RT did not want pitch larger than default. #ifndef NDEBUG assert(SrcMem->isImage()); @@ -3229,7 +3233,7 @@ enqueueMemImageCommandHelper(pi_command_type CommandType, pi_queue Queue, const ze_image_region_t ZeDstRegion = getImageRegionHelper(DstMem, DstOrigin, Region); - // TODO: L0 does not support row_pitch/slice_pitch for images yet. + // TODO: Level Zero does not support row_pitch/slice_pitch for images yet. // Check that SYCL RT did not want pitch larger than default. #ifndef NDEBUG assert(DstMem->isImage()); @@ -3360,7 +3364,7 @@ pi_result piMemBufferPartition(pi_mem Buffer, pi_mem_flags Flags, *RetMem = new _pi_buffer(Buffer->Platform, pi_cast(Buffer->getZeHandle()) + - Region->origin /* L0 memory handle */, + Region->origin /* Level Zero memory handle */, nullptr /* Host pointer */, Buffer /* Parent buffer */, Region->origin /* Sub-buffer origin */, Region->size /*Sub-buffer size*/); @@ -3406,7 +3410,7 @@ pi_result piextUSMHostAlloc(void **ResultPtr, pi_context Context, ze_host_mem_alloc_desc_t ZeDesc = {}; ZeDesc.flags = ZE_HOST_MEM_ALLOC_FLAG_DEFAULT; - // TODO: translate PI properties to L0 flags + // TODO: translate PI properties to Level Zero flags ZE_CALL(zeDriverAllocHostMem(Context->Device->Platform->ZeDriver, &ZeDesc, Size, Alignment, ResultPtr)); @@ -3423,7 +3427,7 @@ pi_result piextUSMDeviceAlloc(void **ResultPtr, pi_context Context, // Check that incorrect bits are not set in the properties. assert(!Properties || (Properties && !(*Properties & ~PI_MEM_ALLOC_FLAGS))); - // TODO: translate PI properties to L0 flags + // TODO: translate PI properties to Level Zero flags ze_device_mem_alloc_desc_t ZeDesc = {}; ZeDesc.flags = ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT; ZeDesc.ordinal = 0; @@ -3443,7 +3447,7 @@ pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context, // Check that incorrect bits are not set in the properties. assert(!Properties || (Properties && !(*Properties & ~PI_MEM_ALLOC_FLAGS))); - // TODO: translate PI properties to L0 flags + // TODO: translate PI properties to Level Zero flags ze_host_mem_alloc_desc_t ZeHostDesc = {}; ZeHostDesc.flags = ZE_HOST_MEM_ALLOC_FLAG_DEFAULT; ze_device_mem_alloc_desc_t ZeDevDesc = {}; @@ -3555,7 +3559,7 @@ pi_result piextUSMEnqueuePrefetch(pi_queue Queue, const void *Ptr, size_t Size, // TODO: figure out how to translate "flags" ZE_CALL(zeCommandListAppendMemoryPrefetch(ZeCommandList, Ptr, Size)); - // TODO: L0 does not have a completion "event" with the prefetch API, + // TODO: Level Zero does not have a completion "event" with the prefetch API, // so manually add command to signal our event. ZE_CALL(zeCommandListAppendSignalEvent(ZeCommandList, ZeEvent)); @@ -3638,7 +3642,7 @@ pi_result piextUSMEnqueueMemAdvise(pi_queue Queue, const void *Ptr, ZE_CALL(zeCommandListAppendMemAdvise( ZeCommandList, Queue->Context->Device->ZeDevice, Ptr, Length, ZeAdvice)); - // TODO: L0 does not have a completion "event" with the advise API, + // TODO: Level Zero does not have a completion "event" with the advise API, // so manually add command to signal our event. ZE_CALL(zeCommandListAppendSignalEvent(ZeCommandList, ZeEvent)); @@ -3699,7 +3703,7 @@ pi_result piextUSMGetMemAllocInfo(pi_context Context, const void *Ptr, } case PI_MEM_ALLOC_DEVICE: { // TODO: this wants pi_device, but we didn't remember it, and cannot - // deduct from the L0 device. + // deduct from the Level Zero device. die("piextUSMGetMemAllocInfo: PI_MEM_ALLOC_DEVICE not implemented"); break; } @@ -3760,7 +3764,8 @@ pi_result piextProgramSetSpecializationConstant(pi_program Prog, // Pass SpecValue pointer. Spec constant value is retrieved // by Level-Zero when creating the modul // - // NOTE: SpecSize is unused in L0, the size is known from SPIR-V by SpecID. + // NOTE: SpecSize is unused in Level Zero, the size is known from SPIR-V by + // SpecID. Prog->ZeSpecConstants[SpecID] = reinterpret_cast(SpecValue); return PI_SUCCESS; diff --git a/sycl/plugins/level_zero/pi_level0.hpp b/sycl/plugins/level_zero/pi_level_zero.hpp old mode 100755 new mode 100644 similarity index 86% rename from sycl/plugins/level_zero/pi_level0.hpp rename to sycl/plugins/level_zero/pi_level_zero.hpp index faf39d759c385..a3db143a55a48 --- a/sycl/plugins/level_zero/pi_level0.hpp +++ b/sycl/plugins/level_zero/pi_level_zero.hpp @@ -1,22 +1,22 @@ -//===---------- pi_level0.hpp - Level Zero Plugin -------------------------===// +//===------- pi_level_zero.hpp - Level Zero Plugin -------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -//===----------------------------------------------------------------------===// +//===-----------------------------------------------------------------===// -/// \defgroup sycl_pi_level0 Level Zero Plugin +/// \defgroup sycl_pi_level_zero Level Zero Plugin /// \ingroup sycl_pi -/// \file pi_level0.hpp +/// \file pi_level_zero.hpp /// Declarations for Level Zero Plugin. It is the interface between the /// device-agnostic SYCL runtime layer and underlying Level Zero runtime. /// -/// \ingroup sycl_pi_level0 +/// \ingroup sycl_pi_level_zero -#ifndef PI_LEVEL0_HPP -#define PI_LEVEL0_HPP +#ifndef PI_LEVEL_ZERO_HPP +#define PI_LEVEL_ZERO_HPP #include #include @@ -51,18 +51,19 @@ template <> uint32_t pi_cast(uint64_t Value) { struct _pi_object { _pi_object() : RefCount{1} {} - // L0 doesn't do the reference counting, so we have to do. + // Level Zero doesn't do the reference counting, so we have to do. // Must be atomic to prevent data race when incrementing/decrementing. std::atomic RefCount; }; -// Define the types that are opaque in pi.h in a manner suitabale for L0 plugin +// Define the types that are opaque in pi.h in a manner suitabale for Level Zero +// plugin struct _pi_platform { _pi_platform(ze_driver_handle_t Driver) : ZeDriver{Driver} {} - // L0 lacks the notion of a platform, but there is a driver, which is a - // pretty good fit to keep here. + // Level Zero lacks the notion of a platform, but there is a driver, which is + // a pretty good fit to keep here. ze_driver_handle_t ZeDriver; // Cache versions info from zeDriverGetProperties. @@ -83,14 +84,14 @@ struct _pi_device : _pi_object { // Initialize the entire PI device. pi_result initialize(); - // L0 device handle. + // Level Zero device handle. ze_device_handle_t ZeDevice; // PI platform to which this device belongs. pi_platform Platform; - // Immediate L0 command list for this device, to be used for initializations. - // To be created as: + // Immediate Level Zero command list for this device, to be used for + // initializations. To be created as: // - Immediate command list: So any command appended to it is immediately // offloaded to the device. // - Synchronous: So implicit synchronization is made inside the level-zero @@ -117,7 +118,7 @@ struct _pi_context : _pi_object { : Device{Device}, ZeEventPool{nullptr}, NumEventsAvailableInEventPool{}, NumEventsLiveInEventPool{} {} - // L0 does not have notion of contexts. + // Level Zero does not have notion of contexts. // Keep the device here (must be exactly one) to return it when PI context // is queried for devices. pi_device Device; @@ -164,7 +165,7 @@ struct _pi_queue : _pi_object { _pi_queue(ze_command_queue_handle_t Queue, pi_context Context) : ZeCommandQueue{Queue}, Context{Context} {} - // L0 command queue handle. + // Level Zero command queue handle. ze_command_queue_handle_t ZeCommandQueue; // Keeps the PI context to which this queue belongs. @@ -197,10 +198,10 @@ struct _pi_mem : _pi_object { // Interface of the _pi_mem object - // Get the L0 handle of the current memory object + // Get the Level Zero handle of the current memory object virtual void *getZeHandle() = 0; - // Get a pointer to the L0 handle of the current memory object + // Get a pointer to the Level Zero handle of the current memory object virtual void *getZeHandlePtr() = 0; // Method to get type of the derived object (image or buffer) @@ -241,7 +242,7 @@ struct _pi_buffer final : _pi_mem { bool isSubBuffer() const { return SubBuffer.Parent != nullptr; } - // L0 memory handle is really just a naked pointer. + // Level Zero memory handle is really just a naked pointer. // It is just convenient to have it char * to simplify offset arithmetics. char *ZeMem; @@ -268,7 +269,7 @@ struct _pi_image final : _pi_mem { ze_image_desc_t ZeImageDesc; #endif // !NDEBUG - // L0 image handle. + // Level Zero image handle. ze_image_handle_t ZeImage; }; @@ -278,14 +279,14 @@ struct _pi_event : _pi_object { : ZeEvent{ZeEvent}, ZeEventPool{ZeEventPool}, ZeCommandList{nullptr}, CommandType{CommandType}, Context{Context}, CommandData{nullptr} {} - // L0 event handle. + // Level Zero event handle. ze_event_handle_t ZeEvent; - // L0 event pool handle. + // Level Zero event pool handle. ze_event_pool_handle_t ZeEventPool; - // L0 command list where the command signaling this event was appended to. - // This is currently used to remember/destroy the command list after - // all commands in it are completed, i.e. this event signaled. + // Level Zero command list where the command signaling this event was appended + // to. This is currently used to remember/destroy the command list after all + // commands in it are completed, i.e. this event signaled. ze_command_list_handle_t ZeCommandList; // Keeps the command-queue and command associated with the event. @@ -300,7 +301,7 @@ struct _pi_event : _pi_object { // Opaque data to hold any data needed for CommandType. void *CommandData; - // Methods for translating PI events list into L0 events list + // Methods for translating PI events list into Level Zero events list static ze_event_handle_t *createZeEventList(pi_uint32, const pi_event *); static void deleteZeEventList(ze_event_handle_t *); }; @@ -311,16 +312,16 @@ struct _pi_program : _pi_object { : ZeModuleDesc(ModuleDesc), ZeModule{Module}, ZeBuildLog{nullptr}, Context{Context} {} - // L0 module descriptor. + // Level Zero module descriptor. ze_module_desc_t ZeModuleDesc; - // L0 module handle. + // Level Zero module handle. ze_module_handle_t ZeModule; - // L0 module specialization constants + // Level Zero module specialization constants std::mutex ZeSpecConstantsMutex; std::unordered_map ZeSpecConstants; - // L0 build log. + // Level Zero build log. ze_module_build_log_handle_t ZeBuildLog; // Keep the context of the program. @@ -332,21 +333,21 @@ struct _pi_kernel : _pi_object { const char *KernelName) : ZeKernel{Kernel}, Program{Program}, KernelName(KernelName) {} - // L0 function handle. + // Level Zero function handle. ze_kernel_handle_t ZeKernel; // Keep the program of the kernel. pi_program Program; - // TODO: remove when bug in the L0 runtime will be fixed. + // TODO: remove when bug in the Level Zero runtime will be fixed. std::string KernelName; }; struct _pi_sampler : _pi_object { _pi_sampler(ze_sampler_handle_t Sampler) : ZeSampler{Sampler} {} - // L0 sampler handle. + // Level Zero sampler handle. ze_sampler_handle_t ZeSampler; }; -#endif // PI_LEVEL0_HPP +#endif // PI_LEVEL_ZERO_HPP diff --git a/sycl/source/backend/level_zero.cpp b/sycl/source/backend/level_zero.cpp index 2e62223c0301e..6d7c7a347e89d 100644 --- a/sycl/source/backend/level_zero.cpp +++ b/sycl/source/backend/level_zero.cpp @@ -14,13 +14,13 @@ __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { -namespace level0 { +namespace level_zero { using namespace detail; //---------------------------------------------------------------------------- -// Implementation of level0::make +// Implementation of level_zero::make __SYCL_EXPORT platform make_platform(pi_native_handle NativeHandle) { - const auto &Plugin = pi::getPlugin(); + const auto &Plugin = pi::getPlugin(); // Create PI platform first. pi::PiPlatform PiPlatform; Plugin.call(NativeHandle, @@ -32,10 +32,10 @@ __SYCL_EXPORT platform make_platform(pi_native_handle NativeHandle) { } //---------------------------------------------------------------------------- -// Implementation of level0::make +// Implementation of level_zero::make __SYCL_EXPORT device make_device(const platform &Platform, pi_native_handle NativeHandle) { - const auto &Plugin = pi::getPlugin(); + const auto &Plugin = pi::getPlugin(); const auto &PlatformImpl = getSyclObjImpl(Platform); // Create PI device first. pi::PiDevice PiDevice; @@ -47,7 +47,7 @@ __SYCL_EXPORT device make_device(const platform &Platform, } //---------------------------------------------------------------------------- -// Implementation of level0::make +// Implementation of level_zero::make __SYCL_EXPORT program make_program(const context &Context, pi_native_handle NativeHandle) { // Construct the SYCL program from native program. @@ -58,10 +58,10 @@ __SYCL_EXPORT program make_program(const context &Context, } //---------------------------------------------------------------------------- -// Implementation of level0::make +// Implementation of level_zero::make __SYCL_EXPORT queue make_queue(const context &Context, pi_native_handle NativeHandle) { - const auto &Plugin = pi::getPlugin(); + const auto &Plugin = pi::getPlugin(); const auto &ContextImpl = getSyclObjImpl(Context); // Create PI queue first. pi::PiQueue PiQueue; @@ -72,6 +72,6 @@ __SYCL_EXPORT queue make_queue(const context &Context, PiQueue, ContextImpl, ContextImpl->get_async_handler())); } -} // namespace level0 +} // namespace level_zero } // namespace sycl } // __SYCL_INLINE_NAMESPACE(cl) diff --git a/sycl/source/detail/config.hpp b/sycl/source/detail/config.hpp index 1559f40e5ad86..ac6fe8fbcbd2b 100644 --- a/sycl/source/detail/config.hpp +++ b/sycl/source/detail/config.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include __SYCL_INLINE_NAMESPACE(cl) { @@ -118,9 +119,10 @@ template <> class SYCLConfig { return BackendPtr; const char *ValStr = BaseT::getRawValue(); - const std::array, 3> SyclBeMap = { + const std::array, 4> SyclBeMap = { {{"PI_OPENCL", backend::opencl}, - {"PI_LEVEL0", backend::level0}, + {"PI_LEVEL_ZERO", backend::level_zero}, + {"PI_LEVEL0", backend::level_zero}, // for backward compatibility {"PI_CUDA", backend::cuda}}}; if (ValStr) { auto It = std::find_if( @@ -130,7 +132,7 @@ template <> class SYCLConfig { }); if (It == SyclBeMap.end()) pi::die("Invalid backend. " - "Valid values are PI_OPENCL/PI_LEVEL0/PI_CUDA"); + "Valid values are PI_OPENCL/PI_LEVEL_ZERO/PI_CUDA"); static backend Backend = It->second; BackendPtr = &Backend; } @@ -161,6 +163,6 @@ template <> class SYCLConfig { } }; -} // __SYCL_INLINE_NAMESPACE(cl) -} // namespace sycl } // namespace detail +} // namespace sycl +} // __SYCL_INLINE_NAMESPACE(cl) diff --git a/sycl/source/detail/pi.cpp b/sycl/source/detail/pi.cpp index 58df2a3f7ed9f..68b9f3cf59a27 100644 --- a/sycl/source/detail/pi.cpp +++ b/sycl/source/detail/pi.cpp @@ -215,7 +215,7 @@ bool findPlugins(vector_class> &PluginNames) { // env only. // PluginNames.emplace_back(OPENCL_PLUGIN_NAME, backend::opencl); - PluginNames.emplace_back(LEVEL0_PLUGIN_NAME, backend::level0); + PluginNames.emplace_back(LEVEL_ZERO_PLUGIN_NAME, backend::level_zero); PluginNames.emplace_back(CUDA_PLUGIN_NAME, backend::cuda); return true; } @@ -319,11 +319,11 @@ static void initializePlugins(vector_class *Plugins) { PluginNames[I].first.find("cuda") != std::string::npos) { // Use the CUDA plugin as the GlobalPlugin GlobalPlugin = std::make_shared(PluginInformation, backend::cuda); - } else if (InteropBE == backend::level0 && - PluginNames[I].first.find("level0") != std::string::npos) { - // Use the LEVEL0 plugin as the GlobalPlugin + } else if (InteropBE == backend::level_zero && + PluginNames[I].first.find("level_zero") != std::string::npos) { + // Use the LEVEL_ZERO plugin as the GlobalPlugin GlobalPlugin = - std::make_shared(PluginInformation, backend::level0); + std::make_shared(PluginInformation, backend::level_zero); } Plugins->emplace_back(plugin(PluginInformation, PluginNames[I].second)); if (trace(TraceLevel::PI_TRACE_BASIC)) @@ -395,7 +395,7 @@ template const plugin &getPlugin() { } template const plugin &getPlugin(); -template const plugin &getPlugin(); +template const plugin &getPlugin(); // Report error and no return (keeps compiler from printing warnings). // TODO: Probably change that to throw a catchable exception, diff --git a/sycl/source/detail/program_manager/program_manager.cpp b/sycl/source/detail/program_manager/program_manager.cpp index 57a25c6c93aec..a4d7f162c1ab6 100644 --- a/sycl/source/detail/program_manager/program_manager.cpp +++ b/sycl/source/detail/program_manager/program_manager.cpp @@ -788,11 +788,11 @@ ProgramManager::build(ProgramPtr Program, const ContextImplPtr Context, LinkOpts = LinkOptions.c_str(); } - // L0 plugin doesn't support piProgramCompile/piProgramLink commands, program - // is built during piProgramCreate. + // Level-Zero plugin doesn't support piProgramCompile/piProgramLink commands, + // program is built during piProgramCreate. // TODO: remove this check as soon as piProgramCompile/piProgramLink will be - // implemented in L0 plugin. - if (Context->getPlugin().getBackend() == backend::level0) { + // implemented in Level-Zero plugin. + if (Context->getPlugin().getBackend() == backend::level_zero) { LinkDeviceLibs = false; } diff --git a/sycl/source/device_selector.cpp b/sycl/source/device_selector.cpp index 22b3a613467ec..831ae5f124bfa 100644 --- a/sycl/source/device_selector.cpp +++ b/sycl/source/device_selector.cpp @@ -19,13 +19,13 @@ __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { // Utility function to check if device is of the preferred backend. -// Currently preference is given to the level0 backend. +// Currently preference is given to the level_zero backend. static bool isDeviceOfPreferredSyclBe(const device &Device) { if (Device.is_host()) return false; return detail::getSyclObjImpl(Device)->getPlugin().getBackend() == - backend::level0; + backend::level_zero; } device device_selector::select_device() const { diff --git a/sycl/test/CMakeLists.txt b/sycl/test/CMakeLists.txt index 4010c13d3b219..882de8263cb36 100644 --- a/sycl/test/CMakeLists.txt +++ b/sycl/test/CMakeLists.txt @@ -81,17 +81,17 @@ add_lit_testsuite(check-sycl-opencl "Running the SYCL regression tests for OpenC ) set_target_properties(check-sycl-opencl PROPERTIES FOLDER "SYCL tests") -add_lit_testsuite(check-sycl-level0 "Running the SYCL regression tests for Level Zero" +add_lit_testsuite(check-sycl-level-zero "Running the SYCL regression tests for Level Zero" ${CMAKE_CURRENT_BINARY_DIR} ARGS ${RT_TEST_ARGS} - PARAMS "SYCL_BE=PI_LEVEL0" + PARAMS "SYCL_BE=PI_LEVEL_ZERO" DEPENDS ${SYCL_TEST_DEPS} EXCLUDE_FROM_CHECK_ALL ) -set_target_properties(check-sycl-level0 PROPERTIES FOLDER "SYCL tests") +set_target_properties(check-sycl-level-zero PROPERTIES FOLDER "SYCL tests") add_custom_target(check-sycl) -add_dependencies(check-sycl check-sycl-opencl check-sycl-level0) +add_dependencies(check-sycl check-sycl-opencl check-sycl-level-zero) set_target_properties(check-sycl PROPERTIES FOLDER "SYCL tests") if(SYCL_BUILD_PI_CUDA) diff --git a/sycl/test/abi/pi_level0_symbol_check.dump b/sycl/test/abi/pi_level_zero_symbol_check.dump similarity index 98% rename from sycl/test/abi/pi_level0_symbol_check.dump rename to sycl/test/abi/pi_level_zero_symbol_check.dump index f6bb19aa16a5b..7c8c74b8cc77d 100644 --- a/sycl/test/abi/pi_level0_symbol_check.dump +++ b/sycl/test/abi/pi_level_zero_symbol_check.dump @@ -3,7 +3,7 @@ # DO NOT EDIT IT MANUALLY. Refer to sycl/docs/ABIPolicyGuide.md for more info. ################################################################################ -# RUN: env LLVM_BIN_PATH=%llvm_build_bin_dir python %sycl_tools_src_dir/abi_check.py --mode check_symbols --reference %s %sycl_libs_dir/libpi_level0.so +# RUN: env LLVM_BIN_PATH=%llvm_build_bin_dir python %sycl_tools_src_dir/abi_check.py --mode check_symbols --reference %s %sycl_libs_dir/libpi_level_zero.so # REQUIRES: linux piContextCreate diff --git a/sycl/test/abi/sycl_symbols_linux.dump b/sycl/test/abi/sycl_symbols_linux.dump index 9ff2e1195cac9..0b336464462d3 100644 --- a/sycl/test/abi/sycl_symbols_linux.dump +++ b/sycl/test/abi/sycl_symbols_linux.dump @@ -3589,6 +3589,10 @@ _ZN2cl10__host_std9u_sub_satEhh _ZN2cl10__host_std9u_sub_satEjj _ZN2cl10__host_std9u_sub_satEmm _ZN2cl10__host_std9u_sub_satEtt +_ZN2cl4sycl10level_zero10make_queueERKNS0_7contextEm +_ZN2cl4sycl10level_zero11make_deviceERKNS0_8platformEm +_ZN2cl4sycl10level_zero12make_programERKNS0_7contextEm +_ZN2cl4sycl10level_zero13make_platformEm _ZN2cl4sycl11malloc_hostEmRKNS0_5queueE _ZN2cl4sycl11malloc_hostEmRKNS0_7contextE _ZN2cl4sycl13aligned_allocEmmRKNS0_5queueENS0_3usm5allocE @@ -3621,8 +3625,8 @@ _ZN2cl4sycl5eventC1Ev _ZN2cl4sycl5eventC2EP9_cl_eventRKNS0_7contextE _ZN2cl4sycl5eventC2ESt10shared_ptrINS0_6detail10event_implEE _ZN2cl4sycl5eventC2Ev -_ZN2cl4sycl5intel6detail17reduComputeWGSizeEmmRm _ZN2cl4sycl5intel6detail16reduGetMaxWGSizeESt10shared_ptrINS0_6detail10queue_implEEm +_ZN2cl4sycl5intel6detail17reduComputeWGSizeEmmRm _ZN2cl4sycl5queue10mem_adviseEPKvm14_pi_mem_advice _ZN2cl4sycl5queue10wait_proxyERKNS0_6detail13code_locationE _ZN2cl4sycl5queue11submit_implESt8functionIFvRNS0_7handlerEEERKNS0_6detail13code_locationE @@ -3728,15 +3732,15 @@ _ZN2cl4sycl6detail12sampler_implD2Ev _ZN2cl4sycl6detail12split_stringERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc _ZN2cl4sycl6detail13MemoryManager12prefetch_usmEPvSt10shared_ptrINS1_10queue_implEEmSt6vectorIP9_pi_eventSaIS9_EERS9_ _ZN2cl4sycl6detail13MemoryManager13releaseMemObjESt10shared_ptrINS1_12context_implEEPNS1_11SYCLMemObjIEPvS8_ -_ZN2cl4sycl6detail13MemoryManager19allocateImageObjectESt10shared_ptrINS1_12context_implEEPvbRK14_pi_image_descRK16_pi_image_formatRKNS0_13property_listE _ZN2cl4sycl6detail13MemoryManager16allocateMemImageESt10shared_ptrINS1_12context_implEEPNS1_11SYCLMemObjIEPvbmRK14_pi_image_descRK16_pi_image_formatRKS3_INS1_10event_implEERKS5_RKNS0_13property_listERP9_pi_event -_ZN2cl4sycl6detail13MemoryManager24allocateInteropMemObjectESt10shared_ptrINS1_12context_implEEPvRKS3_INS1_10event_implEERKS5_RKNS0_13property_listERP9_pi_event -_ZN2cl4sycl6detail13MemoryManager20allocateBufferObjectESt10shared_ptrINS1_12context_implEEPvbmRKNS0_13property_listE +_ZN2cl4sycl6detail13MemoryManager17allocateMemBufferESt10shared_ptrINS1_12context_implEEPNS1_11SYCLMemObjIEPvbmRKS3_INS1_10event_implEERKS5_RKNS0_13property_listERP9_pi_event _ZN2cl4sycl6detail13MemoryManager18allocateHostMemoryEPNS1_11SYCLMemObjIEPvbmRKNS0_13property_listE -_ZN2cl4sycl6detail13MemoryManager19wrapIntoImageBufferESt10shared_ptrINS1_12context_implEEPvPNS1_11SYCLMemObjIE _ZN2cl4sycl6detail13MemoryManager18releaseImageBufferESt10shared_ptrINS1_12context_implEEPv -_ZN2cl4sycl6detail13MemoryManager17allocateMemBufferESt10shared_ptrINS1_12context_implEEPNS1_11SYCLMemObjIEPvbmRKS3_INS1_10event_implEERKS5_RKNS0_13property_listERP9_pi_event +_ZN2cl4sycl6detail13MemoryManager19allocateImageObjectESt10shared_ptrINS1_12context_implEEPvbRK14_pi_image_descRK16_pi_image_formatRKNS0_13property_listE +_ZN2cl4sycl6detail13MemoryManager19wrapIntoImageBufferESt10shared_ptrINS1_12context_implEEPvPNS1_11SYCLMemObjIE +_ZN2cl4sycl6detail13MemoryManager20allocateBufferObjectESt10shared_ptrINS1_12context_implEEPvbmRKNS0_13property_listE _ZN2cl4sycl6detail13MemoryManager20allocateMemSubBufferESt10shared_ptrINS1_12context_implEEPvmmNS0_5rangeILi3EEESt6vectorIS3_INS1_10event_implEESaISB_EERP9_pi_event +_ZN2cl4sycl6detail13MemoryManager24allocateInteropMemObjectESt10shared_ptrINS1_12context_implEEPvRKS3_INS1_10event_implEERKS5_RKNS0_13property_listERP9_pi_event _ZN2cl4sycl6detail13MemoryManager3mapEPNS1_11SYCLMemObjIEPvSt10shared_ptrINS1_10queue_implEENS0_6access4modeEjNS0_5rangeILi3EEESC_NS0_2idILi3EEEjSt6vectorIP9_pi_eventSaISH_EERSH_ _ZN2cl4sycl6detail13MemoryManager4copyEPNS1_11SYCLMemObjIEPvSt10shared_ptrINS1_10queue_implEEjNS0_5rangeILi3EEESA_NS0_2idILi3EEEjS5_S8_jSA_SA_SC_jSt6vectorIP9_pi_eventSaISF_EERSF_ _ZN2cl4sycl6detail13MemoryManager4fillEPNS1_11SYCLMemObjIEPvSt10shared_ptrINS1_10queue_implEEmPKcjNS0_5rangeILi3EEESC_NS0_2idILi3EEEjSt6vectorIP9_pi_eventSaISH_EERSH_ @@ -3791,10 +3795,6 @@ _ZN2cl4sycl6kernelC1EP10_cl_kernelRKNS0_7contextE _ZN2cl4sycl6kernelC1ESt10shared_ptrINS0_6detail11kernel_implEE _ZN2cl4sycl6kernelC2EP10_cl_kernelRKNS0_7contextE _ZN2cl4sycl6kernelC2ESt10shared_ptrINS0_6detail11kernel_implEE -_ZN2cl4sycl6level010make_queueERKNS0_7contextEm -_ZN2cl4sycl6level011make_deviceERKNS0_8platformEm -_ZN2cl4sycl6level012make_programERKNS0_7contextEm -_ZN2cl4sycl6level013make_platformEm _ZN2cl4sycl6mallocEmRKNS0_5queueENS0_3usm5allocE _ZN2cl4sycl6mallocEmRKNS0_6deviceERKNS0_7contextENS0_3usm5allocE _ZN2cl4sycl6opencl10make_queueERKNS0_7contextEm diff --git a/sycl/test/basic_tests/buffer/buffer_full_copy.cpp b/sycl/test/basic_tests/buffer/buffer_full_copy.cpp index 79e69067682d5..2743557f6f971 100644 --- a/sycl/test/basic_tests/buffer/buffer_full_copy.cpp +++ b/sycl/test/basic_tests/buffer/buffer_full_copy.cpp @@ -6,7 +6,7 @@ // RUN: %GPU_RUN_PLACEHOLDER %t2.out // RUN: %ACC_RUN_PLACEHOLDER %t2.out -// XFAIL: level0 +// XFAIL: level_zero //==------------- buffer_full_copy.cpp - SYCL buffer basic test ------------==// // diff --git a/sycl/test/basic_tests/buffer/reinterpret.cpp b/sycl/test/basic_tests/buffer/reinterpret.cpp index 7fd000f165131..7288d9bfb2c97 100644 --- a/sycl/test/basic_tests/buffer/reinterpret.cpp +++ b/sycl/test/basic_tests/buffer/reinterpret.cpp @@ -3,7 +3,7 @@ // RUN: %GPU_RUN_PLACEHOLDER %t.out // RUN: %ACC_RUN_PLACEHOLDER %t.out // -// XFAIL: level0 +// XFAIL: level_zero //==---------- reinterpret.cpp --- SYCL buffer reinterpret basic test ------==// // diff --git a/sycl/test/basic_tests/get_backend.cpp b/sycl/test/basic_tests/get_backend.cpp index de0738dd88341..a312304e0741b 100644 --- a/sycl/test/basic_tests/get_backend.cpp +++ b/sycl/test/basic_tests/get_backend.cpp @@ -3,7 +3,6 @@ // //==----------------- get_backend.cpp ------------------------==// // This is a test of get_backend(). -// Also prints handy info about the system. // Do not set SYCL_BE. We do not want the preferred backend. //==----------------------------------------------------------==// @@ -16,7 +15,7 @@ using namespace cl::sycl; bool check(backend be) { switch (be) { case backend::opencl: - case backend::level0: + case backend::level_zero: case backend::cuda: case backend::host: return true; diff --git a/sycl/test/basic_tests/image_accessor_readwrite.cpp b/sycl/test/basic_tests/image_accessor_readwrite.cpp index 13c0b175bd1fc..0451ced85dc55 100644 --- a/sycl/test/basic_tests/image_accessor_readwrite.cpp +++ b/sycl/test/basic_tests/image_accessor_readwrite.cpp @@ -6,7 +6,7 @@ // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out // -// XFAIL: windows && level0 +// XFAIL: windows && level_zero //==--------------------image_accessor_readwrite.cpp ----------------------==// //==----------image_accessor read without sampler & write API test---------==// diff --git a/sycl/test/basic_tests/image_accessor_readwrite_half.cpp b/sycl/test/basic_tests/image_accessor_readwrite_half.cpp index 6d5c1960655e5..931780c6c36a6 100644 --- a/sycl/test/basic_tests/image_accessor_readwrite_half.cpp +++ b/sycl/test/basic_tests/image_accessor_readwrite_half.cpp @@ -6,7 +6,7 @@ // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out // -// XFAIL: windows && level0 +// XFAIL: windows && level_zero //==--------------------image_accessor_readwrite_half.cpp -------------------==// //==-image_accessor read (without sampler)& write API test for half datatype-==// diff --git a/sycl/test/basic_tests/kernel_info.cpp b/sycl/test/basic_tests/kernel_info.cpp index 193d89a4c4bd8..68a642b476e27 100644 --- a/sycl/test/basic_tests/kernel_info.cpp +++ b/sycl/test/basic_tests/kernel_info.cpp @@ -3,8 +3,8 @@ // RUN: %GPU_RUN_PLACEHOLDER %t.out // RUN: %ACC_RUN_PLACEHOLDER %t.out // -// Fail is flaky for level0, enable when fixed. -// UNSUPPORTED: level0 +// Fail is flaky for level_zero, enable when fixed. +// UNSUPPORTED: level_zero //==--- kernel_info.cpp - SYCL kernel info test ----------------------------==// // diff --git a/sycl/test/basic_tests/parallel_for_indexers.cpp b/sycl/test/basic_tests/parallel_for_indexers.cpp index 3d20ec3d66903..a4ec46b42bc9a 100644 --- a/sycl/test/basic_tests/parallel_for_indexers.cpp +++ b/sycl/test/basic_tests/parallel_for_indexers.cpp @@ -8,7 +8,7 @@ // TODO: Unexpected result // TODO: _indexers.cpp:37: int main(): Assertion `id == -1' failed. -// XFAIL: level0 +// XFAIL: level_zero #include diff --git a/sycl/test/basic_tests/parallel_for_range.cpp b/sycl/test/basic_tests/parallel_for_range.cpp index 3031d3d30f388..4ec9b23158239 100644 --- a/sycl/test/basic_tests/parallel_for_range.cpp +++ b/sycl/test/basic_tests/parallel_for_range.cpp @@ -1,4 +1,4 @@ -// XFAIL: cuda || level0 +// XFAIL: cuda || level_zero // CUDA exposes broken hierarchical parallelism. // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out diff --git a/sycl/test/host-interop-task/host-task-dependency.cpp b/sycl/test/host-interop-task/host-task-dependency.cpp index 60a1e60883d71..2bbc059a43e44 100644 --- a/sycl/test/host-interop-task/host-task-dependency.cpp +++ b/sycl/test/host-interop-task/host-task-dependency.cpp @@ -4,7 +4,7 @@ // RUN: %ACC_RUN_PLACEHOLDER SYCL_PI_TRACE=-1 %t.out 2>&1 %ACC_CHECK_PLACEHOLDER // // TODO: Behaviour is unstable for level zero on Windows. Enable when fixed. -// UNSUPPORTED: windows && level0 +// UNSUPPORTED: windows && level_zero #include #include diff --git a/sycl/test/host-interop-task/host-task-two-queues.cpp b/sycl/test/host-interop-task/host-task-two-queues.cpp index 5157b83b60092..7644d6bcfcd53 100644 --- a/sycl/test/host-interop-task/host-task-two-queues.cpp +++ b/sycl/test/host-interop-task/host-task-two-queues.cpp @@ -4,7 +4,7 @@ // RUN: %ACC_RUN_PLACEHOLDER %t.out // // TODO: Flaky fail on Level Zero that is why mark as unsupported temporarily. -// UNSUPPORTED: level0 +// UNSUPPORTED: level_zero #include #include diff --git a/sycl/test/host-interop-task/interop-task.cpp b/sycl/test/host-interop-task/interop-task.cpp index bcd784038228a..ea4f08eee4a83 100644 --- a/sycl/test/host-interop-task/interop-task.cpp +++ b/sycl/test/host-interop-task/interop-task.cpp @@ -2,7 +2,7 @@ // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out // RUN: %ACC_RUN_PLACEHOLDER %t.out -// UNSUPPORTED: level0, cuda +// UNSUPPORTED: level_zero, cuda // REQUIRES: opencl // REQUIRES: TEMPORARY_DISABLED diff --git a/sycl/test/lit.cfg.py b/sycl/test/lit.cfg.py index 545ebb995f60d..f2a58749a2a93 100644 --- a/sycl/test/lit.cfg.py +++ b/sycl/test/lit.cfg.py @@ -81,7 +81,7 @@ def getDeviceCount(device_type): is_cuda = False; - is_level0 = False; + is_level_zero = False; process = subprocess.Popen([get_device_count_by_type_path, device_type, backend], stdout=subprocess.PIPE) (output, err) = process.communicate() @@ -106,12 +106,12 @@ def getDeviceCount(device_type): if re.match(r".*cuda", result[1]): is_cuda = True; if re.match(r".*level zero", result[1]): - is_level0 = True; + is_level_zero = True; if err: lit_config.warning("getDeviceCount {TYPE} {BACKEND} stderr:{ERR}".format( TYPE=device_type, BACKEND=backend, ERR=err)) - return [value,is_cuda,is_level0] + return [value,is_cuda,is_level_zero] # Every SYCL implementation provides a host implementation. config.available_features.add('host') @@ -149,8 +149,8 @@ def getDeviceCount(device_type): gpu_check_on_linux_substitute = "" cuda = False -level0 = False -[gpu_count, cuda, level0] = getDeviceCount("gpu") +level_zero = False +[gpu_count, cuda, level_zero] = getDeviceCount("gpu") if gpu_count > 0: found_at_least_one_device = True @@ -160,8 +160,8 @@ def getDeviceCount(device_type): config.available_features.add('gpu') if cuda: config.available_features.add('cuda') - elif level0: - config.available_features.add('level0') + elif level_zero: + config.available_features.add('level_zero') if platform.system() == "Linux": gpu_run_on_linux_substitute = "env SYCL_DEVICE_TYPE=GPU SYCL_BE={SYCL_BE} ".format(SYCL_BE=backend) @@ -188,7 +188,7 @@ def getDeviceCount(device_type): config.substitutions.append( ('%ACC_CHECK_PLACEHOLDER', acc_check_substitute) ) # LIT testing either supports OpenCL or CUDA or Level Zero. -if not cuda and not level0 and found_at_least_one_device: +if not cuda and not level_zero and found_at_least_one_device: config.available_features.add('opencl') if cuda: diff --git a/sycl/test/plugins/sycl-ls-gpu-default.cpp b/sycl/test/plugins/sycl-ls-gpu-default.cpp index a07933f2ccff8..a57fc2a39a027 100755 --- a/sycl/test/plugins/sycl-ls-gpu-default.cpp +++ b/sycl/test/plugins/sycl-ls-gpu-default.cpp @@ -1,4 +1,4 @@ -// REQUIRES: gpu, level0 +// REQUIRES: gpu, level_zero // RUN: sycl-ls --verbose >%t.default.out // RUN: FileCheck %s --check-prefixes=CHECK-GPU-BUILTIN,CHECK-GPU-CUSTOM --input-file %t.default.out diff --git a/sycl/test/regression/fsycl-save-temps.cpp b/sycl/test/regression/fsycl-save-temps.cpp index ce9e653af2608..7f89fa54feeca 100644 --- a/sycl/test/regression/fsycl-save-temps.cpp +++ b/sycl/test/regression/fsycl-save-temps.cpp @@ -22,6 +22,6 @@ int main() { } // TODO: Address a Windows-specific issue with integration header filenames -// XFAIL: system-windows && !level0 +// XFAIL: system-windows && !level_zero // TODO: fail is flaky on Windows for Level Zero. Enable when fixed. -// UNSUPPORTED: system-windows && level0 +// UNSUPPORTED: system-windows && level_zero diff --git a/sycl/test/regression/image_access.cpp b/sycl/test/regression/image_access.cpp index f32d0a33f6b91..e779fb5b4111b 100644 --- a/sycl/test/regression/image_access.cpp +++ b/sycl/test/regression/image_access.cpp @@ -5,9 +5,9 @@ // TODO: For now PI checks are skipped for ACC device. To decide if it's good. // RUN: env %ACC_RUN_PLACEHOLDER %t.out // -// UNSUPPORTED: cuda || windows && level0 +// UNSUPPORTED: cuda || windows && level_zero // CUDA cannot support OpenCL spec conform images. -// TODO: test hangs on level0, enable when fixed. +// TODO: test hangs on level_zero, enable when fixed. //==-------------- image_access.cpp - SYCL image accessors test -----------==// // diff --git a/sycl/test/regression/static-buffer-dtor.cpp b/sycl/test/regression/static-buffer-dtor.cpp index 5899420c20454..c541c180e7d73 100644 --- a/sycl/test/regression/static-buffer-dtor.cpp +++ b/sycl/test/regression/static-buffer-dtor.cpp @@ -14,7 +14,7 @@ // RUN: %GPU_RUN_PLACEHOLDER %t.out // RUN: %ACC_RUN_PLACEHOLDER %t.out // -// XFAIL: linux && level0 +// XFAIL: linux && level_zero #include diff --git a/sycl/test/spec_const/spec_const_hw.cpp b/sycl/test/spec_const/spec_const_hw.cpp index c50550c0827ad..442121353bb73 100644 --- a/sycl/test/spec_const/spec_const_hw.cpp +++ b/sycl/test/spec_const/spec_const_hw.cpp @@ -1,4 +1,4 @@ -// UNSUPPORTED: cuda || level0 +// UNSUPPORTED: cuda || level_zero // // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: env SYCL_DEVICE_TYPE=HOST %t.out diff --git a/sycl/test/spec_const/spec_const_hw_accelerator.cpp b/sycl/test/spec_const/spec_const_hw_accelerator.cpp index d4eb754065c18..bd7df40ed378a 100644 --- a/sycl/test/spec_const/spec_const_hw_accelerator.cpp +++ b/sycl/test/spec_const/spec_const_hw_accelerator.cpp @@ -12,6 +12,6 @@ // TODO: re-enable after CI drivers are updated to newer which support spec // constants: // XFAIL: linux && opencl && accelerator -// UNSUPPORTED: cuda || level0 +// UNSUPPORTED: cuda || level_zero #include "spec_const_hw.cpp" // RUN: %ACC_RUN_PLACEHOLDER %t.out diff --git a/sycl/test/spec_const/spec_const_neg.cpp b/sycl/test/spec_const/spec_const_neg.cpp index 18fb8ed5d9d0c..7312e29ab40e1 100644 --- a/sycl/test/spec_const/spec_const_neg.cpp +++ b/sycl/test/spec_const/spec_const_neg.cpp @@ -3,7 +3,7 @@ // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out // Specialization constants are not supported on FPGA h/w and emulator. -// UNSUPPORTED: cuda || level0 +// UNSUPPORTED: cuda || level_zero // //==----------- spec_const_hw.cpp ------------------------------------------==// // diff --git a/sycl/test/spec_const/spec_const_redefine.cpp b/sycl/test/spec_const/spec_const_redefine.cpp index 36a82f9c9825e..6883ce5c9d7d6 100644 --- a/sycl/test/spec_const/spec_const_redefine.cpp +++ b/sycl/test/spec_const/spec_const_redefine.cpp @@ -1,4 +1,4 @@ -// UNSUPPORTED: cuda || level0 +// UNSUPPORTED: cuda || level_zero // // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: env SYCL_DEVICE_TYPE=HOST %t.out diff --git a/sycl/test/spec_const/spec_const_redefine_accelerator.cpp b/sycl/test/spec_const/spec_const_redefine_accelerator.cpp index 00ef10f63fdfa..52293f7a953e7 100644 --- a/sycl/test/spec_const/spec_const_redefine_accelerator.cpp +++ b/sycl/test/spec_const/spec_const_redefine_accelerator.cpp @@ -14,6 +14,6 @@ // TODO: re-enable after CI drivers are updated to newer which support spec // constants: // XFAIL: linux && opencl && accelerator -// UNSUPPORTED: cuda || level0 +// UNSUPPORTED: cuda || level_zero #include "spec_const_redefine_accelerator.cpp" // RUN: env SYCL_PI_TRACE=2 %ACC_RUN_PLACEHOLDER %t.out 2>&1 %ACC_CHECK_PLACEHOLDER diff --git a/sycl/tools/CMakeLists.txt b/sycl/tools/CMakeLists.txt index 1e2843e0b9385..67b0c7329a10b 100644 --- a/sycl/tools/CMakeLists.txt +++ b/sycl/tools/CMakeLists.txt @@ -6,22 +6,22 @@ add_subdirectory(sycl-ls) # TODO: move each tool in its own sub-directory add_executable(get_device_count_by_type get_device_count_by_type.cpp) -add_dependencies(get_device_count_by_type ocl-headers ocl-icd l0-loader) +add_dependencies(get_device_count_by_type ocl-headers ocl-icd level-zero-loader) if(MSVC) - set(L0_LIBRARY + set(LEVEL_ZERO_LIBRARY "${LLVM_LIBRARY_OUTPUT_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ze_loader${CMAKE_STATIC_LIBRARY_SUFFIX}") else() - set(L0_LIBRARY + set(LEVEL_ZERO_LIBRARY "${LLVM_LIBRARY_OUTPUT_INTDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}ze_loader${CMAKE_SHARED_LIBRARY_SUFFIX}") endif() target_link_libraries(get_device_count_by_type PRIVATE OpenCL::Headers - L0Loader::Headers + LevelZeroLoader::Headers ${OpenCL_LIBRARIES} - ${L0_LIBRARY} + ${LEVEL_ZERO_LIBRARY} $<$:cudadrv> ) target_compile_definitions(get_device_count_by_type diff --git a/sycl/tools/get_device_count_by_type.cpp b/sycl/tools/get_device_count_by_type.cpp index 26a9a0a4ed6ad..abf70ce98c357 100644 --- a/sycl/tools/get_device_count_by_type.cpp +++ b/sycl/tools/get_device_count_by_type.cpp @@ -32,7 +32,7 @@ static const std::string help = " Help\n" " Example: ./get_device_count_by_type cpu opencl\n" " Supported device types: cpu/gpu/accelerator/default/all\n" - " Supported backends: PI_CUDA/PI_OPENCL/PI_LEVEL0 \n" + " Supported backends: PI_CUDA/PI_OPENCL/PI_LEVEL_ZERO \n" " Output format: :"; // Return the string with all characters translated to lower case. @@ -259,7 +259,7 @@ int main(int argc, char *argv[]) { if (backend == "opencl" || backend == "pi_opencl") { querySuccess = queryOpenCL(deviceType, deviceCount, msg); - } else if (backend == "level0" || backend == "pi_level0") { + } else if (backend == "level_zero" || backend == "pi_level_zero") { querySuccess = queryLevelZero(deviceType, deviceCount, msg); } else if (backend == "cuda" || backend == "pi_cuda") { querySuccess = queryCUDA(deviceType, deviceCount, msg); diff --git a/sycl/unittests/pi/BackendString.hpp b/sycl/unittests/pi/BackendString.hpp index cea0eee8b8338..7f051f5ab6790 100644 --- a/sycl/unittests/pi/BackendString.hpp +++ b/sycl/unittests/pi/BackendString.hpp @@ -15,7 +15,7 @@ inline const char *GetBackendString(cl::sycl::backend backend) { PI_BACKEND_STR(cuda); PI_BACKEND_STR(host); PI_BACKEND_STR(opencl); - PI_BACKEND_STR(level0); + PI_BACKEND_STR(level_zero); #undef PI_BACKEND_STR default: return "Unknown Plugin";