Skip to content

Commit a0663de

Browse files
committed
[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.
1 parent 3fc66cc commit a0663de

File tree

104 files changed

+208
-149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+208
-149
lines changed

sycl/CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,31 @@ option(SYCL_BUILD_PI_CUDA
9494
# Configure SYCL version macro
9595
set(sycl_inc_dir ${CMAKE_CURRENT_SOURCE_DIR}/include)
9696
set(sycl_src_dir ${CMAKE_CURRENT_SOURCE_DIR}/source)
97-
set(sycl_plugin_dir ${CMAKE_CURRENT_SOURCE_DIR}/plugins)
97+
set(sycl_plugin_dir ${CMAKE_CURRENT_SOURCE_DIR}/libpi/plugins)
9898
string(TIMESTAMP __SYCL_COMPILER_VERSION "%Y%m%d")
9999
set(version_header "${sycl_inc_dir}/CL/sycl/version.hpp")
100100
configure_file("${version_header}.in" "${version_header}")
101101

102+
# Location of PI files
103+
set(pi_include_dir ${CMAKE_CURRENT_SOURCE_DIR}/libpi/include)
104+
set(pi_source_dir ${CMAKE_CURRENT_SOURCE_DIR}/libpi/src)
105+
106+
# Copy SYCL headers from sources to build directory
107+
add_custom_target(pi-headers ALL
108+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${pi_include_dir} ${SYCL_INCLUDE_BUILD_DIR}
109+
COMMENT "Copying PI headers ...")
110+
102111
# Copy SYCL headers from sources to build directory
103112
add_custom_target(sycl-headers ALL
104113
COMMAND ${CMAKE_COMMAND} -E copy_directory ${sycl_inc_dir}/sycl ${SYCL_INCLUDE_BUILD_DIR}/sycl
105114
COMMAND ${CMAKE_COMMAND} -E copy_directory ${sycl_inc_dir}/CL ${SYCL_INCLUDE_BUILD_DIR}/sycl/CL
106115
COMMENT "Copying SYCL headers ...")
116+
add_dependencies(sycl-headers pi-headers)
107117

108118
# Copy SYCL headers from sources to install directory
109119
install(DIRECTORY "${sycl_inc_dir}/sycl" DESTINATION ${SYCL_INCLUDE_DEPLOY_DIR} COMPONENT sycl-headers)
110120
install(DIRECTORY "${sycl_inc_dir}/CL" DESTINATION ${SYCL_INCLUDE_DEPLOY_DIR}/sycl COMPONENT sycl-headers)
121+
install(DIRECTORY "${pi_include_dir}/." DESTINATION ${SYCL_INCLUDE_DEPLOY_DIR} COMPONENT sycl-headers)
111122

112123
set(SYCL_RT_LIBS sycl)
113124
if (MSVC)
@@ -213,7 +224,7 @@ option(SYCL_INCLUDE_TESTS
213224
${LLVM_INCLUDE_TESTS})
214225

215226
# Plugin Library
216-
add_subdirectory( plugins )
227+
include(libpi.cmake)
217228

218229
add_subdirectory(tools)
219230

sycl/cmake/modules/AddSYCLUnitTest.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ macro(add_sycl_unittest test_dirname link_variant)
3434
target_include_directories(${test_dirname}
3535
PRIVATE SYSTEM
3636
${sycl_inc_dir}
37+
${pi_include_dir}
3738
${SYCL_SOURCE_DIR}/source/
3839
${SYCL_SOURCE_DIR}/unittests/
3940
)
@@ -92,8 +93,10 @@ macro(add_sycl_unittest_with_device test_dirname link_variant)
9293
endif()
9394

9495
if ("${link_variant}" MATCHES "OBJECT")
96+
# TODO PI integration should be fixed
97+
# once add_sycl_executable supports target_link_libraries
9598
add_sycl_executable(${test_dirname}
96-
OPTIONS -nolibsycl ${COMMON_OPTS} ${LLVM_PTHREAD_LIB} ${TERMINFO_LIB}
99+
OPTIONS -nolibsycl ${COMMON_OPTS} ${LLVM_PTHREAD_LIB} ${TERMINFO_LIB} -I "${pi_include_dir}"
97100
SOURCES ${ARGN} $<TARGET_OBJECTS:${sycl_obj_target}>
98101
LIBRARIES gtest_main gtest LLVMSupport LLVMTestingSupport OpenCL ${EXTRA_LIBS}
99102
DEPENDANTS SYCLUnitTests)

sycl/doc/PluginInterface.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ SYCL_PI_TRACE=-1 lists all PI Traces above and more debug messages.
7272

7373
#### Plugin binary interface
7474
Plugins should implement all the Interface APIs required for the PI Version
75-
it supports. There is [pi.def](../include/CL/sycl/detail/pi.def)/
76-
[pi.h](../include/CL/sycl/detail/pi.h) file listing all PI API names that can be
75+
it supports. There is [pi.def](../libpi/include/pi/pi.def)/
76+
[pi.h](../libpi/include/pi/pi.h) file listing all PI API names that can be
7777
called by the specific version of Plugin Interface.
7878
It exports a function - "piPluginInit" that returns the plugin details and
7979
function pointer table containing the list of pointers to implemented Interface
@@ -149,7 +149,7 @@ into
149149
- **Interoperability API** which allows interoperability with underlying
150150
runtimes such as OpenCL.
151151

152-
See [pi.h](../include/CL/sycl/detail/pi.h) header for the full list and
152+
See [pi.h](../include/pi/pi.h) header for the full list and
153153
descriptions of PI APIs.
154154

155155
### The Core OpenCL-based PI APIs

sycl/include/CL/sycl/backend.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#include <CL/sycl/detail/backend_traits.hpp>
1616
#include <CL/sycl/detail/common.hpp>
1717
#include <CL/sycl/detail/export.hpp>
18-
#include <CL/sycl/detail/pi.h>
19-
#include <CL/sycl/detail/pi.hpp>
18+
#include <pi/pi.h>
19+
#include <CL/sycl/detail/pi_sycl.hpp>
2020
#include <CL/sycl/device.hpp>
2121
#include <CL/sycl/event.hpp>
2222
#include <CL/sycl/exception.hpp>

sycl/include/CL/sycl/backend/cuda.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <CL/sycl/backend_types.hpp>
1414
#include <CL/sycl/context.hpp>
1515
#include <CL/sycl/detail/defines.hpp>
16+
#include <CL/sycl/detail/pi_sycl.hpp>
1617
#include <CL/sycl/device.hpp>
1718
#include <CL/sycl/event.hpp>
1819
#include <CL/sycl/queue.hpp>
@@ -58,4 +59,4 @@ struct interop<backend::cuda, accessor<DataT, Dimensions, AccessMode,
5859
};
5960

6061
} // namespace sycl
61-
} // namespace cl
62+
} // __SYCL_INLINE_NAMESPACE(cl)

sycl/include/CL/sycl/detail/array.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#pragma once
1010
#include <CL/sycl/detail/type_traits.hpp>
1111
#include <CL/sycl/exception.hpp>
12+
#include <pi/pi.h>
13+
1214
#include <functional>
1315
#include <stdexcept>
1416

sycl/include/CL/sycl/detail/device_binary_image.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#pragma once
99

1010
#include <CL/sycl/detail/os_util.hpp>
11-
#include <CL/sycl/detail/pi.hpp>
11+
#include <CL/sycl/detail/pi_sycl.hpp>
1212

1313
#include <memory>
1414

sycl/include/CL/sycl/detail/helpers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <CL/sycl/access/access.hpp>
1414
#include <CL/sycl/detail/common.hpp>
1515
#include <CL/sycl/detail/export.hpp>
16-
#include <CL/sycl/detail/pi.hpp>
16+
#include <CL/sycl/detail/pi_sycl.hpp>
1717
#include <CL/sycl/detail/type_traits.hpp>
1818

1919
#include <memory>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//==---------------- pi_sycl.hpp - SYCL wrapper for PI ---------*- C++ -*---==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
// ===--------------------------------------------------------------------=== //
8+
9+
#pragma once
10+
11+
#include <CL/sycl/detail/defines.hpp>
12+
#include <pi/pi.hpp>

sycl/include/CL/sycl/detail/property_list_base.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <CL/sycl/detail/common.hpp>
1212
#include <CL/sycl/detail/property_helper.hpp>
1313
#include <CL/sycl/detail/stl_type_traits.hpp>
14+
#include <pi/pi.h>
1415

1516
#include <bitset>
1617
#include <memory>

0 commit comments

Comments
 (0)