Skip to content

Commit e7cc7b0

Browse files
author
Alexander Batashev
authored
[SYCL] Remove program class and related APIs (#4461)
1 parent e8ac5a0 commit e7cc7b0

File tree

17 files changed

+44
-29
lines changed

17 files changed

+44
-29
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ template <> struct interop<backend::cuda, queue> { using type = CUstream; };
4141

4242
template <> struct interop<backend::cuda, event> { using type = CUevent; };
4343

44+
#ifdef __SYCL_INTERNAL_API
4445
template <> struct interop<backend::cuda, program> { using type = CUmodule; };
46+
#endif
4547

4648
template <typename DataT, int Dimensions, access::mode AccessMode>
4749
struct interop<backend::cuda,

sycl/include/CL/sycl/backend/opencl.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ template <> struct interop<backend::opencl, queue> {
3737
using type = cl_command_queue;
3838
};
3939

40+
#ifdef __SYCL_INTERNAL_API
4041
template <> struct interop<backend::opencl, program> {
4142
using type = cl_program;
4243
};
44+
#endif
4345

4446
template <> struct interop<backend::opencl, event> { using type = cl_event; };
4547

@@ -110,8 +112,10 @@ namespace opencl {
110112
__SYCL_EXPORT platform make_platform(pi_native_handle NativeHandle);
111113
__SYCL_EXPORT device make_device(pi_native_handle NativeHandle);
112114
__SYCL_EXPORT context make_context(pi_native_handle NativeHandle);
115+
#ifdef __SYCL_INTERNAL_API
113116
__SYCL_EXPORT program make_program(const context &Context,
114117
pi_native_handle NativeHandle);
118+
#endif
115119
__SYCL_EXPORT queue make_queue(const context &Context,
116120
pi_native_handle InteropHandle);
117121

@@ -137,12 +141,14 @@ T make(typename interop<backend::opencl, T>::type Interop) {
137141
}
138142

139143
// Construction of SYCL program.
144+
#ifdef __SYCL_INTERNAL_API
140145
template <typename T, typename detail::enable_if_t<
141146
std::is_same<T, program>::value> * = nullptr>
142147
T make(const context &Context,
143148
typename interop<backend::opencl, T>::type Interop) {
144149
return make_program(Context, detail::pi::cast<pi_native_handle>(Interop));
145150
}
151+
#endif
146152

147153
// Construction of SYCL queue.
148154
template <typename T, typename detail::enable_if_t<

sycl/include/CL/sycl/info/info_desc.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
__SYCL_INLINE_NAMESPACE(cl) {
1616
namespace sycl {
1717

18+
#ifdef __SYCL_INTERNAL_API
1819
class program;
20+
#endif
1921
class device;
2022
class platform;
2123

@@ -220,7 +222,9 @@ enum class kernel : cl_kernel_info {
220222
function_name = CL_KERNEL_FUNCTION_NAME,
221223
num_args = CL_KERNEL_NUM_ARGS,
222224
context = CL_KERNEL_CONTEXT,
225+
#ifdef __SYCL_INTERNAL_API
223226
program = CL_KERNEL_PROGRAM,
227+
#endif
224228
reference_count = CL_KERNEL_REFERENCE_COUNT,
225229
attributes = CL_KERNEL_ATTRIBUTES
226230
};
@@ -258,11 +262,13 @@ enum class kernel_device_specific : cl_kernel_work_group_info {
258262
};
259263

260264
// A.6 Program information desctiptors
265+
#ifdef __SYCL_INTERNAL_API
261266
enum class program : cl_program_info {
262267
context = CL_PROGRAM_CONTEXT,
263268
devices = CL_PROGRAM_DEVICES,
264269
reference_count = CL_PROGRAM_REFERENCE_COUNT
265270
};
271+
#endif
266272

267273
// A.7 Event information desctiptors
268274
enum class event : cl_event_info {
@@ -316,7 +322,9 @@ template <typename T, T param> struct compatibility_param_traits {};
316322

317323
#include <CL/sycl/info/platform_traits.def>
318324

325+
#ifdef __SYCL_INTERNAL_API
319326
#include <CL/sycl/info/program_traits.def>
327+
#endif
320328

321329
#include <CL/sycl/info/queue_traits.def>
322330

sycl/include/CL/sycl/info/kernel_traits.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ __SYCL_PARAM_TRAITS_SPEC(kernel, num_args, cl_uint)
33
__SYCL_PARAM_TRAITS_SPEC(kernel, reference_count, cl_uint)
44
__SYCL_PARAM_TRAITS_SPEC(kernel, attributes, std::string)
55
__SYCL_PARAM_TRAITS_SPEC(kernel, context, cl::sycl::context)
6+
#ifdef __SYCL_INTERNAL_API
67
__SYCL_PARAM_TRAITS_SPEC(kernel, program, cl::sycl::program)
8+
#endif
79

sycl/include/CL/sycl/kernel.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
__SYCL_INLINE_NAMESPACE(cl) {
2121
namespace sycl {
2222
// Forward declaration
23+
#ifdef __SYCL_INTERNAL_API
2324
class program;
25+
#endif
2426
class context;
2527
template <backend Backend> class backend_traits;
2628
template <bundle_state State> class kernel_bundle;
@@ -127,7 +129,9 @@ class __SYCL_EXPORT kernel {
127129
/// get_info<info::kernel::program>().
128130
///
129131
/// \return a valid SYCL program
132+
#ifdef __SYCL_INTERNAL_API
130133
program get_program() const;
134+
#endif
131135

132136
/// Query information from the kernel object using the info::kernel_info
133137
/// descriptor.

sycl/include/CL/sycl/program.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#pragma once
1010

11+
#ifdef __SYCL_INTERNAL_API
12+
1113
#include <CL/sycl/context.hpp>
1214
#include <CL/sycl/detail/export.hpp>
1315
#include <CL/sycl/detail/kernel_desc.hpp>
@@ -428,3 +430,5 @@ template <> struct hash<cl::sycl::program> {
428430
}
429431
};
430432
} // namespace std
433+
434+
#endif

sycl/include/sycl/ext/oneapi/backend/level_zero.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ template <> struct interop<backend::level_zero, event> {
3535
using type = ze_event_handle_t;
3636
};
3737

38+
#ifdef __SYCL_INTERNAL_API
3839
template <> struct interop<backend::level_zero, program> {
3940
using type = ze_module_handle_t;
4041
};
42+
#endif
4143

4244
template <> struct interop<backend::level_zero, kernel> {
4345
using type = ze_kernel_handle_t;
@@ -154,8 +156,10 @@ __SYCL_EXPORT device make_device(const platform &Platform,
154156
__SYCL_EXPORT context make_context(const std::vector<device> &DeviceList,
155157
pi_native_handle NativeHandle,
156158
bool keep_ownership = false);
159+
#ifdef __SYCL_INTERNAL_API
157160
__SYCL_EXPORT program make_program(const context &Context,
158161
pi_native_handle NativeHandle);
162+
#endif
159163
__SYCL_EXPORT queue make_queue(const context &Context,
160164
pi_native_handle InteropHandle,
161165
bool keep_ownership = false);
@@ -200,13 +204,15 @@ T make(const std::vector<device> &DeviceList,
200204
}
201205

202206
// Construction of SYCL program.
207+
#ifdef __SYCL_INTERNAL_API
203208
template <typename T, typename detail::enable_if_t<
204209
std::is_same<T, program>::value> * = nullptr>
205210
__SYCL_DEPRECATED("Use SYCL 2020 sycl::make_kernel_bundle free function")
206211
T make(const context &Context,
207212
typename interop<backend::level_zero, T>::type Interop) {
208213
return make_program(Context, reinterpret_cast<pi_native_handle>(Interop));
209214
}
215+
#endif
210216

211217
// Construction of SYCL queue.
212218
template <typename T, typename detail::enable_if_t<

sycl/source/detail/kernel_impl.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,12 @@ inline context kernel_impl::get_info<info::kernel::context>() const {
229229
return createSyclObjFromImpl<context>(MContext);
230230
}
231231

232+
#ifdef __SYCL_INTERNAL_API
232233
template <>
233234
inline program kernel_impl::get_info<info::kernel::program>() const {
234235
return createSyclObjFromImpl<program>(MProgramImpl);
235236
}
237+
#endif
236238

237239
template <info::kernel_device_specific param>
238240
inline typename info::param_traits<info::kernel_device_specific,

sycl/test/abi/symbol_size_alignment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t
1+
// RUN: %clangxx -fsycl %s -D__SYCL_INTERNAL_API -o %t
22
// UNSUPPORTED: libcxx
33

44
// Changing symbol size or alignment is a breaking change. If it happens, refer

sycl/test/abi/user_mangling.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// clang-format off
2-
// RUN: %clangxx -fsycl -c -emit-llvm -S -o - %s | FileCheck %s --check-prefix CHK-HOST
3-
// RUN: %clangxx -fsycl -fsycl-device-only -O0 -c -emit-llvm -S -o - %s | FileCheck %s --check-prefix CHK-DEVICE
2+
// RUN: %clangxx -fsycl -c -emit-llvm -D__SYCL_INTERNAL_API -S -o - %s | FileCheck %s --check-prefix CHK-HOST
3+
// RUN: %clangxx -fsycl -fsycl-device-only -D__SYCL_INTERNAL_API -O0 -c -emit-llvm -S -o - %s | FileCheck %s --check-prefix CHK-DEVICE
44
// REQUIRES: linux
55
// UNSUPPORTED: libcxx
66

sycl/test/basic_tests/interop-level-zero-2020.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ int main() {
3333
context Context(Device);
3434
queue Queue(Device);
3535
event Event;
36-
// expected-warning@+1 {{'program' is deprecated: program class is deprecated, use kernel_bundle instead}}
37-
program Program(Context);
3836
kernel_bundle<bundle_state::executable> KernelBundle =
3937
get_kernel_bundle<bundle_state::executable>(Context);
4038
kernel Kernel = KernelBundle.get_kernel(get_kernel_ids().front());
@@ -55,9 +53,6 @@ int main() {
5553
ZeContext;
5654
backend_traits<backend::ext_oneapi_level_zero>::return_type<queue> ZeQueue;
5755
backend_traits<backend::ext_oneapi_level_zero>::return_type<event> ZeEvent;
58-
// expected-warning@+1 {{'program' is deprecated: program class is deprecated, use kernel_bundle instead}}
59-
backend_traits<backend::ext_oneapi_level_zero>::return_type<program>
60-
ZeProgram;
6156
backend_traits<backend::ext_oneapi_level_zero>::return_type<
6257
kernel_bundle<bundle_state::executable>>
6358
ZeKernelBundle;
@@ -94,9 +89,6 @@ int main() {
9489
// expected-warning@+2 {{'get_native' is deprecated: Use SYCL 2020 sycl::get_native free function}}
9590
// expected-warning@+1 {{'get_native<sycl::backend::ext_oneapi_level_zero>' is deprecated: Use SYCL 2020 sycl::get_native free function}}
9691
ZeEvent = Event.get_native<backend::ext_oneapi_level_zero>();
97-
// expected-warning@+2 {{'get_native' is deprecated: Use SYCL 2020 sycl::get_native free function}}
98-
// expected-warning@+1 {{'get_native<sycl::backend::ext_oneapi_level_zero>' is deprecated: Use SYCL 2020 sycl::get_native free function}}
99-
ZeProgram = Program.get_native<backend::ext_oneapi_level_zero>();
10092
// expected-warning@+3 {{'get_native' is deprecated: Use SYCL 2020 sycl::get_native free function}}
10193
// expected-warning@+2 {{'get_native<sycl::backend::ext_oneapi_level_zero>' is deprecated: Use SYCL 2020 sycl::get_native free function}}
10294
/*ZeKernelBundle*/ (
@@ -165,9 +157,6 @@ int main() {
165157
// expected-warning@+1 {{'make<sycl::event, nullptr>' is deprecated: Use SYCL 2020 sycl::make_event free function}}
166158
auto E = ext::oneapi::level_zero::make<event>(
167159
Context, ZeEvent, ext::oneapi::level_zero::ownership::keep);
168-
// expected-warning@+2 {{'program' is deprecated: program class is deprecated, use kernel_bundle instead}}
169-
// expected-warning@+1 {{'make<sycl::program, nullptr>' is deprecated: Use SYCL 2020 sycl::make_kernel_bundle free function}}
170-
auto PR = ext::oneapi::level_zero::make<program>(Context, ZeProgram);
171160

172161
return 0;
173162
}

sycl/test/basic_tests/spec_const_types.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl -fsycl-device-only -c -o %t.bc %s
1+
// RUN: %clangxx -fsycl -fsycl-device-only -D__SYCL_INTERNAL_API -c -o %t.bc %s
22
// RUN: sycl-post-link %t.bc -spec-const=rt -o %t-split.txt
33
// RUN: cat %t-split_0.prop | FileCheck %s
44
// RUN: llvm-spirv -o %t-split_0.spv -spirv-max-version=1.1 -spirv-ext=+all %t-split_0.bc

sycl/test/warnings/spec_consts_ext_deprecation.cpp

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

sycl/test/warnings/sycl_2020_deprecations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int main() {
6161
// expected-error@+1 {{no member named 'get' in 'sycl::kernel'}}
6262
(void)Kernel.get();
6363

64-
// expected-warning@+1 {{'program' is deprecated: program class is deprecated, use kernel_bundle instead}}
64+
// expected-error@+1 {{no type named 'program' in namespace 'sycl'}}
6565
sycl::program Prog{Ctx};
6666

6767
sycl::buffer<int, 1> Buffer(4);

sycl/unittests/SYCL2020/GetNativeOpenCL.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#define SYCL2020_DISABLE_DEPRECATION_WARNINGS
10+
#define __SYCL_INTERNAL_API
1011

1112
#include <CL/sycl.hpp>
1213
#include <CL/sycl/backend/opencl.hpp>

sycl/unittests/kernel-and-program/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ add_sycl_unittest(KernelAndProgramTests OBJECT
55
DeviceInfo.cpp
66
PersistentDeviceCodeCache.cpp
77
)
8+
target_compile_definitions(KernelAndProgramTests PRIVATE -D__SYCL_INTERNAL_API)

sycl/unittests/misc/KernelBuildOptions.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
//===---------------------------------------------------------------------===//
88

99
#define SYCL2020_DISABLE_DEPRECATION_WARNINGS
10+
#ifndef __SYCL_INTERNAL_API
11+
#define __SYCL_INTERNAL_API
12+
#endif
1013

1114
#include <CL/sycl.hpp>
1215
#include <helpers/PiImage.hpp>

0 commit comments

Comments
 (0)