diff --git a/sycl/include/CL/sycl/backend/cuda.hpp b/sycl/include/CL/sycl/backend/cuda.hpp index 08a2b80c8a073..7e6353503ab2b 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; }; @@ -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); @@ -137,12 +141,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 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 a73e8b9948a12..272c9080766d8 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; @@ -127,7 +129,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/include/sycl/ext/oneapi/backend/level_zero.hpp b/sycl/include/sycl/ext/oneapi/backend/level_zero.hpp index d12e649e2b4c1..654767b27d387 100644 --- a/sycl/include/sycl/ext/oneapi/backend/level_zero.hpp +++ b/sycl/include/sycl/ext/oneapi/backend/level_zero.hpp @@ -35,9 +35,11 @@ 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 { using type = ze_kernel_handle_t; @@ -154,8 +156,10 @@ __SYCL_EXPORT device make_device(const platform &Platform, __SYCL_EXPORT context make_context(const std::vector &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); @@ -200,6 +204,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") @@ -207,6 +212,7 @@ T make(const context &Context, typename interop::type Interop) { return make_program(Context, reinterpret_cast(Interop)); } +#endif // Construction of SYCL queue. template () 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 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/basic_tests/spec_const_types.cpp b/sycl/test/basic_tests/spec_const_types.cpp index 8e43cd66feaee..494d04e3a3cf3 100644 --- a/sycl/test/basic_tests/spec_const_types.cpp +++ b/sycl/test/basic_tests/spec_const_types.cpp @@ -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 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; -} - diff --git a/sycl/test/warnings/sycl_2020_deprecations.cpp b/sycl/test/warnings/sycl_2020_deprecations.cpp index 81c4792149c33..34c9a9fbe40c3 100644 --- a/sycl/test/warnings/sycl_2020_deprecations.cpp +++ b/sycl/test/warnings/sycl_2020_deprecations.cpp @@ -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 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