Skip to content

Commit fcb840f

Browse files
committed
[SYCL] create PI (Plugin Interface) layer and redirect there platform/device stuff.
Signed-off-by: Sergey V Maslov <[email protected]>
1 parent 6cc4701 commit fcb840f

32 files changed

+1199
-742
lines changed

sycl/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,11 @@ set(LLVM_TOOLS_DIR "${LLVM_BINARY_DIR}/bin/")
123123
add_library("${SYCLLibrary}" SHARED
124124
"${includeRootPath}/CL/sycl.hpp"
125125
"${sourceRootPath}/detail/builtins.cpp"
126-
"${sourceRootPath}/detail/cnri.cpp"
126+
"${sourceRootPath}/detail/pi.cpp"
127+
"${sourceRootPath}/detail/pi_opencl.cpp"
127128
"${sourceRootPath}/detail/common.cpp"
128129
"${sourceRootPath}/detail/context_impl.cpp"
130+
"${sourceRootPath}/detail/device_impl.cpp"
129131
"${sourceRootPath}/detail/device_info.cpp"
130132
"${sourceRootPath}/detail/event_impl.cpp"
131133
"${sourceRootPath}/detail/force_device.cpp"
@@ -134,8 +136,7 @@ add_library("${SYCLLibrary}" SHARED
134136
"${sourceRootPath}/detail/kernel_impl.cpp"
135137
"${sourceRootPath}/detail/kernel_info.cpp"
136138
"${sourceRootPath}/detail/memory_manager.cpp"
137-
"${sourceRootPath}/detail/platform_host.cpp"
138-
"${sourceRootPath}/detail/platform_opencl.cpp"
139+
"${sourceRootPath}/detail/platform_impl.cpp"
139140
"${sourceRootPath}/detail/platform_info.cpp"
140141
"${sourceRootPath}/detail/program_impl.cpp"
141142
"${sourceRootPath}/detail/program_manager/program_manager.cpp"

sycl/include/CL/sycl/detail/aligned_allocator.hpp

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

1111
#include <CL/cl.h>
12-
#include <CL/sycl/detail/cnri.h>
12+
#include <CL/sycl/detail/common.hpp>
1313
#include <CL/sycl/detail/os_util.hpp>
1414
#include <CL/sycl/range.hpp>
1515

sycl/include/CL/sycl/detail/cnri.h

Lines changed: 0 additions & 120 deletions
This file was deleted.

sycl/include/CL/sycl/detail/common.hpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,22 @@
1515
#include <CL/cl_ext.h>
1616
#include <CL/cl_ext_intel.h>
1717
#include <string>
18-
1918
#include <type_traits>
2019

20+
// Select underlying runtime interface in compile-time (OpenCL or PI).
21+
// Comment the define of the FORCE_SYCL_BE_OPENCL below to switch to PI.
22+
// As such only one path (OpenCL today) is being regularily tested.
23+
//
24+
// TODO: we can just remove this when switch to PI completely.
25+
//
26+
#define FORCE_SYCL_BE_OPENCL
27+
28+
#ifdef FORCE_SYCL_BE_OPENCL
29+
#include <CL/sycl/detail/pi_opencl.hpp>
30+
#else
31+
#include <CL/sycl/detail/pi.hpp>
32+
#endif
33+
2134
const char *stringifyErrorCode(cl_int error);
2235

2336
#define OCL_CODE_TO_STR(code) \
@@ -78,6 +91,16 @@ const char *stringifyErrorCode(cl_int error);
7891
namespace cl {
7992
namespace sycl {
8093
namespace detail {
94+
95+
// Select underlying runtime interface (RT) in compile-time (OpenCL or PI).
96+
// As such only one path (OpenCL today) is being regularily tested.
97+
//
98+
#ifdef FORCE_SYCL_BE_OPENCL
99+
using RT = cl::sycl::detail::opencl;
100+
#else
101+
using RT = cl::sycl::detail::pi;
102+
#endif
103+
81104
// Helper function for extracting implementation from SYCL's interface objects.
82105
// Note! This function relies on the fact that all SYCL interface classes
83106
// contain "impl" field that points to implementation object. "impl" field

sycl/include/CL/sycl/detail/device_host.hpp

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)