From a0663dee26bf4d2a65941e73273dbca7aff2b584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=BDu=C5=BEek?= Date: Wed, 5 May 2021 19:22:00 +0100 Subject: [PATCH] [SYCL][PI] Move files to libpi folder The PI plugins could be made into an independent library, allowing code outside the `sycl` project to use it. The first step towards getting that is to group all PI related files into its own directory structure. This patch moves all the PI files into the folder `libpi`. Includes setting up includes as `pi/piXXX`. On the SYCL runtime side the files have been moved from `pi.hpp` to `pi_sycl.hpp` etc. Apart from the folder change and adjusting CMake, there should be no change in functionality. Tests had to be updated to set up include folders. --- sycl/CMakeLists.txt | 15 ++++++++++-- sycl/cmake/modules/AddSYCLUnitTest.cmake | 5 +++- sycl/doc/PluginInterface.md | 6 ++--- sycl/include/CL/sycl/backend.hpp | 4 ++-- sycl/include/CL/sycl/backend/cuda.hpp | 3 ++- sycl/include/CL/sycl/detail/array.hpp | 2 ++ .../CL/sycl/detail/device_binary_image.hpp | 2 +- sycl/include/CL/sycl/detail/helpers.hpp | 2 +- sycl/include/CL/sycl/detail/pi_sycl.hpp | 12 ++++++++++ .../CL/sycl/detail/property_list_base.hpp | 1 + .../include/CL/sycl/detail/sycl_mem_obj_i.hpp | 2 +- sycl/include/CL/sycl/exception.hpp | 2 +- sycl/include/CL/sycl/info/info_desc.hpp | 2 +- sycl/include/CL/sycl/interop_handle.hpp | 2 +- sycl/include/CL/sycl/kernel.hpp | 2 +- sycl/include/CL/sycl/kernel_bundle.hpp | 4 ++-- sycl/libpi.cmake | 1 + .../sycl/detail => libpi/include/pi}/pi.def | 0 .../CL/sycl/detail => libpi/include/pi}/pi.h | 2 +- .../sycl/detail => libpi/include/pi}/pi.hpp | 6 ++--- .../include/pi/pi_cuda.h} | 2 +- .../detail => libpi/include/pi}/plugin.hpp | 2 +- sycl/{ => libpi}/plugins/CMakeLists.txt | 0 sycl/{ => libpi}/plugins/cuda/CMakeLists.txt | 5 ++-- sycl/{ => libpi}/plugins/cuda/pi_cuda.cpp | 4 ++-- sycl/{ => libpi}/plugins/cuda/pi_cuda.hpp | 24 +++++++++---------- .../{ => libpi}/plugins/ld-version-script.txt | 0 .../plugins/level_zero/CMakeLists.txt | 3 ++- .../plugins/level_zero/pi_level_zero.cpp | 2 +- .../plugins/level_zero/pi_level_zero.hpp | 3 ++- .../plugins/level_zero/usm_allocator.cpp | 0 .../plugins/level_zero/usm_allocator.hpp | 0 .../{ => libpi}/plugins/opencl/CMakeLists.txt | 4 ++-- sycl/{ => libpi}/plugins/opencl/pi_opencl.cpp | 2 +- sycl/{source/detail => libpi/src}/pi.cpp | 6 ++--- .../{source/detail => libpi/src}/posix_pi.cpp | 0 .../detail => libpi/src}/windows_pi.cpp | 0 sycl/source/CMakeLists.txt | 7 +++--- sycl/source/backend.cpp | 6 ++--- sycl/source/backend/level_zero.cpp | 2 +- sycl/source/backend/opencl.cpp | 2 +- sycl/source/context.cpp | 1 + sycl/source/detail/config.hpp | 2 +- sycl/source/detail/context_impl.cpp | 5 ++-- sycl/source/detail/context_impl.hpp | 2 +- sycl/source/detail/device_binary_image.cpp | 2 +- sycl/source/detail/device_image_impl.hpp | 6 ++--- sycl/source/detail/device_impl.hpp | 2 +- sycl/source/detail/device_info.hpp | 4 ++-- .../detail/error_handling/enqueue_kernel.cpp | 4 ++-- .../detail/error_handling/error_handling.hpp | 2 +- sycl/source/detail/event_impl.cpp | 2 +- sycl/source/detail/event_impl.hpp | 4 ++-- sycl/source/detail/event_info.hpp | 2 +- sycl/source/detail/global_handler.cpp | 4 ++-- sycl/source/detail/kernel_bundle_impl.hpp | 2 +- sycl/source/detail/kernel_impl.hpp | 4 ++-- sycl/source/detail/kernel_info.hpp | 2 +- sycl/source/detail/kernel_program_cache.cpp | 2 +- sycl/source/detail/kernel_program_cache.hpp | 2 +- .../online_compiler/online_compiler.cpp | 2 +- .../detail/persistent_device_code_cache.cpp | 2 +- .../detail/persistent_device_code_cache.hpp | 2 +- sycl/source/detail/platform_impl.cpp | 1 + sycl/source/detail/platform_impl.hpp | 4 ++-- sycl/source/detail/platform_info.hpp | 4 ++-- sycl/source/detail/platform_util.cpp | 5 ++-- sycl/source/detail/plugin_printers.hpp | 2 +- sycl/source/detail/plugin_sycl.hpp | 14 +++++++++++ sycl/source/detail/program_impl.cpp | 2 +- .../program_manager/program_manager.hpp | 2 +- sycl/source/detail/queue_impl.cpp | 2 +- sycl/source/detail/queue_impl.hpp | 2 +- sycl/source/detail/scheduler/commands.cpp | 21 ++++++++-------- sycl/source/detail/spec_constant_impl.cpp | 2 +- sycl/source/detail/sycl_mem_obj_t.cpp | 2 +- sycl/source/detail/usm/usm_impl.cpp | 4 ++-- sycl/source/device.cpp | 1 + sycl/source/event.cpp | 2 +- sycl/source/interop_handler.cpp | 2 +- sycl/source/kernel.cpp | 2 +- sycl/source/platform.cpp | 1 + .../test/basic_tests/image_accessor_types.cpp | 2 +- sycl/test/basic_tests/vectors/ctad_fail.cpp | 2 +- sycl/test/gdb/accessors.cpp | 2 +- sycl/test/gdb/printers.cpp | 2 +- sycl/test/separate-compile/test.cpp | 4 ++-- sycl/tools/sycl-ls/CMakeLists.txt | 2 +- sycl/unittests/helpers/PiMock.hpp | 4 ++-- sycl/unittests/kernel-and-program/Cache.cpp | 2 +- sycl/unittests/pi/BackendString.hpp | 2 +- sycl/unittests/pi/CMakeLists.txt | 2 +- sycl/unittests/pi/EnqueueMemTest.cpp | 4 ++-- sycl/unittests/pi/PlatformTest.cpp | 4 ++-- sycl/unittests/pi/TestGetPlugin.hpp | 2 +- sycl/unittests/pi/cuda/CMakeLists.txt | 1 + sycl/unittests/pi/cuda/test_base_objects.cpp | 7 +++--- sycl/unittests/pi/cuda/test_commands.cpp | 4 ++-- sycl/unittests/pi/cuda/test_device.cpp | 4 ++-- .../pi/cuda/test_interop_get_native.cpp | 1 + sycl/unittests/pi/cuda/test_kernels.cpp | 4 ++-- sycl/unittests/pi/cuda/test_mem_obj.cpp | 6 ++--- sycl/unittests/pi/cuda/test_queue.cpp | 7 +++--- .../pi/cuda/test_sampler_properties.cpp | 5 ++-- 104 files changed, 208 insertions(+), 149 deletions(-) create mode 100644 sycl/include/CL/sycl/detail/pi_sycl.hpp create mode 100644 sycl/libpi.cmake rename sycl/{include/CL/sycl/detail => libpi/include/pi}/pi.def (100%) rename sycl/{include/CL/sycl/detail => libpi/include/pi}/pi.h (99%) rename sycl/{include/CL/sycl/detail => libpi/include/pi}/pi.hpp (99%) rename sycl/{include/CL/sycl/detail/cuda_definitions.hpp => libpi/include/pi/pi_cuda.h} (92%) rename sycl/{source/detail => libpi/include/pi}/plugin.hpp (99%) rename sycl/{ => libpi}/plugins/CMakeLists.txt (100%) rename sycl/{ => libpi}/plugins/cuda/CMakeLists.txt (93%) rename sycl/{ => libpi}/plugins/cuda/pi_cuda.cpp (99%) rename sycl/{ => libpi}/plugins/cuda/pi_cuda.hpp (98%) rename sycl/{ => libpi}/plugins/ld-version-script.txt (100%) rename sycl/{ => libpi}/plugins/level_zero/CMakeLists.txt (98%) rename sycl/{ => libpi}/plugins/level_zero/pi_level_zero.cpp (99%) rename sycl/{ => libpi}/plugins/level_zero/pi_level_zero.hpp (99%) rename sycl/{ => libpi}/plugins/level_zero/usm_allocator.cpp (100%) rename sycl/{ => libpi}/plugins/level_zero/usm_allocator.hpp (100%) rename sycl/{ => libpi}/plugins/opencl/CMakeLists.txt (94%) rename sycl/{ => libpi}/plugins/opencl/pi_opencl.cpp (99%) rename sycl/{source/detail => libpi/src}/pi.cpp (99%) rename sycl/{source/detail => libpi/src}/posix_pi.cpp (100%) rename sycl/{source/detail => libpi/src}/windows_pi.cpp (100%) create mode 100644 sycl/source/detail/plugin_sycl.hpp diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txt index 020783570c887..665565f90a3a6 100644 --- a/sycl/CMakeLists.txt +++ b/sycl/CMakeLists.txt @@ -94,20 +94,31 @@ option(SYCL_BUILD_PI_CUDA # Configure SYCL version macro set(sycl_inc_dir ${CMAKE_CURRENT_SOURCE_DIR}/include) set(sycl_src_dir ${CMAKE_CURRENT_SOURCE_DIR}/source) -set(sycl_plugin_dir ${CMAKE_CURRENT_SOURCE_DIR}/plugins) +set(sycl_plugin_dir ${CMAKE_CURRENT_SOURCE_DIR}/libpi/plugins) string(TIMESTAMP __SYCL_COMPILER_VERSION "%Y%m%d") set(version_header "${sycl_inc_dir}/CL/sycl/version.hpp") configure_file("${version_header}.in" "${version_header}") +# Location of PI files +set(pi_include_dir ${CMAKE_CURRENT_SOURCE_DIR}/libpi/include) +set(pi_source_dir ${CMAKE_CURRENT_SOURCE_DIR}/libpi/src) + +# Copy SYCL headers from sources to build directory +add_custom_target(pi-headers ALL + COMMAND ${CMAKE_COMMAND} -E copy_directory ${pi_include_dir} ${SYCL_INCLUDE_BUILD_DIR} + COMMENT "Copying PI headers ...") + # Copy SYCL headers from sources to build directory add_custom_target(sycl-headers ALL COMMAND ${CMAKE_COMMAND} -E copy_directory ${sycl_inc_dir}/sycl ${SYCL_INCLUDE_BUILD_DIR}/sycl COMMAND ${CMAKE_COMMAND} -E copy_directory ${sycl_inc_dir}/CL ${SYCL_INCLUDE_BUILD_DIR}/sycl/CL COMMENT "Copying SYCL headers ...") +add_dependencies(sycl-headers pi-headers) # Copy SYCL headers from sources to install directory install(DIRECTORY "${sycl_inc_dir}/sycl" DESTINATION ${SYCL_INCLUDE_DEPLOY_DIR} COMPONENT sycl-headers) install(DIRECTORY "${sycl_inc_dir}/CL" DESTINATION ${SYCL_INCLUDE_DEPLOY_DIR}/sycl COMPONENT sycl-headers) +install(DIRECTORY "${pi_include_dir}/." DESTINATION ${SYCL_INCLUDE_DEPLOY_DIR} COMPONENT sycl-headers) set(SYCL_RT_LIBS sycl) if (MSVC) @@ -213,7 +224,7 @@ option(SYCL_INCLUDE_TESTS ${LLVM_INCLUDE_TESTS}) # Plugin Library -add_subdirectory( plugins ) +include(libpi.cmake) add_subdirectory(tools) diff --git a/sycl/cmake/modules/AddSYCLUnitTest.cmake b/sycl/cmake/modules/AddSYCLUnitTest.cmake index 2d50567d2ee0b..a97460539bdb8 100644 --- a/sycl/cmake/modules/AddSYCLUnitTest.cmake +++ b/sycl/cmake/modules/AddSYCLUnitTest.cmake @@ -34,6 +34,7 @@ macro(add_sycl_unittest test_dirname link_variant) target_include_directories(${test_dirname} PRIVATE SYSTEM ${sycl_inc_dir} + ${pi_include_dir} ${SYCL_SOURCE_DIR}/source/ ${SYCL_SOURCE_DIR}/unittests/ ) @@ -92,8 +93,10 @@ macro(add_sycl_unittest_with_device test_dirname link_variant) endif() if ("${link_variant}" MATCHES "OBJECT") + # TODO PI integration should be fixed + # once add_sycl_executable supports target_link_libraries add_sycl_executable(${test_dirname} - OPTIONS -nolibsycl ${COMMON_OPTS} ${LLVM_PTHREAD_LIB} ${TERMINFO_LIB} + OPTIONS -nolibsycl ${COMMON_OPTS} ${LLVM_PTHREAD_LIB} ${TERMINFO_LIB} -I "${pi_include_dir}" SOURCES ${ARGN} $ LIBRARIES gtest_main gtest LLVMSupport LLVMTestingSupport OpenCL ${EXTRA_LIBS} DEPENDANTS SYCLUnitTests) diff --git a/sycl/doc/PluginInterface.md b/sycl/doc/PluginInterface.md index e1781081e0159..01e2080e384e5 100644 --- a/sycl/doc/PluginInterface.md +++ b/sycl/doc/PluginInterface.md @@ -72,8 +72,8 @@ SYCL_PI_TRACE=-1 lists all PI Traces above and more debug messages. #### Plugin binary interface Plugins should implement all the Interface APIs required for the PI Version -it supports. There is [pi.def](../include/CL/sycl/detail/pi.def)/ -[pi.h](../include/CL/sycl/detail/pi.h) file listing all PI API names that can be +it supports. There is [pi.def](../libpi/include/pi/pi.def)/ +[pi.h](../libpi/include/pi/pi.h) file listing all PI API names that can be called by the specific version of Plugin Interface. It exports a function - "piPluginInit" that returns the plugin details and function pointer table containing the list of pointers to implemented Interface @@ -149,7 +149,7 @@ into - **Interoperability API** which allows interoperability with underlying runtimes such as OpenCL. -See [pi.h](../include/CL/sycl/detail/pi.h) header for the full list and +See [pi.h](../include/pi/pi.h) header for the full list and descriptions of PI APIs. ### The Core OpenCL-based PI APIs diff --git a/sycl/include/CL/sycl/backend.hpp b/sycl/include/CL/sycl/backend.hpp index 69ff9e0b87268..8c4b623a56e13 100644 --- a/sycl/include/CL/sycl/backend.hpp +++ b/sycl/include/CL/sycl/backend.hpp @@ -15,8 +15,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/sycl/include/CL/sycl/backend/cuda.hpp b/sycl/include/CL/sycl/backend/cuda.hpp index 0bc3fa6f4b0aa..3e1557697f0bb 100644 --- a/sycl/include/CL/sycl/backend/cuda.hpp +++ b/sycl/include/CL/sycl/backend/cuda.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -58,4 +59,4 @@ struct interop #include +#include + #include #include diff --git a/sycl/include/CL/sycl/detail/device_binary_image.hpp b/sycl/include/CL/sycl/detail/device_binary_image.hpp index a74523801175d..6e458fa5547de 100644 --- a/sycl/include/CL/sycl/detail/device_binary_image.hpp +++ b/sycl/include/CL/sycl/detail/device_binary_image.hpp @@ -8,7 +8,7 @@ #pragma once #include -#include +#include #include diff --git a/sycl/include/CL/sycl/detail/helpers.hpp b/sycl/include/CL/sycl/detail/helpers.hpp index 118271a35bab5..4454601f52a51 100644 --- a/sycl/include/CL/sycl/detail/helpers.hpp +++ b/sycl/include/CL/sycl/detail/helpers.hpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/sycl/include/CL/sycl/detail/pi_sycl.hpp b/sycl/include/CL/sycl/detail/pi_sycl.hpp new file mode 100644 index 0000000000000..c6139af2a4888 --- /dev/null +++ b/sycl/include/CL/sycl/detail/pi_sycl.hpp @@ -0,0 +1,12 @@ +//==---------------- pi_sycl.hpp - SYCL wrapper for PI ---------*- C++ -*---==// +// +// 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 +// +// ===--------------------------------------------------------------------=== // + +#pragma once + +#include +#include diff --git a/sycl/include/CL/sycl/detail/property_list_base.hpp b/sycl/include/CL/sycl/detail/property_list_base.hpp index 0bdea3e85b7ae..ec1a313310d11 100644 --- a/sycl/include/CL/sycl/detail/property_list_base.hpp +++ b/sycl/include/CL/sycl/detail/property_list_base.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/sycl/include/CL/sycl/detail/sycl_mem_obj_i.hpp b/sycl/include/CL/sycl/detail/sycl_mem_obj_i.hpp index 6317e0663961b..7732c07835d85 100644 --- a/sycl/include/CL/sycl/detail/sycl_mem_obj_i.hpp +++ b/sycl/include/CL/sycl/detail/sycl_mem_obj_i.hpp @@ -8,7 +8,7 @@ #pragma once -#include +#include #include __SYCL_INLINE_NAMESPACE(cl) { diff --git a/sycl/include/CL/sycl/exception.hpp b/sycl/include/CL/sycl/exception.hpp index f2bf9951216c7..e1b5aa7a3e4b0 100644 --- a/sycl/include/CL/sycl/exception.hpp +++ b/sycl/include/CL/sycl/exception.hpp @@ -12,8 +12,8 @@ #include #include -#include #include +#include #include diff --git a/sycl/include/CL/sycl/info/info_desc.hpp b/sycl/include/CL/sycl/info/info_desc.hpp index f221638c9af99..be54bc441274b 100644 --- a/sycl/include/CL/sycl/info/info_desc.hpp +++ b/sycl/include/CL/sycl/info/info_desc.hpp @@ -9,7 +9,7 @@ #pragma once #include -#include +#include #include __SYCL_INLINE_NAMESPACE(cl) { diff --git a/sycl/include/CL/sycl/interop_handle.hpp b/sycl/include/CL/sycl/interop_handle.hpp index eb6e7fb81cc77..537d94f2302f6 100644 --- a/sycl/include/CL/sycl/interop_handle.hpp +++ b/sycl/include/CL/sycl/interop_handle.hpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include diff --git a/sycl/include/CL/sycl/kernel.hpp b/sycl/include/CL/sycl/kernel.hpp index eb7a1dbae10a3..35e316124cdc1 100644 --- a/sycl/include/CL/sycl/kernel.hpp +++ b/sycl/include/CL/sycl/kernel.hpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/include/CL/sycl/kernel_bundle.hpp b/sycl/include/CL/sycl/kernel_bundle.hpp index 9eb256b63d2ab..b3004a27ae784 100644 --- a/sycl/include/CL/sycl/kernel_bundle.hpp +++ b/sycl/include/CL/sycl/kernel_bundle.hpp @@ -11,8 +11,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/sycl/libpi.cmake b/sycl/libpi.cmake new file mode 100644 index 0000000000000..b3bfe1121d134 --- /dev/null +++ b/sycl/libpi.cmake @@ -0,0 +1 @@ +add_subdirectory(libpi/plugins) diff --git a/sycl/include/CL/sycl/detail/pi.def b/sycl/libpi/include/pi/pi.def similarity index 100% rename from sycl/include/CL/sycl/detail/pi.def rename to sycl/libpi/include/pi/pi.def diff --git a/sycl/include/CL/sycl/detail/pi.h b/sycl/libpi/include/pi/pi.h similarity index 99% rename from sycl/include/CL/sycl/detail/pi.h rename to sycl/libpi/include/pi/pi.h index a6cdadf664310..a9d3a8b5a0e10 100644 --- a/sycl/include/CL/sycl/detail/pi.h +++ b/sycl/libpi/include/pi/pi.h @@ -1649,7 +1649,7 @@ struct _pi_plugin { char *Targets; struct FunctionPointers { #define _PI_API(api) decltype(::api) *api; -#include +#include } PiFunctionTable; }; diff --git a/sycl/include/CL/sycl/detail/pi.hpp b/sycl/libpi/include/pi/pi.hpp similarity index 99% rename from sycl/include/CL/sycl/detail/pi.hpp rename to sycl/libpi/include/pi/pi.hpp index 03f3915b1dcb6..df935d181b73f 100644 --- a/sycl/include/CL/sycl/detail/pi.hpp +++ b/sycl/libpi/include/pi/pi.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include @@ -41,7 +41,7 @@ namespace detail { enum class PiApiKind { #define _PI_API(api) api, -#include +#include }; class plugin; namespace pi { @@ -162,7 +162,7 @@ template struct PiFuncInfo {}; return MPlugin.PiFunctionTable.api; \ } \ }; -#include +#include /// Emits an XPTI trace before a PI API call is made /// \param FName The name of the PI API call diff --git a/sycl/include/CL/sycl/detail/cuda_definitions.hpp b/sycl/libpi/include/pi/pi_cuda.h similarity index 92% rename from sycl/include/CL/sycl/detail/cuda_definitions.hpp rename to sycl/libpi/include/pi/pi_cuda.h index 9af7dbdab0152..701325e7b4717 100644 --- a/sycl/include/CL/sycl/detail/cuda_definitions.hpp +++ b/sycl/libpi/include/pi/pi_cuda.h @@ -1,4 +1,4 @@ -//==------------ cuda_definitions.hpp - SYCL CUDA backend ------------------==// +//==------------ pi_cuda.h - PI CUDA backend ------------------==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/sycl/source/detail/plugin.hpp b/sycl/libpi/include/pi/plugin.hpp similarity index 99% rename from sycl/source/detail/plugin.hpp rename to sycl/libpi/include/pi/plugin.hpp index 3480ac81f643e..f21473da5959f 100644 --- a/sycl/source/detail/plugin.hpp +++ b/sycl/libpi/include/pi/plugin.hpp @@ -9,9 +9,9 @@ #pragma once #include #include -#include #include #include +#include #include #include diff --git a/sycl/plugins/CMakeLists.txt b/sycl/libpi/plugins/CMakeLists.txt similarity index 100% rename from sycl/plugins/CMakeLists.txt rename to sycl/libpi/plugins/CMakeLists.txt diff --git a/sycl/plugins/cuda/CMakeLists.txt b/sycl/libpi/plugins/cuda/CMakeLists.txt similarity index 93% rename from sycl/plugins/cuda/CMakeLists.txt rename to sycl/libpi/plugins/cuda/CMakeLists.txt index 448ea7e77f419..6cc13241b8faf 100644 --- a/sycl/plugins/cuda/CMakeLists.txt +++ b/sycl/libpi/plugins/cuda/CMakeLists.txt @@ -16,8 +16,8 @@ set_target_properties( ) add_library(pi_cuda SHARED - "${sycl_inc_dir}/CL/sycl/detail/pi.h" - "${sycl_inc_dir}/CL/sycl/detail/pi.hpp" + "${pi_include_dir}/pi/pi.h" + "${pi_include_dir}/pi/pi.hpp" "pi_cuda.hpp" "pi_cuda.cpp" ) @@ -29,6 +29,7 @@ set_target_properties(pi_cuda PROPERTIES LINKER_LANGUAGE CXX) target_include_directories(pi_cuda PRIVATE ${sycl_inc_dir} + ${pi_include_dir} ) target_link_libraries(pi_cuda diff --git a/sycl/plugins/cuda/pi_cuda.cpp b/sycl/libpi/plugins/cuda/pi_cuda.cpp similarity index 99% rename from sycl/plugins/cuda/pi_cuda.cpp rename to sycl/libpi/plugins/cuda/pi_cuda.cpp index 3141d7b290514..912232e8cd65b 100644 --- a/sycl/plugins/cuda/pi_cuda.cpp +++ b/sycl/libpi/plugins/cuda/pi_cuda.cpp @@ -11,9 +11,9 @@ /// /// \ingroup sycl_pi_cuda -#include #include -#include +#include +#include #include #include diff --git a/sycl/plugins/cuda/pi_cuda.hpp b/sycl/libpi/plugins/cuda/pi_cuda.hpp similarity index 98% rename from sycl/plugins/cuda/pi_cuda.hpp rename to sycl/libpi/plugins/cuda/pi_cuda.hpp index 123a2aa6e721a..4f82e3dee1e84 100644 --- a/sycl/plugins/cuda/pi_cuda.hpp +++ b/sycl/libpi/plugins/cuda/pi_cuda.hpp @@ -18,29 +18,30 @@ #ifndef PI_CUDA_HPP #define PI_CUDA_HPP -#include "CL/sycl/detail/pi.h" +#include + #include #include #include #include #include +#include #include +#include #include #include #include #include -#include -#include extern "C" { /// \cond INGORE_BLOCK_IN_DOXYGEN -pi_result cuda_piContextRetain(pi_context ); -pi_result cuda_piContextRelease(pi_context ); -pi_result cuda_piDeviceRelease(pi_device ); -pi_result cuda_piDeviceRetain(pi_device ); -pi_result cuda_piProgramRetain(pi_program ); -pi_result cuda_piProgramRelease(pi_program ); +pi_result cuda_piContextRetain(pi_context); +pi_result cuda_piContextRelease(pi_context); +pi_result cuda_piDeviceRelease(pi_device); +pi_result cuda_piDeviceRetain(pi_device); +pi_result cuda_piProgramRetain(pi_program); +pi_result cuda_piProgramRelease(pi_program); pi_result cuda_piQueueRelease(pi_queue); pi_result cuda_piQueueRetain(pi_queue); pi_result cuda_piMemRetain(pi_mem); @@ -511,7 +512,7 @@ struct _pi_program { pi_result set_binary(const char *binary, size_t binarySizeInBytes); - pi_result build_program(const char* build_options); + pi_result build_program(const char *build_options); pi_context get_context() const { return context_; }; @@ -632,8 +633,7 @@ struct _pi_kernel { pi_context ctxt) : _pi_kernel{func, nullptr, name, program, ctxt} {} - ~_pi_kernel() - { + ~_pi_kernel() { cuda_piProgramRelease(program_); cuda_piContextRelease(context_); } diff --git a/sycl/plugins/ld-version-script.txt b/sycl/libpi/plugins/ld-version-script.txt similarity index 100% rename from sycl/plugins/ld-version-script.txt rename to sycl/libpi/plugins/ld-version-script.txt diff --git a/sycl/plugins/level_zero/CMakeLists.txt b/sycl/libpi/plugins/level_zero/CMakeLists.txt similarity index 98% rename from sycl/plugins/level_zero/CMakeLists.txt rename to sycl/libpi/plugins/level_zero/CMakeLists.txt index 3fd52ad68c96a..279860b9757f1 100755 --- a/sycl/plugins/level_zero/CMakeLists.txt +++ b/sycl/libpi/plugins/level_zero/CMakeLists.txt @@ -97,9 +97,10 @@ target_include_directories(LevelZeroLoader-Headers include_directories("${sycl_inc_dir}") +include_directories("${pi_include_dir}") add_library(pi_level_zero SHARED - "${sycl_inc_dir}/CL/sycl/detail/pi.h" + "${pi_include_dir}/pi/pi.h" "${CMAKE_CURRENT_SOURCE_DIR}/pi_level_zero.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/pi_level_zero.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/usm_allocator.cpp" diff --git a/sycl/plugins/level_zero/pi_level_zero.cpp b/sycl/libpi/plugins/level_zero/pi_level_zero.cpp similarity index 99% rename from sycl/plugins/level_zero/pi_level_zero.cpp rename to sycl/libpi/plugins/level_zero/pi_level_zero.cpp index aa74edcb8d7b3..be3ec454ece30 100644 --- a/sycl/plugins/level_zero/pi_level_zero.cpp +++ b/sycl/libpi/plugins/level_zero/pi_level_zero.cpp @@ -6051,7 +6051,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) { #define _PI_API(api) \ (PluginInit->PiFunctionTable).api = (decltype(&::api))(&api); -#include +#include return PI_SUCCESS; } diff --git a/sycl/plugins/level_zero/pi_level_zero.hpp b/sycl/libpi/plugins/level_zero/pi_level_zero.hpp similarity index 99% rename from sycl/plugins/level_zero/pi_level_zero.hpp rename to sycl/libpi/plugins/level_zero/pi_level_zero.hpp index b74cda0146146..b0a0a677795ab 100644 --- a/sycl/plugins/level_zero/pi_level_zero.hpp +++ b/sycl/libpi/plugins/level_zero/pi_level_zero.hpp @@ -18,7 +18,8 @@ #ifndef PI_LEVEL_ZERO_HPP #define PI_LEVEL_ZERO_HPP -#include +#include + #include #include #include diff --git a/sycl/plugins/level_zero/usm_allocator.cpp b/sycl/libpi/plugins/level_zero/usm_allocator.cpp similarity index 100% rename from sycl/plugins/level_zero/usm_allocator.cpp rename to sycl/libpi/plugins/level_zero/usm_allocator.cpp diff --git a/sycl/plugins/level_zero/usm_allocator.hpp b/sycl/libpi/plugins/level_zero/usm_allocator.hpp similarity index 100% rename from sycl/plugins/level_zero/usm_allocator.hpp rename to sycl/libpi/plugins/level_zero/usm_allocator.hpp diff --git a/sycl/plugins/opencl/CMakeLists.txt b/sycl/libpi/plugins/opencl/CMakeLists.txt similarity index 94% rename from sycl/plugins/opencl/CMakeLists.txt rename to sycl/libpi/plugins/opencl/CMakeLists.txt index bd7ac1e50fe28..d62d704e4c89f 100644 --- a/sycl/plugins/opencl/CMakeLists.txt +++ b/sycl/libpi/plugins/opencl/CMakeLists.txt @@ -11,7 +11,7 @@ #This can be changed by copying the pi.h file in the plugins project. add_library(pi_opencl SHARED - "${sycl_inc_dir}/CL/sycl/detail/pi.h" + "${pi_include_dir}/pi/pi.h" "pi_opencl.cpp" ) @@ -20,7 +20,7 @@ add_dependencies(sycl-toolchain pi_opencl) set_target_properties(pi_opencl PROPERTIES LINKER_LANGUAGE CXX) #preprocessor definitions for compiling a target's sources. We do not need it for pi_opencl -target_include_directories(pi_opencl PRIVATE "${sycl_inc_dir}") +target_include_directories(pi_opencl PRIVATE "${sycl_inc_dir}" "${pi_include_dir}") #link pi_opencl with OpenCL headers and ICD Loader. target_link_libraries(pi_opencl diff --git a/sycl/plugins/opencl/pi_opencl.cpp b/sycl/libpi/plugins/opencl/pi_opencl.cpp similarity index 99% rename from sycl/plugins/opencl/pi_opencl.cpp rename to sycl/libpi/plugins/opencl/pi_opencl.cpp index b5417609c4b6f..45741987f5a24 100644 --- a/sycl/plugins/opencl/pi_opencl.cpp +++ b/sycl/libpi/plugins/opencl/pi_opencl.cpp @@ -15,7 +15,7 @@ /// \ingroup sycl_pi_ocl #include -#include +#include #include #include diff --git a/sycl/source/detail/pi.cpp b/sycl/libpi/src/pi.cpp similarity index 99% rename from sycl/source/detail/pi.cpp rename to sycl/libpi/src/pi.cpp index f5a393d2c0d82..80ba4d34429b8 100644 --- a/sycl/source/detail/pi.cpp +++ b/sycl/libpi/src/pi.cpp @@ -11,15 +11,15 @@ /// /// \ingroup sycl_pi -#include "context_impl.hpp" #include #include #include -#include #include #include +#include #include -#include +#include +#include #include #include diff --git a/sycl/source/detail/posix_pi.cpp b/sycl/libpi/src/posix_pi.cpp similarity index 100% rename from sycl/source/detail/posix_pi.cpp rename to sycl/libpi/src/posix_pi.cpp diff --git a/sycl/source/detail/windows_pi.cpp b/sycl/libpi/src/windows_pi.cpp similarity index 100% rename from sycl/source/detail/windows_pi.cpp rename to sycl/libpi/src/windows_pi.cpp diff --git a/sycl/source/CMakeLists.txt b/sycl/source/CMakeLists.txt index 7da8d346e8d3b..4116d16d19e4b 100644 --- a/sycl/source/CMakeLists.txt +++ b/sycl/source/CMakeLists.txt @@ -65,6 +65,7 @@ function(add_sycl_rt_library LIB_NAME) PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} "${sycl_inc_dir}" + "${pi_include_dir}" ) #TODO: Remove dependency on icd loader and opencl headers. target_link_libraries(${LIB_OBJ_NAME} @@ -112,7 +113,7 @@ set(SYCL_SOURCES "detail/builtins_integer.cpp" "detail/builtins_math.cpp" "detail/builtins_relational.cpp" - "detail/pi.cpp" + "${pi_source_dir}/pi.cpp" "detail/common.cpp" "detail/config.cpp" "detail/context_impl.cpp" @@ -172,8 +173,8 @@ set(SYCL_SOURCES "sampler.cpp" "stream.cpp" "spirv_ops.cpp" - "$<$:detail/windows_pi.cpp>" - "$<$,$>:detail/posix_pi.cpp>" + "$<$:${pi_source_dir}/windows_pi.cpp>" + "$<$,$>:${pi_source_dir}/posix_pi.cpp>" ) if (MSVC) diff --git a/sycl/source/backend.cpp b/sycl/source/backend.cpp index 26cc412446b7e..d2bf4568cde97 100644 --- a/sycl/source/backend.cpp +++ b/sycl/source/backend.cpp @@ -11,13 +11,13 @@ #include "detail/kernel_bundle_impl.hpp" #include "detail/kernel_id_impl.hpp" #include "detail/platform_impl.hpp" -#include "detail/plugin.hpp" #include "detail/queue_impl.hpp" #include #include #include -#include -#include +#include +#include +#include #include #include #include diff --git a/sycl/source/backend/level_zero.cpp b/sycl/source/backend/level_zero.cpp index 3fcd9b7142f4d..40e2d21a659ad 100644 --- a/sycl/source/backend/level_zero.cpp +++ b/sycl/source/backend/level_zero.cpp @@ -9,9 +9,9 @@ #include #include #include -#include #include #include +#include __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { diff --git a/sycl/source/backend/opencl.cpp b/sycl/source/backend/opencl.cpp index 4ecb1e6a76e17..e1bd155bfec21 100644 --- a/sycl/source/backend/opencl.cpp +++ b/sycl/source/backend/opencl.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include diff --git a/sycl/source/context.cpp b/sycl/source/context.cpp index 607a4edc44288..d98e62ec78206 100644 --- a/sycl/source/context.cpp +++ b/sycl/source/context.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/sycl/source/detail/config.hpp b/sycl/source/detail/config.hpp index 8f54271e260f6..7246f80e2a0e2 100644 --- a/sycl/source/detail/config.hpp +++ b/sycl/source/detail/config.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include diff --git a/sycl/source/detail/context_impl.cpp b/sycl/source/detail/context_impl.cpp index 1ef5929adb766..620e9ee66da70 100644 --- a/sycl/source/detail/context_impl.cpp +++ b/sycl/source/detail/context_impl.cpp @@ -6,9 +6,9 @@ // // ===--------------------------------------------------------------------=== // +#include #include -#include -#include +#include #include #include #include @@ -20,6 +20,7 @@ #include #include #include +#include __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { diff --git a/sycl/source/detail/context_impl.hpp b/sycl/source/detail/context_impl.hpp index 967c4a6cffcbe..7fcebad5e855f 100644 --- a/sycl/source/detail/context_impl.hpp +++ b/sycl/source/detail/context_impl.hpp @@ -9,7 +9,7 @@ #pragma once #include #include -#include +#include #include #include #include diff --git a/sycl/source/detail/device_binary_image.cpp b/sycl/source/detail/device_binary_image.cpp index c1ea2a347c061..6244c74eae5fa 100644 --- a/sycl/source/detail/device_binary_image.cpp +++ b/sycl/source/detail/device_binary_image.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include +#include #include diff --git a/sycl/source/detail/device_image_impl.hpp b/sycl/source/detail/device_image_impl.hpp index 4be9ec4dfdd34..96bf6fadef443 100644 --- a/sycl/source/detail/device_image_impl.hpp +++ b/sycl/source/detail/device_image_impl.hpp @@ -10,14 +10,14 @@ #include #include -#include -#include +#include +#include #include #include #include #include #include -#include +#include #include #include diff --git a/sycl/source/detail/device_impl.hpp b/sycl/source/detail/device_impl.hpp index 0e1381f933964..979ce1510e771 100644 --- a/sycl/source/detail/device_impl.hpp +++ b/sycl/source/detail/device_impl.hpp @@ -9,7 +9,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/sycl/source/detail/device_info.hpp b/sycl/source/detail/device_info.hpp index bf3eb0561ef7a..7f6ae7049f5eb 100644 --- a/sycl/source/detail/device_info.hpp +++ b/sycl/source/detail/device_info.hpp @@ -10,14 +10,14 @@ #include #include #include -#include +#include #include #include #include #include #include #include -#include +#include #include #include diff --git a/sycl/source/detail/error_handling/enqueue_kernel.cpp b/sycl/source/detail/error_handling/enqueue_kernel.cpp index 9cb804b1c0930..217659800e433 100644 --- a/sycl/source/detail/error_handling/enqueue_kernel.cpp +++ b/sycl/source/detail/error_handling/enqueue_kernel.cpp @@ -13,8 +13,8 @@ #include "error_handling.hpp" #include -#include -#include +#include +#include __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { diff --git a/sycl/source/detail/error_handling/error_handling.hpp b/sycl/source/detail/error_handling/error_handling.hpp index 06bfe4cec173c..00bb3e132bc48 100644 --- a/sycl/source/detail/error_handling/error_handling.hpp +++ b/sycl/source/detail/error_handling/error_handling.hpp @@ -9,8 +9,8 @@ #pragma once #include -#include #include +#include __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { diff --git a/sycl/source/detail/event_impl.cpp b/sycl/source/detail/event_impl.cpp index f6d41c3878584..737cb65181593 100644 --- a/sycl/source/detail/event_impl.cpp +++ b/sycl/source/detail/event_impl.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include diff --git a/sycl/source/detail/event_impl.hpp b/sycl/source/detail/event_impl.hpp index 81e9e9b626356..75f5957f18cf7 100644 --- a/sycl/source/detail/event_impl.hpp +++ b/sycl/source/detail/event_impl.hpp @@ -10,10 +10,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include diff --git a/sycl/source/detail/event_info.hpp b/sycl/source/detail/event_info.hpp index 62d4ed01c2947..03cf4e3d71792 100644 --- a/sycl/source/detail/event_info.hpp +++ b/sycl/source/detail/event_info.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { diff --git a/sycl/source/detail/global_handler.cpp b/sycl/source/detail/global_handler.cpp index 06cf90b3e11f9..39a7e9a6e84e9 100644 --- a/sycl/source/detail/global_handler.cpp +++ b/sycl/source/detail/global_handler.cpp @@ -7,13 +7,13 @@ //===----------------------------------------------------------------------===// #include -#include +#include #include #include #include -#include #include #include +#include #ifdef _WIN32 #include diff --git a/sycl/source/detail/kernel_bundle_impl.hpp b/sycl/source/detail/kernel_bundle_impl.hpp index 6abc889b10b65..3cf4263b3cc8a 100644 --- a/sycl/source/detail/kernel_bundle_impl.hpp +++ b/sycl/source/detail/kernel_bundle_impl.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sycl/source/detail/kernel_impl.hpp b/sycl/source/detail/kernel_impl.hpp index a7c66e8f0e69b..8a18d7a7c930e 100644 --- a/sycl/source/detail/kernel_impl.hpp +++ b/sycl/source/detail/kernel_impl.hpp @@ -9,8 +9,8 @@ #pragma once #include -#include -#include +#include +#include #include #include #include diff --git a/sycl/source/detail/kernel_info.hpp b/sycl/source/detail/kernel_info.hpp index 811137650c712..6334610599691 100644 --- a/sycl/source/detail/kernel_info.hpp +++ b/sycl/source/detail/kernel_info.hpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff --git a/sycl/source/detail/kernel_program_cache.cpp b/sycl/source/detail/kernel_program_cache.cpp index 18b13f3fd589c..a6d80fe8a9e05 100644 --- a/sycl/source/detail/kernel_program_cache.cpp +++ b/sycl/source/detail/kernel_program_cache.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { diff --git a/sycl/source/detail/kernel_program_cache.hpp b/sycl/source/detail/kernel_program_cache.hpp index 73b7cd2f0ad4b..715465246e83e 100644 --- a/sycl/source/detail/kernel_program_cache.hpp +++ b/sycl/source/detail/kernel_program_cache.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include diff --git a/sycl/source/detail/online_compiler/online_compiler.cpp b/sycl/source/detail/online_compiler/online_compiler.cpp index ca352c387b8a9..e88f2d9d8b191 100644 --- a/sycl/source/detail/online_compiler/online_compiler.cpp +++ b/sycl/source/detail/online_compiler/online_compiler.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include diff --git a/sycl/source/detail/persistent_device_code_cache.cpp b/sycl/source/detail/persistent_device_code_cache.cpp index 2f954ae658e3c..ae07ce5e53007 100644 --- a/sycl/source/detail/persistent_device_code_cache.cpp +++ b/sycl/source/detail/persistent_device_code_cache.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #if defined(__SYCL_RT_OS_LINUX) #include diff --git a/sycl/source/detail/persistent_device_code_cache.hpp b/sycl/source/detail/persistent_device_code_cache.hpp index d02ca5f03915e..b0414634464a5 100644 --- a/sycl/source/detail/persistent_device_code_cache.hpp +++ b/sycl/source/detail/persistent_device_code_cache.hpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include diff --git a/sycl/source/detail/platform_impl.cpp b/sycl/source/detail/platform_impl.cpp index 1995990a06e89..bb37f5b90cd76 100644 --- a/sycl/source/detail/platform_impl.cpp +++ b/sycl/source/detail/platform_impl.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/sycl/source/detail/platform_impl.hpp b/sycl/source/detail/platform_impl.hpp index 8af8874413a94..fbc21b1a3b070 100644 --- a/sycl/source/detail/platform_impl.hpp +++ b/sycl/source/detail/platform_impl.hpp @@ -8,11 +8,11 @@ #pragma once #include -#include +#include #include #include #include -#include +#include __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { diff --git a/sycl/source/detail/platform_info.hpp b/sycl/source/detail/platform_info.hpp index 1ba1c970e8fe4..951d8ac8b95f8 100644 --- a/sycl/source/detail/platform_info.hpp +++ b/sycl/source/detail/platform_info.hpp @@ -9,9 +9,9 @@ #pragma once #include #include -#include +#include #include -#include +#include __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { diff --git a/sycl/source/detail/platform_util.cpp b/sycl/source/detail/platform_util.cpp index f558131d52a68..52c5c7bf5fc7c 100644 --- a/sycl/source/detail/platform_util.cpp +++ b/sycl/source/detail/platform_util.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #if defined(__SYCL_RT_OS_LINUX) #include @@ -167,8 +168,8 @@ void PlatformUtil::prefetch(const char *Ptr, size_t NumBytes) { const char *PtrEnd = Ptr + NumBytes; // Set the pointer to the beginning of the current cache line. - Ptr = reinterpret_cast( - reinterpret_cast(Ptr) & CacheLineMask); + Ptr = reinterpret_cast(reinterpret_cast(Ptr) & + CacheLineMask); for (; Ptr < PtrEnd; Ptr += CacheLineSize) { #if defined(__SYCL_RT_OS_LINUX) __builtin_prefetch(Ptr); diff --git a/sycl/source/detail/plugin_printers.hpp b/sycl/source/detail/plugin_printers.hpp index b28dc24dcc472..2db8af0ce0441 100644 --- a/sycl/source/detail/plugin_printers.hpp +++ b/sycl/source/detail/plugin_printers.hpp @@ -10,7 +10,7 @@ #pragma once -#include +#include #include diff --git a/sycl/source/detail/plugin_sycl.hpp b/sycl/source/detail/plugin_sycl.hpp new file mode 100644 index 0000000000000..52d5b09bd91c5 --- /dev/null +++ b/sycl/source/detail/plugin_sycl.hpp @@ -0,0 +1,14 @@ +//==---------- plugin_sycl.hpp - SYCL wrapper for PI plugin ----*- C++ -*---==// +// +// 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 +// +// ===--------------------------------------------------------------------=== // + +#pragma once + +#include +#include +#include + diff --git a/sycl/source/detail/program_impl.cpp b/sycl/source/detail/program_impl.cpp index ec2393b99c421..706ba2b79f81b 100644 --- a/sycl/source/detail/program_impl.cpp +++ b/sycl/source/detail/program_impl.cpp @@ -8,13 +8,13 @@ #include #include -#include #include #include #include #include #include #include +#include #include #include diff --git a/sycl/source/detail/program_manager/program_manager.hpp b/sycl/source/detail/program_manager/program_manager.hpp index 7a706700c9a2d..37ad35debecb7 100644 --- a/sycl/source/detail/program_manager/program_manager.hpp +++ b/sycl/source/detail/program_manager/program_manager.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sycl/source/detail/queue_impl.cpp b/sycl/source/detail/queue_impl.cpp index bcbe28720ac56..a0e315f7344c0 100644 --- a/sycl/source/detail/queue_impl.cpp +++ b/sycl/source/detail/queue_impl.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include diff --git a/sycl/source/detail/queue_impl.hpp b/sycl/source/detail/queue_impl.hpp index aea55006a6fba..fc3dba32b278a 100644 --- a/sycl/source/detail/queue_impl.hpp +++ b/sycl/source/detail/queue_impl.hpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include diff --git a/sycl/source/detail/scheduler/commands.cpp b/sycl/source/detail/scheduler/commands.cpp index 5535e397b2006..54608907e453a 100644 --- a/sycl/source/detail/scheduler/commands.cpp +++ b/sycl/source/detail/scheduler/commands.cpp @@ -782,7 +782,6 @@ void AllocaCommand::printDot(std::ostream &Stream) const { Stream << " Link : " << this->MLinkedAllocaCmd << "\\n"; Stream << "\"];" << std::endl; - for (const auto &Dep : MDeps) { if (Dep.MDepCommand == nullptr) continue; @@ -920,7 +919,6 @@ cl_int ReleaseCommand::enqueueImp() { // 3. Device alloca in the pair should be in active state in order to be // correctly released. - // There is no actual memory allocation if a host alloca command is created // being linked to a device allocation. SkipRelease |= CurAllocaIsHost && !MAllocaCmd->MIsLeaderAlloca; @@ -2044,15 +2042,16 @@ cl_int ExecCGCommand::enqueueImp() { Plugin.call(RawEvents.size(), &RawEvents[0]); } std::vector ReqMemObjs; - // Extract the Mem Objects for all Requirements, to ensure they are available if - // a user ask for them inside the interop task scope - const auto& HandlerReq = ExecInterop->MRequirements; - std::for_each(std::begin(HandlerReq), std::end(HandlerReq), [&](Requirement* Req) { - AllocaCommandBase *AllocaCmd = getAllocaForReq(Req); - auto MemArg = reinterpret_cast(AllocaCmd->getMemAllocation()); - interop_handler::ReqToMem ReqToMem = std::make_pair(Req, MemArg); - ReqMemObjs.emplace_back(ReqToMem); - }); + // Extract the Mem Objects for all Requirements, to ensure they are + // available if a user ask for them inside the interop task scope + const auto &HandlerReq = ExecInterop->MRequirements; + std::for_each( + std::begin(HandlerReq), std::end(HandlerReq), [&](Requirement *Req) { + AllocaCommandBase *AllocaCmd = getAllocaForReq(Req); + auto MemArg = reinterpret_cast(AllocaCmd->getMemAllocation()); + interop_handler::ReqToMem ReqToMem = std::make_pair(Req, MemArg); + ReqMemObjs.emplace_back(ReqToMem); + }); std::sort(std::begin(ReqMemObjs), std::end(ReqMemObjs)); interop_handler InteropHandler(std::move(ReqMemObjs), MQueue); diff --git a/sycl/source/detail/spec_constant_impl.cpp b/sycl/source/detail/spec_constant_impl.cpp index 898fb584f07b7..080f11c19f925 100644 --- a/sycl/source/detail/spec_constant_impl.cpp +++ b/sycl/source/detail/spec_constant_impl.cpp @@ -9,9 +9,9 @@ #include #include -#include #include #include +#include #include #include diff --git a/sycl/source/detail/sycl_mem_obj_t.cpp b/sycl/source/detail/sycl_mem_obj_t.cpp index 82cddfddb8b00..3aef4122523d0 100644 --- a/sycl/source/detail/sycl_mem_obj_t.cpp +++ b/sycl/source/detail/sycl_mem_obj_t.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include __SYCL_INLINE_NAMESPACE(cl) { diff --git a/sycl/source/detail/usm/usm_impl.cpp b/sycl/source/detail/usm/usm_impl.cpp index d6acee67293cf..5c78364adfbec 100644 --- a/sycl/source/detail/usm/usm_impl.cpp +++ b/sycl/source/detail/usm/usm_impl.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include @@ -194,7 +194,7 @@ void *aligned_alloc_host(size_t Alignment, size_t Size, const context &Ctxt) { void *aligned_alloc_host(size_t Alignment, size_t Size, const queue &Q) { return aligned_alloc_host(Alignment, Size, Q.get_context()); -} +} void *aligned_alloc_shared(size_t Alignment, size_t Size, const device &Dev, const context &Ctxt) { diff --git a/sycl/source/device.cpp b/sycl/source/device.cpp index e824b5faba039..95ff30d5254a0 100644 --- a/sycl/source/device.cpp +++ b/sycl/source/device.cpp @@ -15,6 +15,7 @@ #include #include #include +#include __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { diff --git a/sycl/source/event.cpp b/sycl/source/event.cpp index c8b94a5644b13..5fc3bfb7e12ae 100644 --- a/sycl/source/event.cpp +++ b/sycl/source/event.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include diff --git a/sycl/source/interop_handler.cpp b/sycl/source/interop_handler.cpp index f6fb55ad28120..b37ed26de282e 100644 --- a/sycl/source/interop_handler.cpp +++ b/sycl/source/interop_handler.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include -#include +#include #include #include diff --git a/sycl/source/kernel.cpp b/sycl/source/kernel.cpp index 79ab595a1b845..9a60edca94608 100644 --- a/sycl/source/kernel.cpp +++ b/sycl/source/kernel.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include -#include +#include #include #include #include diff --git a/sycl/source/platform.cpp b/sycl/source/platform.cpp index b570ff22b1ef9..60871bc86a59b 100644 --- a/sycl/source/platform.cpp +++ b/sycl/source/platform.cpp @@ -13,6 +13,7 @@ #include #include #include +#include __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { diff --git a/sycl/test/basic_tests/image_accessor_types.cpp b/sycl/test/basic_tests/image_accessor_types.cpp index 5bcdc22357295..c7ad9726ef813 100644 --- a/sycl/test/basic_tests/image_accessor_types.cpp +++ b/sycl/test/basic_tests/image_accessor_types.cpp @@ -1,4 +1,4 @@ -// RUN: not %clangxx -fsyntax-only -std=c++17 %s -I %sycl_include/sycl 2>&1 | FileCheck %s +// RUN: not %clangxx -fsyntax-only %s -fsycl -fsycl-targets=%sycl_triple 2>&1 | FileCheck %s #include #include diff --git a/sycl/test/basic_tests/vectors/ctad_fail.cpp b/sycl/test/basic_tests/vectors/ctad_fail.cpp index bdae6b013e62c..efa79eb503e13 100644 --- a/sycl/test/basic_tests/vectors/ctad_fail.cpp +++ b/sycl/test/basic_tests/vectors/ctad_fail.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify %s -I %sycl_include/sycl -Xclang -verify-ignore-unexpected +// RUN: %clangxx -fsyntax-only -Xclang -verify %s -fsycl -fsycl-targets=%sycl_triple -Xclang -verify-ignore-unexpected //==--------------- ctad.cpp - SYCL vector CTAD fail test ------------------==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. diff --git a/sycl/test/gdb/accessors.cpp b/sycl/test/gdb/accessors.cpp index da7cc84ecb2ea..c093dfce364b5 100644 --- a/sycl/test/gdb/accessors.cpp +++ b/sycl/test/gdb/accessors.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -c -fno-color-diagnostics -std=c++17 -I %sycl_include/sycl -Xclang -ast-dump %s | FileCheck %s +// RUN: %clangxx -c -fno-color-diagnostics -std=c++17 -I %sycl_include -I %sycl_include/sycl -Xclang -ast-dump %s | FileCheck %s // UNSUPPORTED: windows #include diff --git a/sycl/test/gdb/printers.cpp b/sycl/test/gdb/printers.cpp index 58fda0db57034..1d8df22f3c10e 100644 --- a/sycl/test/gdb/printers.cpp +++ b/sycl/test/gdb/printers.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -c -fno-color-diagnostics -std=c++17 -I %sycl_include/sycl -Xclang -ast-dump %s | FileCheck %s +// RUN: %clangxx -c -fno-color-diagnostics -fsycl -fsycl-targets=%sycl_triple -Xclang -ast-dump %s | FileCheck %s // UNSUPPORTED: windows #include #include diff --git a/sycl/test/separate-compile/test.cpp b/sycl/test/separate-compile/test.cpp index df97ae177d5d1..57799d9b05e61 100644 --- a/sycl/test/separate-compile/test.cpp +++ b/sycl/test/separate-compile/test.cpp @@ -7,13 +7,13 @@ // >> host compilation... // Driver automatically adds -D_DLL and -D_MT on Windows with -fsycl. // Add those defines required for Windows and harmless for Linux. -// RUN: %clangxx -D_DLL -D_MT -std=c++17 -include sycl_ihdr_a.h -g -c %s -o a.o -I %sycl_include/sycl -Wno-sycl-strict +// RUN: %clangxx -D_DLL -D_MT -std=c++17 -include sycl_ihdr_a.h -g -c %s -o a.o -I %sycl_include -I %sycl_include/sycl -Wno-sycl-strict // // >> ---- compile src2 // >> device compilation... // RUN: %clangxx -DB_CPP=1 -fsycl-device-only -Xclang -fsycl-int-header=sycl_ihdr_b.h %s -c -o b_kernel.bc -Wno-sycl-strict // >> host compilation... -// RUN: %clangxx -DB_CPP=1 -D_DLL -D_MT -std=c++17 -include sycl_ihdr_b.h -g -c %s -o b.o -I %sycl_include/sycl -Wno-sycl-strict +// RUN: %clangxx -DB_CPP=1 -D_DLL -D_MT -std=c++17 -include sycl_ihdr_b.h -g -c %s -o b.o -I %sycl_include -I %sycl_include/sycl -Wno-sycl-strict // // >> ---- bundle .o with .spv // >> run bundler diff --git a/sycl/tools/sycl-ls/CMakeLists.txt b/sycl/tools/sycl-ls/CMakeLists.txt index a409db2d79d5f..de3c566f57a32 100644 --- a/sycl/tools/sycl-ls/CMakeLists.txt +++ b/sycl/tools/sycl-ls/CMakeLists.txt @@ -1,6 +1,6 @@ add_executable(sycl-ls sycl-ls.cpp) add_dependencies(sycl-ls sycl) -target_include_directories(sycl-ls PRIVATE "${sycl_inc_dir}") +target_include_directories(sycl-ls PRIVATE "${sycl_inc_dir}" "${pi_include_dir}") target_link_libraries(sycl-ls PRIVATE sycl diff --git a/sycl/unittests/helpers/PiMock.hpp b/sycl/unittests/helpers/PiMock.hpp index fa415a3b26f6c..06edd747b2df9 100644 --- a/sycl/unittests/helpers/PiMock.hpp +++ b/sycl/unittests/helpers/PiMock.hpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include @@ -53,7 +53,7 @@ namespace RT = detail::pi; decltype(&::api) FuncPtr) { \ MPlugin->PiFunctionTable.api = FuncPtr; \ } -#include +#include #undef _PI_API /// The PiMock class wraps an instance of a SYCL platform class, diff --git a/sycl/unittests/kernel-and-program/Cache.cpp b/sycl/unittests/kernel-and-program/Cache.cpp index daf532fe293c6..0fb9e61fe2660 100644 --- a/sycl/unittests/kernel-and-program/Cache.cpp +++ b/sycl/unittests/kernel-and-program/Cache.cpp @@ -8,7 +8,7 @@ #define SYCL2020_DISABLE_DEPRECATION_WARNINGS -#include "CL/sycl/detail/pi.h" +#include "CL/sycl/detail/pi_sycl.hpp" #include "detail/context_impl.hpp" #include "detail/kernel_program_cache.hpp" #include "detail/program_impl.hpp" diff --git a/sycl/unittests/pi/BackendString.hpp b/sycl/unittests/pi/BackendString.hpp index 7f051f5ab6790..6fe7d7dd2e92c 100644 --- a/sycl/unittests/pi/BackendString.hpp +++ b/sycl/unittests/pi/BackendString.hpp @@ -4,7 +4,7 @@ #pragma once -#include +#include namespace pi { inline const char *GetBackendString(cl::sycl::backend backend) { diff --git a/sycl/unittests/pi/CMakeLists.txt b/sycl/unittests/pi/CMakeLists.txt index 93a958850f9d8..1427b1353388f 100644 --- a/sycl/unittests/pi/CMakeLists.txt +++ b/sycl/unittests/pi/CMakeLists.txt @@ -9,7 +9,7 @@ add_sycl_unittest(PiTests OBJECT ) add_dependencies(PiTests sycl) -target_include_directories(PiTests PRIVATE SYSTEM ${sycl_inc_dir}) +target_include_directories(PiTests PRIVATE SYSTEM ${sycl_inc_dir} ${pi_include_dir}) if(SYCL_BUILD_PI_CUDA) add_subdirectory(cuda) diff --git a/sycl/unittests/pi/EnqueueMemTest.cpp b/sycl/unittests/pi/EnqueueMemTest.cpp index 8abf016e5b322..7e42da1674f3c 100644 --- a/sycl/unittests/pi/EnqueueMemTest.cpp +++ b/sycl/unittests/pi/EnqueueMemTest.cpp @@ -7,8 +7,8 @@ //===----------------------------------------------------------------------===// #include "TestGetPlugin.hpp" -#include -#include +#include +#include #include using namespace cl::sycl; diff --git a/sycl/unittests/pi/PlatformTest.cpp b/sycl/unittests/pi/PlatformTest.cpp index c3d04721cc992..3e6383f3e0cf9 100644 --- a/sycl/unittests/pi/PlatformTest.cpp +++ b/sycl/unittests/pi/PlatformTest.cpp @@ -8,8 +8,8 @@ #include "TestGetPlugin.hpp" #include -#include -#include +#include +#include #include #include diff --git a/sycl/unittests/pi/TestGetPlugin.hpp b/sycl/unittests/pi/TestGetPlugin.hpp index 6512b111f8123..02c95e066093f 100644 --- a/sycl/unittests/pi/TestGetPlugin.hpp +++ b/sycl/unittests/pi/TestGetPlugin.hpp @@ -6,7 +6,7 @@ #include "BackendString.hpp" #include -#include +#include #include namespace pi { diff --git a/sycl/unittests/pi/cuda/CMakeLists.txt b/sycl/unittests/pi/cuda/CMakeLists.txt index a2f4bd926a40a..abb12ed1a42ed 100644 --- a/sycl/unittests/pi/cuda/CMakeLists.txt +++ b/sycl/unittests/pi/cuda/CMakeLists.txt @@ -22,6 +22,7 @@ target_include_directories(PiCudaTests "../" "${sycl_inc_dir}/CL/sycl/detail/" "${sycl_inc_dir}" + "${pi_include_dir}" "${sycl_plugin_dir}/cuda/" ) diff --git a/sycl/unittests/pi/cuda/test_base_objects.cpp b/sycl/unittests/pi/cuda/test_base_objects.cpp index 1ae64f981931c..0b969b448c4a2 100644 --- a/sycl/unittests/pi/cuda/test_base_objects.cpp +++ b/sycl/unittests/pi/cuda/test_base_objects.cpp @@ -12,9 +12,10 @@ #include "TestGetPlugin.hpp" #include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/sycl/unittests/pi/cuda/test_commands.cpp b/sycl/unittests/pi/cuda/test_commands.cpp index 3235391f93425..fe7f040701ba3 100644 --- a/sycl/unittests/pi/cuda/test_commands.cpp +++ b/sycl/unittests/pi/cuda/test_commands.cpp @@ -12,8 +12,8 @@ #include "TestGetPlugin.hpp" #include -#include -#include +#include +#include #include using namespace cl::sycl; diff --git a/sycl/unittests/pi/cuda/test_device.cpp b/sycl/unittests/pi/cuda/test_device.cpp index 7c8a5d756c3c7..c8f9996c69c20 100644 --- a/sycl/unittests/pi/cuda/test_device.cpp +++ b/sycl/unittests/pi/cuda/test_device.cpp @@ -12,8 +12,8 @@ #include "TestGetPlugin.hpp" #include -#include -#include +#include +#include #include using namespace cl::sycl; diff --git a/sycl/unittests/pi/cuda/test_interop_get_native.cpp b/sycl/unittests/pi/cuda/test_interop_get_native.cpp index 584f73ad45c00..c7de3f5f9a8f1 100644 --- a/sycl/unittests/pi/cuda/test_interop_get_native.cpp +++ b/sycl/unittests/pi/cuda/test_interop_get_native.cpp @@ -13,6 +13,7 @@ #include #include #include +#include using namespace cl::sycl; diff --git a/sycl/unittests/pi/cuda/test_kernels.cpp b/sycl/unittests/pi/cuda/test_kernels.cpp index 0b57e7eb82790..6ddcb420a19fb 100644 --- a/sycl/unittests/pi/cuda/test_kernels.cpp +++ b/sycl/unittests/pi/cuda/test_kernels.cpp @@ -12,8 +12,8 @@ #include "TestGetPlugin.hpp" #include -#include -#include +#include +#include #include // PI CUDA kernels carry an additional argument for the implicit global offset. diff --git a/sycl/unittests/pi/cuda/test_mem_obj.cpp b/sycl/unittests/pi/cuda/test_mem_obj.cpp index cca3a43fc9a38..f467bdaea15ee 100644 --- a/sycl/unittests/pi/cuda/test_mem_obj.cpp +++ b/sycl/unittests/pi/cuda/test_mem_obj.cpp @@ -12,9 +12,9 @@ #include "TestGetPlugin.hpp" #include -#include -#include -#include +#include +#include +#include #include using namespace cl::sycl; diff --git a/sycl/unittests/pi/cuda/test_queue.cpp b/sycl/unittests/pi/cuda/test_queue.cpp index 39ee2731df03a..fee7beafc56cc 100644 --- a/sycl/unittests/pi/cuda/test_queue.cpp +++ b/sycl/unittests/pi/cuda/test_queue.cpp @@ -12,9 +12,10 @@ #include "TestGetPlugin.hpp" #include -#include -#include -#include +#include +#include +#include +#include #include using namespace cl::sycl; diff --git a/sycl/unittests/pi/cuda/test_sampler_properties.cpp b/sycl/unittests/pi/cuda/test_sampler_properties.cpp index c4a19d8dc9e93..b3fa008d12976 100644 --- a/sycl/unittests/pi/cuda/test_sampler_properties.cpp +++ b/sycl/unittests/pi/cuda/test_sampler_properties.cpp @@ -8,9 +8,10 @@ #include "TestGetPlugin.hpp" #include -#include -#include + +#include #include +#include #include namespace {