From 3dcd3c3430bc6fdb6b9120ff419ac93ae8456beb Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Thu, 2 Sep 2021 11:21:33 +0300 Subject: [PATCH 1/3] [SYCL] Remove program class and related APIs --- sycl/include/CL/sycl/info/info_desc.hpp | 8 ++++++++ sycl/include/CL/sycl/info/kernel_traits.def | 2 ++ sycl/include/CL/sycl/kernel.hpp | 4 ++++ sycl/include/CL/sycl/program.hpp | 4 ++++ sycl/source/detail/kernel_impl.hpp | 2 ++ sycl/test/abi/symbol_size_alignment.cpp | 2 +- sycl/test/abi/user_mangling.cpp | 4 ++-- sycl/test/basic_tests/spec_const_types.cpp | 2 +- sycl/test/warnings/sycl_2020_deprecations.cpp | 2 +- sycl/unittests/SYCL2020/GetNativeOpenCL.cpp | 1 + sycl/unittests/kernel-and-program/CMakeLists.txt | 1 + sycl/unittests/misc/KernelBuildOptions.cpp | 3 +++ 12 files changed, 30 insertions(+), 5 deletions(-) diff --git a/sycl/include/CL/sycl/info/info_desc.hpp b/sycl/include/CL/sycl/info/info_desc.hpp index cc74ed463dd3e..d749f1125e054 100644 --- a/sycl/include/CL/sycl/info/info_desc.hpp +++ b/sycl/include/CL/sycl/info/info_desc.hpp @@ -15,7 +15,9 @@ __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { +#ifdef __SYCL_INTERNAL_API class program; +#endif class device; class platform; @@ -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 }; @@ -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 { @@ -315,7 +321,9 @@ template struct compatibility_param_traits {}; #include +#ifdef __SYCL_INTERNAL_API #include +#endif #include diff --git a/sycl/include/CL/sycl/info/kernel_traits.def b/sycl/include/CL/sycl/info/kernel_traits.def index 789f33ce577fc..00126cf257390 100644 --- a/sycl/include/CL/sycl/info/kernel_traits.def +++ b/sycl/include/CL/sycl/info/kernel_traits.def @@ -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 diff --git a/sycl/include/CL/sycl/kernel.hpp b/sycl/include/CL/sycl/kernel.hpp index 180ca7df4121d..ae32ce7cc0201 100644 --- a/sycl/include/CL/sycl/kernel.hpp +++ b/sycl/include/CL/sycl/kernel.hpp @@ -20,7 +20,9 @@ __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { // Forward declaration +#ifdef __SYCL_INTERNAL_API class program; +#endif class context; template class backend_traits; template class kernel_bundle; @@ -122,7 +124,9 @@ class __SYCL_EXPORT kernel { /// get_info(). /// /// \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. diff --git a/sycl/include/CL/sycl/program.hpp b/sycl/include/CL/sycl/program.hpp index 7973ff03cf273..6ecc35492c62b 100644 --- a/sycl/include/CL/sycl/program.hpp +++ b/sycl/include/CL/sycl/program.hpp @@ -8,6 +8,8 @@ #pragma once +#ifdef __SYCL_INTERNAL_API + #include #include #include @@ -428,3 +430,5 @@ template <> struct hash { } }; } // namespace std + +#endif diff --git a/sycl/source/detail/kernel_impl.hpp b/sycl/source/detail/kernel_impl.hpp index f4b734d37ebe8..857efd7bf577d 100644 --- a/sycl/source/detail/kernel_impl.hpp +++ b/sycl/source/detail/kernel_impl.hpp @@ -226,10 +226,12 @@ inline context kernel_impl::get_info() const { return createSyclObjFromImpl(MContext); } +#ifdef __SYCL_INTERNAL_API template <> inline program kernel_impl::get_info() const { return createSyclObjFromImpl(MProgramImpl); } +#endif template inline typename info::param_traits Buffer(4); diff --git a/sycl/unittests/SYCL2020/GetNativeOpenCL.cpp b/sycl/unittests/SYCL2020/GetNativeOpenCL.cpp index 77835923dbd0f..2076113ebb5b1 100644 --- a/sycl/unittests/SYCL2020/GetNativeOpenCL.cpp +++ b/sycl/unittests/SYCL2020/GetNativeOpenCL.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #define SYCL2020_DISABLE_DEPRECATION_WARNINGS +#define __SYCL_INTERNAL_API #include #include diff --git a/sycl/unittests/kernel-and-program/CMakeLists.txt b/sycl/unittests/kernel-and-program/CMakeLists.txt index 6f8f6e5417653..0527bb1be0eef 100644 --- a/sycl/unittests/kernel-and-program/CMakeLists.txt +++ b/sycl/unittests/kernel-and-program/CMakeLists.txt @@ -5,3 +5,4 @@ add_sycl_unittest(KernelAndProgramTests OBJECT DeviceInfo.cpp PersistentDeviceCodeCache.cpp ) +target_compile_definitions(KernelAndProgramTests PRIVATE -D__SYCL_INTERNAL_API) diff --git a/sycl/unittests/misc/KernelBuildOptions.cpp b/sycl/unittests/misc/KernelBuildOptions.cpp index 90f3c3235aab6..7a83d6f689375 100644 --- a/sycl/unittests/misc/KernelBuildOptions.cpp +++ b/sycl/unittests/misc/KernelBuildOptions.cpp @@ -7,6 +7,9 @@ //===---------------------------------------------------------------------===// #define SYCL2020_DISABLE_DEPRECATION_WARNINGS +#ifndef __SYCL_INTERNAL_API +#define __SYCL_INTERNAL_API +#endif #include #include From 13cb2892172ed32fa09ccbef400683336e5ee14f Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Fri, 24 Sep 2021 22:23:58 +0300 Subject: [PATCH 2/3] more fixes --- sycl/include/CL/sycl/backend/cuda.hpp | 2 ++ sycl/include/CL/sycl/backend/opencl.hpp | 6 ++++++ sycl/include/sycl/ext/oneapi/backend/level_zero.hpp | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/sycl/include/CL/sycl/backend/cuda.hpp b/sycl/include/CL/sycl/backend/cuda.hpp index 9a45c2fc8bf0e..4024bfe6f9127 100644 --- a/sycl/include/CL/sycl/backend/cuda.hpp +++ b/sycl/include/CL/sycl/backend/cuda.hpp @@ -41,7 +41,9 @@ template <> struct interop { using type = CUstream; }; template <> struct interop { using type = CUevent; }; +#ifdef __SYCL_INTERNAL_API template <> struct interop { using type = CUmodule; }; +#endif template struct interop struct interop { using type = cl_command_queue; }; +#ifdef __SYCL_INTERNAL_API template <> struct interop { using type = cl_program; }; +#endif template <> struct interop { using type = cl_event; }; @@ -109,8 +111,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); @@ -136,12 +140,14 @@ T make(typename interop::type Interop) { } // Construction of SYCL program. +#ifdef __SYCL_INTERNAL_API template ::value> * = nullptr> T make(const context &Context, typename interop::type Interop) { return make_program(Context, detail::pi::cast(Interop)); } +#endif // Construction of SYCL queue. template struct interop { using type = ze_event_handle_t; }; +#ifdef __SYCL_INTERNAL_API template <> struct interop { using type = ze_module_handle_t; }; +#endif template struct interop &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); @@ -187,6 +191,7 @@ T make(const std::vector &DeviceList, } // Construction of SYCL program. +#ifdef __SYCL_INTERNAL_API template ::value> * = nullptr> __SYCL_DEPRECATED("Use SYCL 2020 sycl::make_kernel_bundle free function") @@ -194,6 +199,7 @@ T make(const context &Context, typename interop::type Interop) { return make_program(Context, reinterpret_cast(Interop)); } +#endif // Construction of SYCL queue. template Date: Fri, 8 Oct 2021 14:40:56 +0300 Subject: [PATCH 3/3] fix in-tree files --- sycl/test/basic_tests/interop-level-zero-2020.cpp | 11 ----------- sycl/test/warnings/spec_consts_ext_deprecation.cpp | 13 ------------- 2 files changed, 24 deletions(-) delete mode 100644 sycl/test/warnings/spec_consts_ext_deprecation.cpp diff --git a/sycl/test/basic_tests/interop-level-zero-2020.cpp b/sycl/test/basic_tests/interop-level-zero-2020.cpp index 1f9893c3079a8..4bc313fbf76c4 100644 --- a/sycl/test/basic_tests/interop-level-zero-2020.cpp +++ b/sycl/test/basic_tests/interop-level-zero-2020.cpp @@ -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 KernelBundle = get_kernel_bundle(Context); kernel Kernel = KernelBundle.get_kernel(get_kernel_ids().front()); @@ -55,9 +53,6 @@ int main() { ZeContext; backend_traits::return_type ZeQueue; backend_traits::return_type ZeEvent; - // expected-warning@+1 {{'program' is deprecated: program class is deprecated, use kernel_bundle instead}} - backend_traits::return_type - ZeProgram; backend_traits::return_type< kernel_bundle> ZeKernelBundle; @@ -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' is deprecated: Use SYCL 2020 sycl::get_native free function}} ZeEvent = Event.get_native(); - // expected-warning@+2 {{'get_native' is deprecated: Use SYCL 2020 sycl::get_native free function}} - // expected-warning@+1 {{'get_native' is deprecated: Use SYCL 2020 sycl::get_native free function}} - ZeProgram = Program.get_native(); // expected-warning@+3 {{'get_native' is deprecated: Use SYCL 2020 sycl::get_native free function}} // expected-warning@+2 {{'get_native' is deprecated: Use SYCL 2020 sycl::get_native free function}} /*ZeKernelBundle*/ ( @@ -165,9 +157,6 @@ int main() { // expected-warning@+1 {{'make' is deprecated: Use SYCL 2020 sycl::make_event free function}} auto E = ext::oneapi::level_zero::make( 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' is deprecated: Use SYCL 2020 sycl::make_kernel_bundle free function}} - auto PR = ext::oneapi::level_zero::make(Context, ZeProgram); return 0; } diff --git a/sycl/test/warnings/spec_consts_ext_deprecation.cpp b/sycl/test/warnings/spec_consts_ext_deprecation.cpp deleted file mode 100644 index f5ff97a04dfd9..0000000000000 --- a/sycl/test/warnings/spec_consts_ext_deprecation.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s -o %t.out - -#include - -using namespace sycl; - -int main() { - // expected-warning@+1 {{Specialization constats extension is deprecated, use SYCL 2020 specialization constants instead}} - ext::oneapi::experimental::spec_constant SC; - (void)SC; - return 0; -} -