Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL] Remove program class and related APIs #4461

Merged
merged 4 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sycl/include/CL/sycl/backend/cuda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ template <> struct interop<backend::cuda, queue> { using type = CUstream; };

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

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

template <typename DataT, int Dimensions, access::mode AccessMode>
struct interop<backend::cuda,
Expand Down
6 changes: 6 additions & 0 deletions sycl/include/CL/sycl/backend/opencl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ template <> struct interop<backend::opencl, queue> {
using type = cl_command_queue;
};

#ifdef __SYCL_INTERNAL_API
template <> struct interop<backend::opencl, program> {
using type = cl_program;
};
#endif

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

Expand Down Expand Up @@ -110,8 +112,10 @@ namespace opencl {
__SYCL_EXPORT platform make_platform(pi_native_handle NativeHandle);
__SYCL_EXPORT device make_device(pi_native_handle NativeHandle);
__SYCL_EXPORT context make_context(pi_native_handle NativeHandle);
#ifdef __SYCL_INTERNAL_API
__SYCL_EXPORT program make_program(const context &Context,
pi_native_handle NativeHandle);
#endif
__SYCL_EXPORT queue make_queue(const context &Context,
pi_native_handle InteropHandle);

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

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

// Construction of SYCL queue.
template <typename T, typename detail::enable_if_t<
Expand Down
8 changes: 8 additions & 0 deletions sycl/include/CL/sycl/info/info_desc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {

#ifdef __SYCL_INTERNAL_API
class program;
#endif
class device;
class platform;

Expand Down Expand Up @@ -220,7 +222,9 @@ enum class kernel : cl_kernel_info {
function_name = CL_KERNEL_FUNCTION_NAME,
num_args = CL_KERNEL_NUM_ARGS,
context = CL_KERNEL_CONTEXT,
#ifdef __SYCL_INTERNAL_API
program = CL_KERNEL_PROGRAM,
#endif
reference_count = CL_KERNEL_REFERENCE_COUNT,
attributes = CL_KERNEL_ATTRIBUTES
};
Expand Down Expand Up @@ -257,11 +261,13 @@ enum class kernel_device_specific : cl_kernel_work_group_info {
};

// A.6 Program information desctiptors
#ifdef __SYCL_INTERNAL_API
enum class program : cl_program_info {
context = CL_PROGRAM_CONTEXT,
devices = CL_PROGRAM_DEVICES,
reference_count = CL_PROGRAM_REFERENCE_COUNT
};
#endif

// A.7 Event information desctiptors
enum class event : cl_event_info {
Expand Down Expand Up @@ -315,7 +321,9 @@ template <typename T, T param> struct compatibility_param_traits {};

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

#ifdef __SYCL_INTERNAL_API
#include <CL/sycl/info/program_traits.def>
#endif

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

Expand Down
2 changes: 2 additions & 0 deletions sycl/include/CL/sycl/info/kernel_traits.def
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ __SYCL_PARAM_TRAITS_SPEC(kernel, num_args, cl_uint)
__SYCL_PARAM_TRAITS_SPEC(kernel, reference_count, cl_uint)
__SYCL_PARAM_TRAITS_SPEC(kernel, attributes, std::string)
__SYCL_PARAM_TRAITS_SPEC(kernel, context, cl::sycl::context)
#ifdef __SYCL_INTERNAL_API
__SYCL_PARAM_TRAITS_SPEC(kernel, program, cl::sycl::program)
#endif

4 changes: 4 additions & 0 deletions sycl/include/CL/sycl/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
// Forward declaration
#ifdef __SYCL_INTERNAL_API
class program;
#endif
class context;
template <backend Backend> class backend_traits;
template <bundle_state State> class kernel_bundle;
Expand Down Expand Up @@ -127,7 +129,9 @@ class __SYCL_EXPORT kernel {
/// get_info<info::kernel::program>().
///
/// \return a valid SYCL program
#ifdef __SYCL_INTERNAL_API
program get_program() const;
#endif

/// Query information from the kernel object using the info::kernel_info
/// descriptor.
Expand Down
4 changes: 4 additions & 0 deletions sycl/include/CL/sycl/program.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#pragma once

#ifdef __SYCL_INTERNAL_API

#include <CL/sycl/context.hpp>
#include <CL/sycl/detail/export.hpp>
#include <CL/sycl/detail/kernel_desc.hpp>
Expand Down Expand Up @@ -428,3 +430,5 @@ template <> struct hash<cl::sycl::program> {
}
};
} // namespace std

#endif
6 changes: 6 additions & 0 deletions sycl/include/sycl/ext/oneapi/backend/level_zero.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ template <> struct interop<backend::level_zero, event> {
using type = ze_event_handle_t;
};

#ifdef __SYCL_INTERNAL_API
template <> struct interop<backend::level_zero, program> {
using type = ze_module_handle_t;
};
#endif

template <> struct interop<backend::level_zero, kernel> {
using type = ze_kernel_handle_t;
Expand Down Expand Up @@ -154,8 +156,10 @@ __SYCL_EXPORT device make_device(const platform &Platform,
__SYCL_EXPORT context make_context(const std::vector<device> &DeviceList,
pi_native_handle NativeHandle,
bool keep_ownership = false);
#ifdef __SYCL_INTERNAL_API
__SYCL_EXPORT program make_program(const context &Context,
pi_native_handle NativeHandle);
#endif
__SYCL_EXPORT queue make_queue(const context &Context,
pi_native_handle InteropHandle,
bool keep_ownership = false);
Expand Down Expand Up @@ -200,13 +204,15 @@ T make(const std::vector<device> &DeviceList,
}

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

// Construction of SYCL queue.
template <typename T, typename detail::enable_if_t<
Expand Down
2 changes: 2 additions & 0 deletions sycl/source/detail/kernel_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,12 @@ inline context kernel_impl::get_info<info::kernel::context>() const {
return createSyclObjFromImpl<context>(MContext);
}

#ifdef __SYCL_INTERNAL_API
template <>
inline program kernel_impl::get_info<info::kernel::program>() const {
return createSyclObjFromImpl<program>(MProgramImpl);
}
#endif

template <info::kernel_device_specific param>
inline typename info::param_traits<info::kernel_device_specific,
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/abi/symbol_size_alignment.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t
// RUN: %clangxx -fsycl %s -D__SYCL_INTERNAL_API -o %t
// UNSUPPORTED: libcxx

// Changing symbol size or alignment is a breaking change. If it happens, refer
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/abi/user_mangling.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// clang-format off
// RUN: %clangxx -fsycl -c -emit-llvm -S -o - %s | FileCheck %s --check-prefix CHK-HOST
// RUN: %clangxx -fsycl -fsycl-device-only -O0 -c -emit-llvm -S -o - %s | FileCheck %s --check-prefix CHK-DEVICE
// RUN: %clangxx -fsycl -c -emit-llvm -D__SYCL_INTERNAL_API -S -o - %s | FileCheck %s --check-prefix CHK-HOST
// RUN: %clangxx -fsycl -fsycl-device-only -D__SYCL_INTERNAL_API -O0 -c -emit-llvm -S -o - %s | FileCheck %s --check-prefix CHK-DEVICE
// REQUIRES: linux
// UNSUPPORTED: libcxx

Expand Down
11 changes: 0 additions & 11 deletions sycl/test/basic_tests/interop-level-zero-2020.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ int main() {
context Context(Device);
queue Queue(Device);
event Event;
// expected-warning@+1 {{'program' is deprecated: program class is deprecated, use kernel_bundle instead}}
program Program(Context);
kernel_bundle<bundle_state::executable> KernelBundle =
get_kernel_bundle<bundle_state::executable>(Context);
kernel Kernel = KernelBundle.get_kernel(get_kernel_ids().front());
Expand All @@ -55,9 +53,6 @@ int main() {
ZeContext;
backend_traits<backend::ext_oneapi_level_zero>::return_type<queue> ZeQueue;
backend_traits<backend::ext_oneapi_level_zero>::return_type<event> ZeEvent;
// expected-warning@+1 {{'program' is deprecated: program class is deprecated, use kernel_bundle instead}}
backend_traits<backend::ext_oneapi_level_zero>::return_type<program>
ZeProgram;
backend_traits<backend::ext_oneapi_level_zero>::return_type<
kernel_bundle<bundle_state::executable>>
ZeKernelBundle;
Expand Down Expand Up @@ -94,9 +89,6 @@ int main() {
// expected-warning@+2 {{'get_native' is deprecated: Use SYCL 2020 sycl::get_native free function}}
// expected-warning@+1 {{'get_native<sycl::backend::ext_oneapi_level_zero>' is deprecated: Use SYCL 2020 sycl::get_native free function}}
ZeEvent = Event.get_native<backend::ext_oneapi_level_zero>();
// expected-warning@+2 {{'get_native' is deprecated: Use SYCL 2020 sycl::get_native free function}}
// expected-warning@+1 {{'get_native<sycl::backend::ext_oneapi_level_zero>' is deprecated: Use SYCL 2020 sycl::get_native free function}}
ZeProgram = Program.get_native<backend::ext_oneapi_level_zero>();
// expected-warning@+3 {{'get_native' is deprecated: Use SYCL 2020 sycl::get_native free function}}
// expected-warning@+2 {{'get_native<sycl::backend::ext_oneapi_level_zero>' is deprecated: Use SYCL 2020 sycl::get_native free function}}
/*ZeKernelBundle*/ (
Expand Down Expand Up @@ -165,9 +157,6 @@ int main() {
// expected-warning@+1 {{'make<sycl::event, nullptr>' is deprecated: Use SYCL 2020 sycl::make_event free function}}
auto E = ext::oneapi::level_zero::make<event>(
Context, ZeEvent, ext::oneapi::level_zero::ownership::keep);
// expected-warning@+2 {{'program' is deprecated: program class is deprecated, use kernel_bundle instead}}
// expected-warning@+1 {{'make<sycl::program, nullptr>' is deprecated: Use SYCL 2020 sycl::make_kernel_bundle free function}}
auto PR = ext::oneapi::level_zero::make<program>(Context, ZeProgram);

return 0;
}
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/spec_const_types.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-device-only -c -o %t.bc %s
// RUN: %clangxx -fsycl -fsycl-device-only -D__SYCL_INTERNAL_API -c -o %t.bc %s
// RUN: sycl-post-link %t.bc -spec-const=rt -o %t-split.txt
// RUN: cat %t-split_0.prop | FileCheck %s
// RUN: llvm-spirv -o %t-split_0.spv -spirv-max-version=1.1 -spirv-ext=+all %t-split_0.bc
Expand Down
13 changes: 0 additions & 13 deletions sycl/test/warnings/spec_consts_ext_deprecation.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion sycl/test/warnings/sycl_2020_deprecations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main() {
// expected-warning@+1 {{'get' is deprecated: OpenCL interop get() functions are deprecated, use get_native() instead}}
(void)Kernel.get();

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

sycl::buffer<int, 1> Buffer(4);
Expand Down
1 change: 1 addition & 0 deletions sycl/unittests/SYCL2020/GetNativeOpenCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#define SYCL2020_DISABLE_DEPRECATION_WARNINGS
#define __SYCL_INTERNAL_API

#include <CL/sycl.hpp>
#include <CL/sycl/backend/opencl.hpp>
Expand Down
1 change: 1 addition & 0 deletions sycl/unittests/kernel-and-program/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ add_sycl_unittest(KernelAndProgramTests OBJECT
DeviceInfo.cpp
PersistentDeviceCodeCache.cpp
)
target_compile_definitions(KernelAndProgramTests PRIVATE -D__SYCL_INTERNAL_API)
3 changes: 3 additions & 0 deletions sycl/unittests/misc/KernelBuildOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
//===---------------------------------------------------------------------===//

#define SYCL2020_DISABLE_DEPRECATION_WARNINGS
#ifndef __SYCL_INTERNAL_API
#define __SYCL_INTERNAL_API
#endif

#include <CL/sycl.hpp>
#include <helpers/PiImage.hpp>
Expand Down