diff --git a/sycl/include/sycl/backend/opencl.hpp b/sycl/include/sycl/backend/opencl.hpp index 87edfdff2c215..f96846b1d98ce 100644 --- a/sycl/include/sycl/backend/opencl.hpp +++ b/sycl/include/sycl/backend/opencl.hpp @@ -22,10 +22,6 @@ 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); @@ -53,17 +49,6 @@ T make(typename detail::interop::type Interop) { return make_context(detail::pi::cast(Interop)); } -// Construction of SYCL program. -#ifdef __SYCL_INTERNAL_API -template ::value> * = nullptr> -__SYCL_DEPRECATED("Use SYCL 2020 sycl::make_program free function") -T make(const context &Context, - typename detail::interop::type Interop) { - return make_program(Context, detail::pi::cast(Interop)); -} -#endif - // Construction of SYCL queue. template ::value> * = nullptr> diff --git a/sycl/include/sycl/detail/backend_traits_cuda.hpp b/sycl/include/sycl/detail/backend_traits_cuda.hpp index 9969e50e221c6..e28d0538e2227 100644 --- a/sycl/include/sycl/detail/backend_traits_cuda.hpp +++ b/sycl/include/sycl/detail/backend_traits_cuda.hpp @@ -60,12 +60,6 @@ template <> struct interop { using type = CUstream; }; -#ifdef __SYCL_INTERNAL_API -template <> struct interop { - using type = CUmodule; -}; -#endif - // TODO the interops for accessor is used in the already deprecated class // interop_handler and can be removed after API cleanup. template @@ -127,16 +121,6 @@ template <> struct BackendReturn { using type = CUstream; }; -#ifdef __SYCL_INTERNAL_API -template <> struct BackendInput { - using type = CUmodule; -}; - -template <> struct BackendReturn { - using type = CUmodule; -}; -#endif - } // namespace detail } // __SYCL_INLINE_VER_NAMESPACE(_V1) } // namespace sycl diff --git a/sycl/include/sycl/detail/backend_traits_hip.hpp b/sycl/include/sycl/detail/backend_traits_hip.hpp index 143536e251e0c..087e9debc328e 100644 --- a/sycl/include/sycl/detail/backend_traits_hip.hpp +++ b/sycl/include/sycl/detail/backend_traits_hip.hpp @@ -54,12 +54,6 @@ template <> struct interop { using type = HIPstream; }; -#ifdef __SYCL_INTERNAL_API -template <> struct interop { - using type = HIPmodule; -}; -#endif - // TODO the interops for accessor is used in the already deprecated class // interop_handler and can be removed after API cleanup. template @@ -121,16 +115,6 @@ template <> struct BackendReturn { using type = HIPstream; }; -#ifdef __SYCL_INTERNAL_API -template <> struct BackendInput { - using type = HIPmodule; -}; - -template <> struct BackendReturn { - using type = HIPmodule; -}; -#endif - } // namespace detail } // __SYCL_INLINE_VER_NAMESPACE(_V1) } // namespace sycl diff --git a/sycl/include/sycl/detail/backend_traits_level_zero.hpp b/sycl/include/sycl/detail/backend_traits_level_zero.hpp index a1fdd594bcf79..22ab511f95229 100644 --- a/sycl/include/sycl/detail/backend_traits_level_zero.hpp +++ b/sycl/include/sycl/detail/backend_traits_level_zero.hpp @@ -67,12 +67,6 @@ template <> struct interop { using type = ze_driver_handle_t; }; -#ifdef __SYCL_INTERNAL_API -template <> struct interop { - using type = ze_module_handle_t; -}; -#endif - // TODO the interops for accessor is used in the already deprecated class // interop_handler and can be removed after API cleanup. template @@ -220,16 +214,6 @@ template <> struct BackendReturn { using type = ze_driver_handle_t; }; -#ifdef __SYCL_INTERNAL_API -template <> struct BackendInput { - using type = ze_module_handle_t; -}; - -template <> struct BackendReturn { - using type = ze_module_handle_t; -}; -#endif - template struct BackendInput> { struct type { diff --git a/sycl/include/sycl/detail/backend_traits_opencl.hpp b/sycl/include/sycl/detail/backend_traits_opencl.hpp index 57a8f851049ab..b943389a0c29a 100644 --- a/sycl/include/sycl/detail/backend_traits_opencl.hpp +++ b/sycl/include/sycl/detail/backend_traits_opencl.hpp @@ -50,12 +50,6 @@ template <> struct interop { using type = cl_platform_id; }; -#ifdef __SYCL_INTERNAL_API -template <> struct interop { - using type = cl_program; -}; -#endif - // TODO the interops for accessor is used in the already deprecated class // interop_handler and can be removed after API cleanup. template @@ -134,16 +128,6 @@ template <> struct BackendReturn { using type = cl_platform_id; }; -#ifdef __SYCL_INTERNAL_API -template <> struct BackendInput { - using type = cl_program; -}; - -template <> struct BackendReturn { - using type = cl_program; -}; -#endif - template struct BackendInput> { using type = cl_program; diff --git a/sycl/include/sycl/ext/oneapi/__function_pointer.hpp b/sycl/include/sycl/ext/oneapi/__function_pointer.hpp deleted file mode 100644 index ff721fc54dc41..0000000000000 --- a/sycl/include/sycl/ext/oneapi/__function_pointer.hpp +++ /dev/null @@ -1,94 +0,0 @@ -//==----------- function_pointer.hpp --- SYCL Function pointers ------------==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#pragma once - -#ifdef __SYCL_INTERNAL_API - -#include -#include -#include -#include -#include - -namespace sycl { -__SYCL_INLINE_VER_NAMESPACE(_V1) { -namespace detail { -__SYCL_EXPORT cl_ulong getDeviceFunctionPointerImpl(device &D, program &P, - const char *FuncName); -} -namespace ext { -namespace oneapi { - -// This is a preview extension implementation, intended to provide early -// access to a feature for review and community feedback. -// -// Because the interfaces defined by this header file are not final and are -// subject to change they are not intended to be used by shipping software -// products. If you are interested in using this feature in your software -// product, please let us know! - -using device_func_ptr_holder_t = cl_ulong; - -/// \brief this function performs a cast from device_func_ptr_holder_t type -/// to the provided function pointer type. -template < - class FuncType, - typename FuncPtrType = typename detail::add_pointer_t, - typename detail::enable_if_t::value, int> = 0> -inline FuncPtrType to_device_func_ptr(device_func_ptr_holder_t FptrHolder) { - return reinterpret_cast(FptrHolder); -} - -template -using enable_if_is_function_pointer_t = typename detail::enable_if_t< - std::is_pointer::value && - std::is_function::type>::value, - int>; - -/// \brief this function can be used only on host side to obtain device -/// function pointer for the specified function. -/// -/// \param F - pointer to function to make it work for SYCL Host device -/// \param FuncName - name of the function. Please note that by default names -/// of functions are mangled since SYCL is a C++. To avoid the need ot -/// specifying mangled name here, use `extern "C"` \param P - sycl::program -/// object which will be used to extract device function pointer \param D - -/// sycl::device object which will be used to extract device function pointer -/// -/// \returns device_func_ptr_holder_t object which can be used inside a device -/// code. This object must be converted back to a function pointer using -/// `to_device_func_ptr` prior to actual usage. -/// -/// Returned value is valid only within device code which was compiled for the -/// specified program and device. Returned value invalidates whenever program -/// is released or re-built -template = 0> -device_func_ptr_holder_t get_device_func_ptr(FuncType F, const char *FuncName, - program &P, device &D) { - // TODO: drop function name argument and map host function pointer directly - // to a device function pointer - if (D.is_host()) { - return reinterpret_cast(F); - } - - if (program_state::linked != P.get_state()) { - throw invalid_parameter_error( - "Program must be built before passing to get_device_func_ptr", - PI_ERROR_INVALID_OPERATION); - } - - return sycl::detail::getDeviceFunctionPointerImpl(D, P, FuncName); -} -} // namespace oneapi -} // namespace ext - -} // __SYCL_INLINE_VER_NAMESPACE(_V1) -} // namespace sycl - -#endif diff --git a/sycl/include/sycl/ext/oneapi/backend/level_zero.hpp b/sycl/include/sycl/ext/oneapi/backend/level_zero.hpp index 9bda23fcda241..1ccda09cc4f3d 100644 --- a/sycl/include/sycl/ext/oneapi/backend/level_zero.hpp +++ b/sycl/include/sycl/ext/oneapi/backend/level_zero.hpp @@ -9,7 +9,6 @@ #pragma once #include -#include #include @@ -27,10 +26,6 @@ __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_DEPRECATED("Use make_queue with device parameter") __SYCL_EXPORT queue make_queue(const context &Context, pi_native_handle InteropHandle, @@ -82,18 +77,6 @@ T make(const std::vector &DeviceList, Ownership == ownership::keep); } -// Construction of SYCL program. -#ifdef __SYCL_INTERNAL_API -template ::value> * = nullptr> -__SYCL_DEPRECATED("Use SYCL 2020 sycl::make_kernel_bundle free function") -T make(const context &Context, - typename sycl::detail::interop::type - Interop) { - return make_program(Context, reinterpret_cast(Interop)); -} -#endif - // Construction of SYCL queue. template ::value> * = nullptr> diff --git a/sycl/include/sycl/ext/oneapi/experimental/backend/backend_traits_cuda.hpp b/sycl/include/sycl/ext/oneapi/experimental/backend/backend_traits_cuda.hpp index 422738544a251..52d8cc81366dd 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/backend/backend_traits_cuda.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/backend/backend_traits_cuda.hpp @@ -59,12 +59,6 @@ template <> struct interop { using type = std::vector; }; -#ifdef __SYCL_INTERNAL_API -template <> struct interop { - using type = CUmodule; -}; -#endif - template struct BackendInput> { @@ -117,16 +111,6 @@ template <> struct BackendReturn { using type = std::vector; }; -#ifdef __SYCL_INTERNAL_API -template <> struct BackendInput { - using type = CUmodule; -}; - -template <> struct BackendReturn { - using type = CUmodule; -}; -#endif - template <> struct InteropFeatureSupportMap { static constexpr bool MakePlatform = false; static constexpr bool MakeDevice = true; diff --git a/sycl/include/sycl/ext/oneapi/experimental/spec_constant.hpp b/sycl/include/sycl/ext/oneapi/experimental/spec_constant.hpp index e587cd4cb5bff..a044772c59c3b 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/spec_constant.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/spec_constant.hpp @@ -21,7 +21,6 @@ namespace sycl { __SYCL_INLINE_VER_NAMESPACE(_V1) { -class program; namespace ext { namespace oneapi { @@ -47,7 +46,6 @@ class __SYCL2020_DEPRECATED( #else char padding[sizeof(T)]; #endif // __SYCL_DEVICE_ONLY__ - friend class sycl::program; public: template diff --git a/sycl/include/sycl/info/info_desc.hpp b/sycl/include/sycl/info/info_desc.hpp index 5bd227e5e66c4..27b1de19b6428 100644 --- a/sycl/include/sycl/info/info_desc.hpp +++ b/sycl/include/sycl/info/info_desc.hpp @@ -15,9 +15,6 @@ namespace sycl { __SYCL_INLINE_VER_NAMESPACE(_V1) { -#ifdef __SYCL_INTERNAL_API -class program; -#endif class device; class platform; class kernel_id; @@ -179,15 +176,6 @@ namespace event_profiling { } // namespace event_profiling #undef __SYCL_PARAM_TRAITS_SPEC -// Deprecated program class information desctiptors -#ifdef __SYCL_INTERNAL_API -enum class program : pi_uint32 { - context = PI_PROGRAM_INFO_CONTEXT, - devices = PI_PROGRAM_INFO_DEVICES, - reference_count = PI_PROGRAM_INFO_REFERENCE_COUNT -}; -#endif - // Provide an alias to the return type for each of the info parameters template class param_traits {}; @@ -198,11 +186,6 @@ template struct compatibility_param_traits {}; public: \ using return_type = ret_type; \ }; - -#ifdef __SYCL_INTERNAL_API -#include -#endif - #undef __SYCL_PARAM_TRAITS_SPEC } // namespace info diff --git a/sycl/include/sycl/info/kernel_traits.def b/sycl/include/sycl/info/kernel_traits.def index 4374b6235c34b..73ea6d334be06 100644 --- a/sycl/include/sycl/info/kernel_traits.def +++ b/sycl/include/sycl/info/kernel_traits.def @@ -3,6 +3,3 @@ __SYCL_PARAM_TRAITS_SPEC(kernel, attributes, std::string, PI_KERNEL_INFO_ATTRIBU __SYCL_PARAM_TRAITS_SPEC(kernel, function_name, std::string, PI_KERNEL_INFO_FUNCTION_NAME) __SYCL_PARAM_TRAITS_SPEC(kernel, reference_count, uint32_t, PI_KERNEL_INFO_REFERENCE_COUNT) __SYCL_PARAM_TRAITS_SPEC(kernel, context, sycl::context, PI_KERNEL_INFO_CONTEXT) -#ifdef __SYCL_INTERNAL_API -__SYCL_PARAM_TRAITS_SPEC(kernel, program, sycl::program, PI_KERNEL_INFO_ATTRIBUTES) -#endif diff --git a/sycl/include/sycl/info/program_traits.def b/sycl/include/sycl/info/program_traits.def deleted file mode 100644 index 0fef2533005eb..0000000000000 --- a/sycl/include/sycl/info/program_traits.def +++ /dev/null @@ -1,4 +0,0 @@ -__SYCL_PARAM_TRAITS_SPEC(program, context, sycl::context) -__SYCL_PARAM_TRAITS_SPEC(program, devices, std::vector) -__SYCL_PARAM_TRAITS_SPEC(program, reference_count, uint32_t) - diff --git a/sycl/include/sycl/kernel.hpp b/sycl/include/sycl/kernel.hpp index dc32e327b73ad..cb5fa087dcce0 100644 --- a/sycl/include/sycl/kernel.hpp +++ b/sycl/include/sycl/kernel.hpp @@ -22,9 +22,6 @@ namespace sycl { __SYCL_INLINE_VER_NAMESPACE(_V1) { // Forward declaration -#ifdef __SYCL_INTERNAL_API -class program; -#endif class context; template class backend_traits; template class kernel_bundle; @@ -128,16 +125,6 @@ class __SYCL_EXPORT kernel { /// \return a valid kernel_bundle kernel_bundle get_kernel_bundle() const; - /// Get the program that this kernel is defined for. - /// - /// The value returned must be equal to that returned by - /// 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/sycl/program.hpp b/sycl/include/sycl/program.hpp deleted file mode 100644 index 22f04e6271deb..0000000000000 --- a/sycl/include/sycl/program.hpp +++ /dev/null @@ -1,433 +0,0 @@ -//==--------------- program.hpp --- SYCL program ---------------------------==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#pragma once - -#ifdef __SYCL_INTERNAL_API - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace sycl { -__SYCL_INLINE_VER_NAMESPACE(_V1) { - -// Forward declarations -class context; -class device; -template -auto get_native(const SyclObjectT &Obj) - -> backend_return_t; - -namespace detail { -class program_impl; -} - -enum class program_state { none = 0, compiled = 1, linked = 2 }; - -/// Provides an abstraction of a SYCL program. -/// -/// \sa kernel -/// \sa queue -/// -/// \ingroup sycl_api -class __SYCL_EXPORT __SYCL2020_DEPRECATED( - "program class is deprecated, use kernel_bundle instead") program { -public: - program() = delete; - - /// Constructs an instance of SYCL program. - /// - /// The program will be created in the program_state::none state and - /// associated with the provided context and the SYCL devices that are - /// associated with the context. - /// - /// \param Context is an instance of SYCL context. - /// \param PropList is an instance of property_list. - explicit program(const context &Context, const property_list &PropList = {}); - - /// Constructs an instance of SYCL program for the provided DeviceList. - /// - /// The program will be created in the program_state::none state and - /// associated with the provided context and the SYCL devices in the provided - /// DeviceList. - /// - /// \param Context is an instance of SYCL context. - /// \param DeviceList is a list of SYCL devices. - /// \param PropList is an instance of property_list. - program(const context &Context, std::vector DeviceList, - const property_list &PropList = {}); - - /// Constructs an instance of SYCL program by linking together each SYCL - /// program instance in ProgramList. - /// - /// Each SYCL program in ProgramList must be in the program_state::compiled - /// state and must be associated with the same SYCL context. Otherwise an - /// invalid_object_error SYCL exception will be thrown. A - /// feature_not_supported exception will be thrown if any device that the - /// program is to be linked for returns false for the device information query - /// info::device::is_linker_available. - /// - /// \param ProgramList is a list of SYCL program instances. - /// \param PropList is an instance of property_list. - program(std::vector ProgramList, const property_list &PropList = {}); - - /// Constructs an instance of SYCL program by linking together each SYCL - /// program instance in ProgramList. - /// - /// Each SYCL program in ProgramList must be in the program_state::compiled - /// state and must be associated with the same SYCL context. Otherwise an - /// invalid_object_error SYCL exception will be thrown. A - /// feature_not_supported exception will be thrown if any device that the - /// program is to be linked for returns false for the device information query - /// info::device::is_linker_available. - /// - /// \param ProgramList is a list of SYCL program instances. - /// \param LinkOptions is a string containing valid OpenCL link options. - /// \param PropList is an instance of property_list. - program(std::vector ProgramList, std::string LinkOptions, - const property_list &PropList = {}); - - /// Constructs a SYCL program instance from an OpenCL cl_program. - /// - /// The state of the constructed SYCL program can be either - /// program_state::compiled or program_state::linked, depending on the state - /// of the ClProgram. Otherwise an invalid_object_error SYCL exception is - /// thrown. - /// - /// The instance of OpenCL cl_program will be retained on construction. - /// - /// \param Context is an instance of SYCL Context. - /// \param ClProgram is an instance of OpenCL cl_program. - program(const context &Context, cl_program ClProgram); - - program(const program &rhs) = default; - - program(program &&rhs) = default; - - program &operator=(const program &rhs) = default; - - program &operator=(program &&rhs) = default; - - bool operator==(const program &rhs) const { return impl == rhs.impl; } - - bool operator!=(const program &rhs) const { return impl != rhs.impl; } - - /// Checks if this program has a property of type propertyT. - /// - /// \return true if this context has a property of type propertyT. - template bool has_property() const; - - /// Gets the specified property of this program. - /// - /// Throws invalid_object_error if this program does not have a property - /// of type propertyT. - /// - /// \return a copy of the property of type propertyT. - template propertyT get_property() const; - - /// Returns a valid cl_program instance. - /// - /// The instance of cl_program will be retained before returning. - /// If the program is created for a SYCL host device, an invalid_object_error - /// exception is thrown. - /// - /// \return a valid OpenCL cl_program instance. - cl_program get() const; - - /// \return true if this SYCL program is a host program. - bool is_host() const; - - /// Compiles the SYCL kernel function into the encapsulated raw program. - /// - /// The kernel function is defined by the type KernelT. This member function - /// sets the state of this SYCL program to program_state::compiled. - /// If this program was not in the program_state::none state, - /// an invalid_object_error exception is thrown. If the compilation fails, - /// a compile_program_error SYCL exception is thrown. If any device that the - /// program is being compiled for returns false for the device information - /// query info::device::is_compiler_available, a feature_not_supported - /// exception is thrown. - /// - /// \param CompileOptions is a string of valid OpenCL compile options. - template - void compile_with_kernel_type(std::string CompileOptions = "") { - detail::OSModuleHandle M = detail::OSUtil::getOSModuleHandle( - detail::KernelInfo::getName()); - compile_with_kernel_name(detail::KernelInfo::getName(), - CompileOptions, M); - } - - /// Compiles the OpenCL C kernel function defined by source string. - /// - /// This member function sets the state of this SYCL program to - /// program_state::compiled. - /// If the program was not in the program_state::none state, - /// an invalid_object_error SYCL exception is thrown. If the compilation - /// fails, a compile_program_error SYCL exception is thrown. If any device - /// that the program is being compiled for returns false for the device - /// information query info::device::is_compiler_available, a - /// feature_not_supported SYCL exception is thrown. - /// - /// \param KernelSource is a string containing OpenCL C kernel source code. - /// \param CompileOptions is a string containing OpenCL compile options. - void compile_with_source(std::string KernelSource, - std::string CompileOptions = ""); - - /// Builds the SYCL kernel function into encapsulated raw program. - /// - /// The SYCL kernel function is defined by the type KernelT. - /// This member function sets the state of this SYCL program to - /// program_state::linked. If the program was not in the program_state::none - /// state, an invalid_object_error SYCL exception is thrown. If the - /// compilation fails, a compile_program_error SYCL exception is thrown. If - /// any device that the program is being built for returns false for the - /// device information queries info::device::is_compiler_available or - /// info::device::is_linker_available, a feature_not_supported SYCL exception - /// is thrown. - /// - /// \param BuildOptions is a string containing OpenCL compile options. - template - void build_with_kernel_type(std::string BuildOptions = "") { - detail::OSModuleHandle M = detail::OSUtil::getOSModuleHandle( - detail::KernelInfo::getName()); - build_with_kernel_name(detail::KernelInfo::getName(), BuildOptions, - M); - } - - /// Builds the OpenCL C kernel function defined by source code. - /// - /// This member function sets the state of this SYCL program to - /// program_state::linked. If this program was not in program_state::none, - /// an invalid_object_error SYCL exception is thrown. If the compilation - /// fails, a compile_program_error SYCL exception is thrown. If any device - /// that the program is being built for returns false for the device - /// information queries info::device::is_compiler_available or - /// info::device::is_linker_available, a feature_not_supported SYCL exception - /// is thrown. - /// - /// \param KernelSource is a string containing OpenCL C kernel source code. - /// \param BuildOptions is a string containing OpenCL build options. - void build_with_source(std::string KernelSource, - std::string BuildOptions = ""); - - /// Links encapsulated raw program. - /// - /// This member function sets the state of this SYCL program to - /// program_state::linked. If the program was not in the - /// program_state::compiled state, an invalid_object_error SYCL exception is - /// thrown. If linking fails, a compile_program_error is thrown. If any device - /// that the program is to be linked for returns false for the device - /// information query info::device::is_linker_available, a - /// feature_not_supported exception is thrown. - /// - /// \param LinkOptions is a string containing OpenCL link options. - void link(std::string LinkOptions = ""); - - /// Checks if kernel is available for this program. - /// - /// The SYCL kernel is defined by type KernelT. If the program state is - /// program_state::none an invalid_object_error SYCL exception is thrown. - /// - /// \return true if the SYCL kernel is available. - template bool has_kernel() const { - return has_kernel(detail::KernelInfo::getName(), - /*IsCreatedFromSource*/ false); - } - - /// Checks if kernel is available for this program. - /// - /// The SYCL kernel is defined by its name. If the program is in the - /// program_stateP::none state, an invalid_object_error SYCL exception - /// is thrown. - /// - /// \param KernelName is a string containing kernel name. - /// \return true if the SYCL kernel is available and the program is not a - /// SYCL host program. - bool has_kernel(std::string KernelName) const; - - /// Returns a SYCL kernel for the SYCL kernel function defined by KernelType. - /// - /// If program is in the program_state::none state or if the SYCL kernel - /// function is not available, an invalid_object_error exception is thrown. - /// - /// \return a valid instance of SYCL kernel. - template kernel get_kernel() const { - return get_kernel(detail::KernelInfo::getName(), - /*IsCreatedFromSource*/ false); - } - - /// Returns a SYCL kernel for the SYCL kernel function defined by KernelName. - /// - /// An invalid_object_error SYCL exception is thrown if this program is a host - /// program, if program is in the program_state::none state or if the SYCL - /// kernel is not available. - /// - /// \param KernelName is a string containing SYCL kernel name. - kernel get_kernel(std::string KernelName) const; - - /// Queries this SYCL program for information. - /// - /// The return type depends on the information being queried. - template - typename info::param_traits::return_type - get_info() const; - - /// Returns built program binaries. - /// - /// If this program is not in the program_state::compiled or - /// program_state::linked states, an invalid_object_error SYCL exception - /// is thrown. - /// - /// \return a vector of vectors representing the compiled binaries for each - /// associated SYCL device. - std::vector> get_binaries() const; - - /// \return the SYCL context that this program was constructed with. - context get_context() const; - - /// \return a vector of devices that are associated with this program. - std::vector get_devices() const; - - /// Returns compile options that were provided when the encapsulated program - /// was explicitly compiled. - /// - /// If the program was built instead of explicitly compiled, if the program - /// has not yet been compiled, or if the program has been compiled for only - /// the host device, then an empty string is return, unless the underlying - /// cl_program was explicitly compiled, in which case the compile options used - /// in the explicit compile are returned. - /// - /// \return a string of valid OpenCL compile options. - std::string get_compile_options() const; - - /// Returns compile options that were provided to the most recent invocation - /// of link member function. - /// - /// If the program has not been explicitly linked using the aforementioned - /// function, constructed with an explicitly linking constructor, or if the - /// program has been linked for only the host device, then an empty string - /// is returned. If the program was constructed from cl_program, then an - /// empty string is returned unless the cl_program was explicitly linked, - /// in which case the link options used in that explicit link are returned. - /// If the program object was constructed using a constructor form that links - /// a vector of programs, then the link options passed to this constructor - /// are returned. - /// - /// \return a string of valid OpenCL compile options. - std::string get_link_options() const; - - /// Returns the compile, link, or build options, from whichever of those - /// operations was performed most recently on the encapsulated cl_program. - /// - /// If no compile, link, or build operations have been performed on this - /// program, or if the program includes the host device in its device list, - /// then an empty string is returned. - /// - /// \return a string of valid OpenCL build options. - std::string get_build_options() const; - - /// \return the current state of this SYCL program. - program_state get_state() const; - - /// Set the value of the specialization constant identified by the 'ID' type - /// template parameter and return its instance. - /// \param cst the specialization constant value - /// \return a specialization constant instance corresponding to given type ID - /// passed as a template parameter - template - ext::oneapi::experimental::spec_constant set_spec_constant(T Cst) { - constexpr const char *Name = detail::SpecConstantInfo::getName(); - static_assert(std::is_arithmetic::value || - (std::is_class::value && std::is_pod::value), - "unsupported specialization constant type"); -#ifdef __SYCL_DEVICE_ONLY__ - (void)Cst; - (void)Name; - return ext::oneapi::experimental::spec_constant(); -#else - set_spec_constant_impl(Name, &Cst, sizeof(T)); - return ext::oneapi::experimental::spec_constant(Cst); -#endif // __SYCL_DEVICE_ONLY__ - } - - /// Returns the backend associated with this program. - /// - /// \return the backend associated with this program. - backend get_backend() const noexcept; - -private: - pi_native_handle getNative() const; - program(std::shared_ptr impl); - - /// Template-free version of get_kernel. - /// - /// \param KernelName is a stringified kernel name. - /// \param IsCreatedFromSource is a flag indicating whether this program was - /// created from OpenCL C source code string. - /// \return a valid instance of SYCL kernel. - kernel get_kernel(std::string KernelName, bool IsCreatedFromSource) const; - - /// Template-free version of has_kernel. - /// - /// \param KernelName is a stringified kernel name. - /// \param IsCreatedFromSource is a flag indicating whether this program was - /// created from OpenCL C source code string. - /// \return true if kernel with KernelName is available. - bool has_kernel(std::string KernelName, bool IsCreatedFromSource) const; - - /// Template-free version of compile_with_kernel_type. - /// - /// \param KernelName is a stringified kernel name. - /// \param CompileOptions is a string of valid OpenCL compile options. - /// \param M is a valid OS handle to the user executable or library. - void compile_with_kernel_name(std::string KernelName, - std::string CompileOptions, - detail::OSModuleHandle M); - - /// Template-free version of build_with_kernel_type. - /// - /// \param KernelName is a stringified kernel name. - /// \param CompileOptions is a string of valid OpenCL compile options. - /// \param M is a valid OS handle to the user executable or library. - void build_with_kernel_name(std::string KernelName, std::string buildOptions, - detail::OSModuleHandle M); - - void set_spec_constant_impl(const char *Name, void *Data, size_t Size); - - std::shared_ptr impl; - - template - friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject); - template - friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj); - template - friend auto get_native(const SyclObjectT &Obj) - -> backend_return_t; -}; -} // __SYCL_INLINE_VER_NAMESPACE(_V1) -} // namespace sycl - -namespace std { -template <> struct hash { - size_t operator()(const sycl::program &prg) const { - return hash>()( - sycl::detail::getSyclObjImpl(prg)); - } -}; -} // namespace std - -#endif diff --git a/sycl/include/sycl/sycl.hpp b/sycl/include/sycl/sycl.hpp index efe6d10ccc625..5dc57176d69e5 100644 --- a/sycl/include/sycl/sycl.hpp +++ b/sycl/include/sycl/sycl.hpp @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include diff --git a/sycl/source/CMakeLists.txt b/sycl/source/CMakeLists.txt index 11f997a543fc8..d81f34c127500 100644 --- a/sycl/source/CMakeLists.txt +++ b/sycl/source/CMakeLists.txt @@ -171,7 +171,6 @@ set(SYCL_SOURCES "event.cpp" "exception.cpp" "exception_list.cpp" - "function_pointer.cpp" "handler.cpp" "image.cpp" "interop_handle.cpp" @@ -179,7 +178,6 @@ set(SYCL_SOURCES "kernel.cpp" "kernel_bundle.cpp" "platform.cpp" - "program.cpp" "queue.cpp" "sampler.cpp" "stream.cpp" diff --git a/sycl/source/backend/level_zero.cpp b/sycl/source/backend/level_zero.cpp index e5b6c87a1f5b9..85bd5ffe5c0a1 100644 --- a/sycl/source/backend/level_zero.cpp +++ b/sycl/source/backend/level_zero.cpp @@ -61,17 +61,6 @@ __SYCL_EXPORT context make_context(const std::vector &DeviceList, std::make_shared(PiContext, async_handler{}, Plugin)); } -//---------------------------------------------------------------------------- -// Implementation of level_zero::make -__SYCL_EXPORT program make_program(const context &Context, - pi_native_handle NativeHandle) { - // Construct the SYCL program from native program. - // TODO: move here the code that creates PI program, and remove the - // native interop constructor. - return detail::createSyclObjFromImpl( - std::make_shared(getSyclObjImpl(Context), NativeHandle)); -} - //---------------------------------------------------------------------------- // Implementation of level_zero::make __SYCL_EXPORT queue make_queue(const context &Context, diff --git a/sycl/source/backend/opencl.cpp b/sycl/source/backend/opencl.cpp index 5a2a9baaac814..0b6ab00116dbf 100644 --- a/sycl/source/backend/opencl.cpp +++ b/sycl/source/backend/opencl.cpp @@ -36,17 +36,6 @@ __SYCL_EXPORT context make_context(pi_native_handle NativeHandle) { return detail::make_context(NativeHandle, async_handler{}, backend::opencl); } -//---------------------------------------------------------------------------- -// Implementation of opencl::make -__SYCL_EXPORT program make_program(const context &Context, - pi_native_handle NativeHandle) { - // Construct the SYCL program from native program. - // TODO: move here the code that creates PI program, and remove the - // native interop constructor. - return detail::createSyclObjFromImpl( - std::make_shared(getSyclObjImpl(Context), NativeHandle)); -} - //---------------------------------------------------------------------------- // Implementation of opencl::make __SYCL_EXPORT queue make_queue(const context &Context, diff --git a/sycl/source/detail/kernel_impl.hpp b/sycl/source/detail/kernel_impl.hpp index 063febf9cc7d6..1da7c4146dd09 100644 --- a/sycl/source/detail/kernel_impl.hpp +++ b/sycl/source/detail/kernel_impl.hpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -172,6 +171,8 @@ class kernel_impl { bool isInterop() const { return MIsInterop; } + ProgramImplPtr getProgramImpl() const { return MProgramImpl; } + private: RT::PiKernel MKernel; const ContextImplPtr MContext; @@ -198,13 +199,6 @@ 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 Param::return_type kernel_impl::get_info(const device &Device) const { diff --git a/sycl/source/detail/program_impl.cpp b/sycl/source/detail/program_impl.cpp index cc953df4cc3ca..17e36a59e35c3 100644 --- a/sycl/source/detail/program_impl.cpp +++ b/sycl/source/detail/program_impl.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -504,29 +505,6 @@ void program_impl::create_pi_program_with_kernel_name( MProgram = PM.createPIProgram(Img, get_context(), {FirstDevice}); } -template <> -uint32_t program_impl::get_info() const { - if (is_host()) { - throw invalid_object_error("This instance of program is a host instance", - PI_ERROR_INVALID_PROGRAM); - } - pi_uint32 Result; - const detail::plugin &Plugin = getPlugin(); - Plugin.call(MProgram, - PI_PROGRAM_INFO_REFERENCE_COUNT, - sizeof(pi_uint32), &Result, nullptr); - return Result; -} - -template <> context program_impl::get_info() const { - return get_context(); -} - -template <> -std::vector program_impl::get_info() const { - return get_devices(); -} - void program_impl::set_spec_constant_impl(const char *Name, const void *ValAddr, size_t ValSize) { if (MState != program_state::none) diff --git a/sycl/source/detail/program_impl.hpp b/sycl/source/detail/program_impl.hpp index 012d5ae9c02aa..04a785d261102 100644 --- a/sycl/source/detail/program_impl.hpp +++ b/sycl/source/detail/program_impl.hpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -34,6 +33,8 @@ namespace detail { using ContextImplPtr = std::shared_ptr; +enum class program_state { none = 0, compiled = 1, linked = 2 }; + class program_impl { public: program_impl() = delete; @@ -238,13 +239,6 @@ class program_impl { std::shared_ptr PtrToSelf, bool IsCreatedFromSource) const; - /// Queries this SYCL program for information. - /// - /// The return type depends on the information being queried. - template - typename info::param_traits::return_type - get_info() const; - /// Returns built program binaries. /// /// If this program is not in the program_state::compiled or @@ -454,14 +448,6 @@ class program_impl { bool MIsInterop = false; }; -template <> -uint32_t program_impl::get_info() const; - -template <> context program_impl::get_info() const; - -template <> -std::vector program_impl::get_info() const; - } // namespace detail } // __SYCL_INLINE_VER_NAMESPACE(_V1) } // namespace sycl diff --git a/sycl/source/detail/scheduler/commands.cpp b/sycl/source/detail/scheduler/commands.cpp index 800fa40490015..ec83d84dd1395 100644 --- a/sycl/source/detail/scheduler/commands.cpp +++ b/sycl/source/detail/scheduler/commands.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -1849,8 +1848,7 @@ void ExecCGCommand::emitInstrumentationData() { ->getDeviceImage() ->get_program_ref(); } else if (nullptr != KernelCG->MSyclKernel) { - auto SyclProg = detail::getSyclObjImpl( - KernelCG->MSyclKernel->get_info()); + auto SyclProg = KernelCG->MSyclKernel->getProgramImpl(); Program = SyclProg->getHandleRef(); } else { std::tie(Kernel, KernelMutex, Program) = @@ -2148,9 +2146,7 @@ pi_int32 enqueueImpKernel( assert(MSyclKernel->get_info() == Queue->get_context()); Kernel = MSyclKernel->getHandleRef(); - - auto SyclProg = - detail::getSyclObjImpl(MSyclKernel->get_info()); + auto SyclProg = MSyclKernel->getProgramImpl(); Program = SyclProg->getHandleRef(); if (SyclProg->is_cacheable()) { RT::PiKernel FoundKernel = nullptr; diff --git a/sycl/source/function_pointer.cpp b/sycl/source/function_pointer.cpp deleted file mode 100644 index cea690cf726fd..0000000000000 --- a/sycl/source/function_pointer.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//==----------- function_pointer.cpp --- SYCL Function pointers ------------==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include -#include -#include - -namespace sycl { -__SYCL_INLINE_VER_NAMESPACE(_V1) { -namespace detail { -ext::oneapi::device_func_ptr_holder_t -getDeviceFunctionPointerImpl(device &D, program &P, const char *FuncName) { - ext::oneapi::device_func_ptr_holder_t FPtr = 0; - - const detail::plugin &Plugin = detail::getSyclObjImpl(P)->getPlugin(); - pi_result Result = Plugin.call_nocheck< - sycl::detail::PiApiKind::piextGetDeviceFunctionPointer>( - detail::pi::cast(detail::getSyclObjImpl(D)->getHandleRef()), - detail::pi::cast(detail::getSyclObjImpl(P)->getHandleRef()), - FuncName, &FPtr); - // If extension is not supported, a fallback method is used which returns - // if the function exists or not. If the return address is not valid throw - // error. - if (Result != PI_SUCCESS) { - if (Result == PI_ERROR_FUNCTION_ADDRESS_IS_NOT_AVAILABLE) - throw runtime_error("Function exists but address is not available", - Result); - if (Result == PI_ERROR_INVALID_KERNEL_NAME) - throw runtime_error("Function name is not valid", Result); - else - throw runtime_error("piextGetDeviceFunctionPointer returned error when " - "retrieving address", - Result); - } - - return FPtr; -} - -} // namespace detail -} // __SYCL_INLINE_VER_NAMESPACE(_V1) -} // namespace sycl diff --git a/sycl/source/kernel.cpp b/sycl/source/kernel.cpp index 18d44bcc30d55..181114219c62d 100644 --- a/sycl/source/kernel.cpp +++ b/sycl/source/kernel.cpp @@ -12,7 +12,6 @@ #include #include #include -#include namespace sycl { __SYCL_INLINE_VER_NAMESPACE(_V1) { @@ -38,10 +37,6 @@ kernel::get_kernel_bundle() const { kernel_bundle>(impl->get_kernel_bundle()); } -program kernel::get_program() const { - return impl->get_info(); -} - template typename detail::is_kernel_info_desc::return_type kernel::get_info() const { diff --git a/sycl/source/program.cpp b/sycl/source/program.cpp deleted file mode 100644 index 6e5f10958ac59..0000000000000 --- a/sycl/source/program.cpp +++ /dev/null @@ -1,163 +0,0 @@ -//==--------------- program.cpp --- SYCL program ---------------------------==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include -#include -#include -#include -#include - -#include - -namespace sycl { -__SYCL_INLINE_VER_NAMESPACE(_V1) { - -program::program(const context &context, const property_list &PropList) - : impl(std::make_shared( - detail::getSyclObjImpl(context), PropList)) {} - -program::program(const context &context, std::vector deviceList, - const property_list &PropList) - : impl(std::make_shared( - detail::getSyclObjImpl(context), deviceList, PropList)) {} - -program::program(std::vector programList, - const property_list &PropList) - : program(std::move(programList), /*linkOptions=*/"", PropList) {} - -program::program(std::vector programList, std::string linkOptions, - const property_list &PropList) { - std::vector> impls; - for (auto &x : programList) { - impls.push_back(detail::getSyclObjImpl(x)); - } - impl = std::make_shared(impls, linkOptions, PropList); -} - -program::program(const context &context, cl_program clProgram) - : impl(std::make_shared( - detail::getSyclObjImpl(context), - detail::pi::cast(clProgram))) { - // The implementation constructor takes ownership of the native handle so we - // must retain it in order to adhere to SYCL 1.2.1 spec (Rev6, section 4.3.1.) - impl->getPlugin().call( - impl->getHandleRef()); -} - -backend program::get_backend() const noexcept { return getImplBackend(impl); } - -pi_native_handle program::getNative() const { return impl->getNative(); } - -program::program(std::shared_ptr impl) : impl(impl) {} - -cl_program program::get() const { return impl->get(); } - -bool program::is_host() const { return impl->is_host(); } - -void program::compile_with_source(std::string kernelSource, - std::string compileOptions) { - impl->compile_with_source(kernelSource, compileOptions); -} - -void program::build_with_source(std::string kernelSource, - std::string buildOptions) { - impl->build_with_source(kernelSource, buildOptions); -} - -void program::compile_with_kernel_name(std::string KernelName, - std::string compileOptions, - detail::OSModuleHandle M) { - impl->compile_with_kernel_name(KernelName, compileOptions, M); -} - -void program::build_with_kernel_name(std::string KernelName, - std::string buildOptions, - detail::OSModuleHandle M) { - impl->build_with_kernel_name(KernelName, buildOptions, M); -} - -void program::link(std::string linkOptions) { impl->link(linkOptions); } - -bool program::has_kernel(std::string kernelName) const { - return has_kernel(kernelName, /*IsCreatedFromSource*/ true); -} - -bool program::has_kernel(std::string kernelName, - bool IsCreatedFromSource) const { - return impl->has_kernel(kernelName, IsCreatedFromSource); -} - -kernel program::get_kernel(std::string kernelName) const { - return get_kernel(kernelName, /*IsCreatedFromSource*/ true); -} - -kernel program::get_kernel(std::string kernelName, - bool IsCreatedFromSource) const { - return impl->get_kernel(kernelName, impl, IsCreatedFromSource); -} - -template -typename info::param_traits::return_type -program::get_info() const { - return impl->get_info(); -} - -#define __SYCL_PARAM_TRAITS_SPEC(param_type, param, ret_type) \ - template __SYCL_EXPORT ret_type program::get_info() \ - const; - -#include - -#undef __SYCL_PARAM_TRAITS_SPEC - -#define __SYCL_PARAM_TRAITS_SPEC(param_type) \ - template <> __SYCL_EXPORT bool program::has_property() const { \ - return impl->has_property(); \ - } -#include - -#undef __SYCL_PARAM_TRAITS_SPEC - -#define __SYCL_PARAM_TRAITS_SPEC(param_type) \ - template <> \ - __SYCL_EXPORT param_type program::get_property() const { \ - return impl->get_property(); \ - } -#include - -#undef __SYCL_PARAM_TRAITS_SPEC - -std::vector> program::get_binaries() const { - return impl->get_binaries(); -} - -context program::get_context() const { return impl->get_context(); } - -std::vector program::get_devices() const { return impl->get_devices(); } - -std::string program::get_compile_options() const { - return impl->get_compile_options(); -} - -std::string program::get_link_options() const { - return impl->get_link_options(); -} - -std::string program::get_build_options() const { - return impl->get_build_options(); -} - -program_state program::get_state() const { return impl->get_state(); } - -void program::set_spec_constant_impl(const char *Name, void *Data, - size_t Size) { - impl->set_spec_constant_impl(Name, Data, Size); -} - -} // __SYCL_INLINE_VER_NAMESPACE(_V1) -} // namespace sycl diff --git a/sycl/test/abi/sycl_symbols_linux.dump b/sycl/test/abi/sycl_symbols_linux.dump index 19b1874b9effb..91b283c1eef69 100644 --- a/sycl/test/abi/sycl_symbols_linux.dump +++ b/sycl/test/abi/sycl_symbols_linux.dump @@ -3658,7 +3658,6 @@ _ZN4sycl3_V13ext6oneapi10level_zero10make_queueERKNS0_7contextERKNS0_6deviceEmb _ZN4sycl3_V13ext6oneapi10level_zero10make_queueERKNS0_7contextEmb _ZN4sycl3_V13ext6oneapi10level_zero11make_deviceERKNS0_8platformEm _ZN4sycl3_V13ext6oneapi10level_zero12make_contextERKSt6vectorINS0_6deviceESaIS5_EEmb -_ZN4sycl3_V13ext6oneapi10level_zero12make_programERKNS0_7contextEm _ZN4sycl3_V13ext6oneapi10level_zero13make_platformEm _ZN4sycl3_V13ext6oneapi15filter_selectorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE _ZN4sycl3_V13ext6oneapi15filter_selectorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE @@ -3848,7 +3847,6 @@ _ZN4sycl3_V16detail23constructorNotificationEPvS2_NS0_6access6targetENS3_4modeER _ZN4sycl3_V16detail23getESIMDDeviceInterfaceEv _ZN4sycl3_V16detail24find_device_intersectionERKSt6vectorINS0_13kernel_bundleILNS0_12bundle_stateE1EEESaIS5_EE _ZN4sycl3_V16detail27getPixelCoordLinearFiltModeENS0_3vecIfLi4EEENS0_15addressing_modeENS0_5rangeILi3EEERS3_ -_ZN4sycl3_V16detail28getDeviceFunctionPointerImplERNS0_6deviceERNS0_7programEPKc _ZN4sycl3_V16detail28getPixelCoordNearestFiltModeENS0_3vecIfLi4EEENS0_15addressing_modeENS0_5rangeILi3EEE _ZN4sycl3_V16detail2pi25contextSetExtendedDeleterERKNS0_7contextEPFvPvES6_ _ZN4sycl3_V16detail2pi3dieEPKc @@ -3887,7 +3885,6 @@ _ZN4sycl3_V16mallocEmRKNS0_6deviceERKNS0_7contextENS0_3usm5allocERKNS0_6detail13 _ZN4sycl3_V16opencl10make_queueERKNS0_7contextEm _ZN4sycl3_V16opencl11make_deviceEm _ZN4sycl3_V16opencl12make_contextEm -_ZN4sycl3_V16opencl12make_programERKNS0_7contextEm _ZN4sycl3_V16opencl13make_platformEm _ZN4sycl3_V16streamC1EmmRNS0_7handlerE _ZN4sycl3_V16streamC1EmmRNS0_7handlerERKNS0_13property_listE @@ -3941,24 +3938,6 @@ _ZN4sycl3_V17handlerC1ESt10shared_ptrINS0_6detail10queue_implEES5_S5_b _ZN4sycl3_V17handlerC1ESt10shared_ptrINS0_6detail10queue_implEEb _ZN4sycl3_V17handlerC2ESt10shared_ptrINS0_6detail10queue_implEES5_S5_b _ZN4sycl3_V17handlerC2ESt10shared_ptrINS0_6detail10queue_implEEb -_ZN4sycl3_V17program17build_with_sourceENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_ -_ZN4sycl3_V17program19compile_with_sourceENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_ -_ZN4sycl3_V17program22build_with_kernel_nameENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_l -_ZN4sycl3_V17program22set_spec_constant_implEPKcPvm -_ZN4sycl3_V17program24compile_with_kernel_nameENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_l -_ZN4sycl3_V17program4linkENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE -_ZN4sycl3_V17programC1ERKNS0_7contextEP11_cl_program -_ZN4sycl3_V17programC1ERKNS0_7contextERKNS0_13property_listE -_ZN4sycl3_V17programC1ERKNS0_7contextESt6vectorINS0_6deviceESaIS6_EERKNS0_13property_listE -_ZN4sycl3_V17programC1ESt10shared_ptrINS0_6detail12program_implEE -_ZN4sycl3_V17programC1ESt6vectorIS1_SaIS1_EENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS0_13property_listE -_ZN4sycl3_V17programC1ESt6vectorIS1_SaIS1_EERKNS0_13property_listE -_ZN4sycl3_V17programC2ERKNS0_7contextEP11_cl_program -_ZN4sycl3_V17programC2ERKNS0_7contextERKNS0_13property_listE -_ZN4sycl3_V17programC2ERKNS0_7contextESt6vectorINS0_6deviceESaIS6_EERKNS0_13property_listE -_ZN4sycl3_V17programC2ESt10shared_ptrINS0_6detail12program_implEE -_ZN4sycl3_V17programC2ESt6vectorIS1_SaIS1_EENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS0_13property_listE -_ZN4sycl3_V17programC2ESt6vectorIS1_SaIS1_EERKNS0_13property_listE _ZN4sycl3_V17samplerC1ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeERKNS0_13property_listE _ZN4sycl3_V17samplerC1EP11_cl_samplerRKNS0_7contextE _ZN4sycl3_V17samplerC2ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeERKNS0_13property_listE @@ -4261,7 +4240,6 @@ _ZNK4sycl3_V16device8get_infoINS0_4info6device9vendor_idEEENS0_6detail19is_devic _ZNK4sycl3_V16device9getNativeEv _ZNK4sycl3_V16kernel11get_backendEv _ZNK4sycl3_V16kernel11get_contextEv -_ZNK4sycl3_V16kernel11get_programEv _ZNK4sycl3_V16kernel13getNativeImplEv _ZNK4sycl3_V16kernel17get_kernel_bundleEv _ZNK4sycl3_V16kernel3getEv @@ -4280,7 +4258,6 @@ _ZNK4sycl3_V16kernel8get_infoINS0_4info6kernel10attributesEEENS0_6detail19is_ker _ZNK4sycl3_V16kernel8get_infoINS0_4info6kernel13function_nameEEENS0_6detail19is_kernel_info_descIT_E11return_typeEv _ZNK4sycl3_V16kernel8get_infoINS0_4info6kernel15reference_countEEENS0_6detail19is_kernel_info_descIT_E11return_typeEv _ZNK4sycl3_V16kernel8get_infoINS0_4info6kernel7contextEEENS0_6detail19is_kernel_info_descIT_E11return_typeEv -_ZNK4sycl3_V16kernel8get_infoINS0_4info6kernel7programEEENS0_6detail19is_kernel_info_descIT_E11return_typeEv _ZNK4sycl3_V16kernel8get_infoINS0_4info6kernel8num_argsEEENS0_6detail19is_kernel_info_descIT_E11return_typeEv _ZNK4sycl3_V16kernel9getNativeEv _ZNK4sycl3_V16stream12get_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEET_v @@ -4352,50 +4329,6 @@ _ZNK4sycl3_V17context8get_infoINS0_4info7context8platformEEENS0_6detail20is_cont _ZNK4sycl3_V17context9getNativeEv _ZNK4sycl3_V17handler27isStateExplicitKernelBundleEv _ZNK4sycl3_V17handler30getOrInsertHandlerKernelBundleEb -_ZNK4sycl3_V17program10get_kernelENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE -_ZNK4sycl3_V17program10get_kernelENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb -_ZNK4sycl3_V17program10has_kernelENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE -_ZNK4sycl3_V17program10has_kernelENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb -_ZNK4sycl3_V17program11get_backendEv -_ZNK4sycl3_V17program11get_contextEv -_ZNK4sycl3_V17program11get_devicesEv -_ZNK4sycl3_V17program12get_binariesEv -_ZNK4sycl3_V17program12get_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEET_v -_ZNK4sycl3_V17program12get_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEET_v -_ZNK4sycl3_V17program12get_propertyINS0_8property5image12use_host_ptrEEET_v -_ZNK4sycl3_V17program12get_propertyINS0_8property5image13context_boundEEET_v -_ZNK4sycl3_V17program12get_propertyINS0_8property5image9use_mutexEEET_v -_ZNK4sycl3_V17program12get_propertyINS0_8property5queue8in_orderEEET_v -_ZNK4sycl3_V17program12get_propertyINS0_8property6buffer12use_host_ptrEEET_v -_ZNK4sycl3_V17program12get_propertyINS0_8property6buffer13context_boundEEET_v -_ZNK4sycl3_V17program12get_propertyINS0_8property6buffer9use_mutexEEET_v -_ZNK4sycl3_V17program12get_propertyINS0_8property6noinitEEET_v -_ZNK4sycl3_V17program12get_propertyINS0_8property7context4cuda19use_primary_contextEEET_v -_ZNK4sycl3_V17program12get_propertyINS0_8property7no_initEEET_v -_ZNK4sycl3_V17program12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v -_ZNK4sycl3_V17program12has_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEEbv -_ZNK4sycl3_V17program12has_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEEbv -_ZNK4sycl3_V17program12has_propertyINS0_8property5image12use_host_ptrEEEbv -_ZNK4sycl3_V17program12has_propertyINS0_8property5image13context_boundEEEbv -_ZNK4sycl3_V17program12has_propertyINS0_8property5image9use_mutexEEEbv -_ZNK4sycl3_V17program12has_propertyINS0_8property5queue8in_orderEEEbv -_ZNK4sycl3_V17program12has_propertyINS0_8property6buffer12use_host_ptrEEEbv -_ZNK4sycl3_V17program12has_propertyINS0_8property6buffer13context_boundEEEbv -_ZNK4sycl3_V17program12has_propertyINS0_8property6buffer9use_mutexEEEbv -_ZNK4sycl3_V17program12has_propertyINS0_8property6noinitEEEbv -_ZNK4sycl3_V17program12has_propertyINS0_8property7context4cuda19use_primary_contextEEEbv -_ZNK4sycl3_V17program12has_propertyINS0_8property7no_initEEEbv -_ZNK4sycl3_V17program12has_propertyINS0_8property9reduction22initialize_to_identityEEEbv -_ZNK4sycl3_V17program16get_link_optionsB5cxx11Ev -_ZNK4sycl3_V17program17get_build_optionsB5cxx11Ev -_ZNK4sycl3_V17program19get_compile_optionsB5cxx11Ev -_ZNK4sycl3_V17program3getEv -_ZNK4sycl3_V17program7is_hostEv -_ZNK4sycl3_V17program8get_infoILNS0_4info7programE4448EEENS3_12param_traitsIS4_XT_EE11return_typeEv -_ZNK4sycl3_V17program8get_infoILNS0_4info7programE4449EEENS3_12param_traitsIS4_XT_EE11return_typeEv -_ZNK4sycl3_V17program8get_infoILNS0_4info7programE4451EEENS3_12param_traitsIS4_XT_EE11return_typeEv -_ZNK4sycl3_V17program9getNativeEv -_ZNK4sycl3_V17program9get_stateEv _ZNK4sycl3_V17sampler12get_propertyINS0_3ext6oneapi4cuda8property7context19use_primary_contextEEET_v _ZNK4sycl3_V17sampler12get_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEET_v _ZNK4sycl3_V17sampler12get_propertyINS0_8property5image12use_host_ptrEEET_v diff --git a/sycl/test/abi/symbol_size_alignment.cpp b/sycl/test/abi/symbol_size_alignment.cpp index 5503750e23b7a..c681df3434c90 100644 --- a/sycl/test/abi/symbol_size_alignment.cpp +++ b/sycl/test/abi/symbol_size_alignment.cpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -67,7 +66,6 @@ int main() { check, 4, 4>(); check(); #endif - check(); check, 8, 8>(); check(); check(); diff --git a/sycl/test/abi/user_mangling.cpp b/sycl/test/abi/user_mangling.cpp index 2efb0330e8409..1be2023b935d8 100644 --- a/sycl/test/abi/user_mangling.cpp +++ b/sycl/test/abi/user_mangling.cpp @@ -97,9 +97,6 @@ void sampler(sycl::sampler) {} // CHK-HOST: define dso_local void @_Z5queueN4sycl3_V15queueE({{.*}}) void queue(sycl::queue) {} -// CHK-HOST: define dso_local void @_Z7programN4sycl3_V17programE({{.*}}) -void program(sycl::program) {} - // CHK-HOST: define dso_local void @_Z6kernelN4sycl3_V16kernelE({{.*}}) void kernel(sycl::kernel) {} diff --git a/sycl/test/basic_tests/spec_const_types.cpp b/sycl/test/basic_tests/spec_const_types.cpp deleted file mode 100644 index add47f35bf1ca..0000000000000 --- a/sycl/test/basic_tests/spec_const_types.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// 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 -// -//==----------- spec_const.cpp ---------------------------------------------==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// The test checks that the tool chain correctly identifies all specialization -// constants, emits correct specialization constats map file and can properly -// translate the resulting bitcode to SPIR-V. - -#include - -#include -#include - -class SpecializedKernel; -class MyBoolConst; -class MyInt8Const; -class MyUInt8Const; -class MyInt16Const; -class MyUInt16Const; -class MyInt32Const; -class MyUInt32Const; -class MyInt64Const; -class MyUInt64Const; - -class MyHalfConst; -class MyFloatConst; -class MyDoubleConst; - -// Fetch a value at runtime. -int8_t get_value(); - -int main() { - sycl::queue queue; - sycl::program program(queue.get_context()); - - // Create specialization constants. - sycl::ext::oneapi::experimental::spec_constant i1 = - program.set_spec_constant((bool)get_value()); - // CHECK-DAG: _ZTS11MyBoolConst=2| - - sycl::ext::oneapi::experimental::spec_constant i8 = - program.set_spec_constant((int8_t)get_value()); - // CHECK-DAG: _ZTS11MyInt8Const=2| - sycl::ext::oneapi::experimental::spec_constant ui8 = - program.set_spec_constant((uint8_t)get_value()); - // CHECK-DAG: _ZTS12MyUInt8Const=2| - - sycl::ext::oneapi::experimental::spec_constant i16 = - program.set_spec_constant((int16_t)get_value()); - // CHECK-DAG: _ZTS12MyInt16Const=2| - sycl::ext::oneapi::experimental::spec_constant ui16 = - program.set_spec_constant((uint16_t)get_value()); - // CHECK-DAG: _ZTS13MyUInt16Const=2| - - sycl::ext::oneapi::experimental::spec_constant i32 = - program.set_spec_constant((int32_t)get_value()); - // CHECK-DAG: _ZTS12MyInt32Const=2| - sycl::ext::oneapi::experimental::spec_constant ui32 = - program.set_spec_constant((uint32_t)get_value()); - // CHECK-DAG: _ZTS13MyUInt32Const=2| - - sycl::ext::oneapi::experimental::spec_constant i64 = - program.set_spec_constant((int64_t)get_value()); - // CHECK-DAG: _ZTS12MyInt64Const=2| - sycl::ext::oneapi::experimental::spec_constant ui64 = - program.set_spec_constant((uint64_t)get_value()); - // CHECK-DAG: _ZTS13MyUInt64Const=2| - -#define HALF 0 // TODO not yet supported -#if HALF - sycl::ext::oneapi::experimental::spec_constant f16 = - program.set_spec_constant((sycl::half)get_value()); -#endif - - sycl::ext::oneapi::experimental::spec_constant f32 = - program.set_spec_constant((float)get_value()); - // CHECK-DAG: _ZTS12MyFloatConst=2| - - sycl::ext::oneapi::experimental::spec_constant f64 = - program.set_spec_constant((double)get_value()); - // CHECK-DAG: _ZTS13MyDoubleConst=2| - - program.build_with_kernel_type(); - - std::vector vec(1); - { - sycl::buffer buf(vec.data(), vec.size()); - - queue.submit([&](sycl::handler &cgh) { - auto acc = buf.get_access(cgh); - cgh.single_task( - program.get_kernel(), [=]() { - acc[0] = i1.get() + i8.get() + ui8.get() + i16.get() + ui16.get() + - i32.get() + ui32.get() + i64.get() + ui64.get() + -#if HALF - f16.get() + -#endif - f32.get() + f64.get(); - }); - }); - } -} diff --git a/sycl/test/warnings/sycl_2020_deprecations.cpp b/sycl/test/warnings/sycl_2020_deprecations.cpp index 674637c6b1fb7..b8f78b57c9cdd 100644 --- a/sycl/test/warnings/sycl_2020_deprecations.cpp +++ b/sycl/test/warnings/sycl_2020_deprecations.cpp @@ -58,9 +58,6 @@ int main() { // expected-error@+1 {{no member named 'get' in 'sycl::kernel'}} (void)Kernel.get(); - // expected-error@+1 {{no type named 'program' in namespace 'sycl'}} - sycl::program Prog{Ctx}; - sycl::buffer Buffer(4); // expected-warning@+1{{'get_count' is deprecated: get_count() is deprecated, please use size() instead}} size_t BufferGetCount = Buffer.get_count(); diff --git a/sycl/unittests/SYCL2020/GetNativeOpenCL.cpp b/sycl/unittests/SYCL2020/GetNativeOpenCL.cpp index 42fd2acbf76d4..e930139ff2ca3 100644 --- a/sycl/unittests/SYCL2020/GetNativeOpenCL.cpp +++ b/sycl/unittests/SYCL2020/GetNativeOpenCL.cpp @@ -115,9 +115,6 @@ TEST(GetNative, GetNativeHandle) { context Context(Plt); queue Queue(Context, Selector); - program Program{Context}; - Program.build_with_source(""); - auto Device = Queue.get_device(); unsigned char *HostAlloc = (unsigned char *)malloc_host(1, Context); @@ -133,13 +130,12 @@ TEST(GetNative, GetNativeHandle) { get_native(Context); get_native(Queue); - get_native(Program); get_native(Device); get_native(Event); get_native(Buffer); // Depending on global caches state, piDeviceRetain is called either once or - // twice, so there'll be 6 or 7 calls. - ASSERT_EQ(TestCounter, 6 + DeviceRetainCounter - 1) + // twice, so there'll be 5 or 6 calls. + ASSERT_EQ(TestCounter, 5 + DeviceRetainCounter - 1) << "Not all the retain methods were called"; } diff --git a/sycl/unittests/assert/assert.cpp b/sycl/unittests/assert/assert.cpp index 642d5895a58cf..66e1b4d587c67 100644 --- a/sycl/unittests/assert/assert.cpp +++ b/sycl/unittests/assert/assert.cpp @@ -647,59 +647,3 @@ TEST(Assert, TestInteropKernelFromProgramNegative) { EXPECT_EQ(TestInteropKernel::KernelLaunchCounter, KernelLaunchCounterBase + 1); } - -TEST(Assert, TestKernelFromSourceNegative) { - sycl::platform Plt{sycl::default_selector()}; - - if (Plt.is_host()) { - printf("Test is not supported on host, skipping\n"); - return; - } - - const sycl::backend Backend = Plt.get_backend(); - - if (Backend == sycl::backend::ext_oneapi_cuda || - Backend == sycl::backend::ext_oneapi_hip || - Backend == sycl::backend::ext_oneapi_level_zero) { - printf( - "Test is not supported on CUDA, HIP, Level Zero platforms, skipping\n"); - return; - } - - sycl::unittest::PiMock Mock{Plt}; - - constexpr size_t Size = 16; - std::array Data; - - for (size_t I = 0; I < Size; I++) { - Data[I] = I; - } - - sycl::buffer Buf{Data}; - - const sycl::device Dev = Plt.get_devices()[0]; - sycl::queue Queue{Dev}; - - sycl::context Ctx = Queue.get_context(); - - setupMockForInterop(Mock, Ctx, Dev); - - sycl::program P{Queue.get_context()}; - P.build_with_source(R"CLC( - kernel void add(global int* data) { - int index = get_global_id(0); - data[index] = data[index] + 1; - } - )CLC", - "-cl-fast-relaxed-math"); - - Queue.submit([&](sycl::handler &H) { - auto Acc = Buf.get_access(H); - - H.set_args(Acc); - H.parallel_for(Size, P.get_kernel("add")); - }); - - EXPECT_EQ(TestInteropKernel::KernelLaunchCounter, - KernelLaunchCounterBase + 1); -} diff --git a/sycl/unittests/kernel-and-program/Cache.cpp b/sycl/unittests/kernel-and-program/Cache.cpp index 00f5d18c71924..4f1243561f14c 100644 --- a/sycl/unittests/kernel-and-program/Cache.cpp +++ b/sycl/unittests/kernel-and-program/Cache.cpp @@ -6,6 +6,9 @@ // //===----------------------------------------------------------------------===// +// All these tests are temporarily disabled, since they need to be rewrited +// after the sycl::program class removal to use the kernel_bundle instead. + #define SYCL2020_DISABLE_DEPRECATION_WARNINGS #include "detail/context_impl.hpp" @@ -148,15 +151,15 @@ class KernelAndProgramCacheTest : public ::testing::Test { }; // Check that programs built from source are not cached. -TEST_F(KernelAndProgramCacheTest, ProgramSourceNegativeBuild) { +TEST_F(KernelAndProgramCacheTest, DISABLED_ProgramSourceNegativeBuild) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } context Ctx{Plt}; - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.build_with_source(""); +// Prg.build_with_source(""); auto CtxImpl = detail::getSyclObjImpl(Ctx); detail::KernelProgramCache::ProgramCacheT &Cache = CtxImpl->getKernelProgramCache().acquireCachedPrograms().get(); @@ -164,15 +167,15 @@ TEST_F(KernelAndProgramCacheTest, ProgramSourceNegativeBuild) { } // Check that programs built from source with options are not cached. -TEST_F(KernelAndProgramCacheTest, ProgramSourceNegativeBuildWithOpts) { +TEST_F(KernelAndProgramCacheTest, DISABLED_ProgramSourceNegativeBuildWithOpts) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } context Ctx{Plt}; - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.build_with_source("", "-g"); +// Prg.build_with_source("", "-g"); auto CtxImpl = detail::getSyclObjImpl(Ctx); detail::KernelProgramCache::ProgramCacheT &Cache = CtxImpl->getKernelProgramCache().acquireCachedPrograms().get(); @@ -180,16 +183,16 @@ TEST_F(KernelAndProgramCacheTest, ProgramSourceNegativeBuildWithOpts) { } // Check that programs compiled and linked from source are not cached. -TEST_F(KernelAndProgramCacheTest, ProgramSourceNegativeCompileAndLink) { +TEST_F(KernelAndProgramCacheTest, DISABLED_ProgramSourceNegativeCompileAndLink) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } context Ctx{Plt}; - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.compile_with_source(""); - Prg.link(); +// Prg.compile_with_source(""); +// Prg.link(); auto CtxImpl = detail::getSyclObjImpl(Ctx); detail::KernelProgramCache::ProgramCacheT &Cache = CtxImpl->getKernelProgramCache().acquireCachedPrograms().get(); @@ -198,16 +201,16 @@ TEST_F(KernelAndProgramCacheTest, ProgramSourceNegativeCompileAndLink) { // Check that programs compiled and linked from source with options are not // cached. -TEST_F(KernelAndProgramCacheTest, ProgramSourceNegativeCompileAndLinkWithOpts) { +TEST_F(KernelAndProgramCacheTest, DISABLED_ProgramSourceNegativeCompileAndLinkWithOpts) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } context Ctx{Plt}; - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.compile_with_source(""); - Prg.link(); +// Prg.compile_with_source(""); +// Prg.link(); auto CtxImpl = detail::getSyclObjImpl(Ctx); detail::KernelProgramCache::ProgramCacheT &Cache = CtxImpl->getKernelProgramCache().acquireCachedPrograms().get(); @@ -215,17 +218,17 @@ TEST_F(KernelAndProgramCacheTest, ProgramSourceNegativeCompileAndLinkWithOpts) { } // Check that programs built without options are cached. -TEST_F(KernelAndProgramCacheTest, ProgramBuildPositive) { +TEST_F(KernelAndProgramCacheTest, DISABLED_ProgramBuildPositive) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } context Ctx{Plt}; - program Prg1{Ctx}; - program Prg2{Ctx}; +// program Prg1{Ctx}; +// program Prg2{Ctx}; - Prg1.build_with_kernel_type(); - Prg2.build_with_kernel_type(); +// Prg1.build_with_kernel_type(); +// Prg2.build_with_kernel_type(); auto CtxImpl = detail::getSyclObjImpl(Ctx); detail::KernelProgramCache::ProgramCacheT &Cache = CtxImpl->getKernelProgramCache().acquireCachedPrograms().get(); @@ -233,27 +236,27 @@ TEST_F(KernelAndProgramCacheTest, ProgramBuildPositive) { } // Check that programs built with options are cached. -TEST_F(KernelAndProgramCacheTest, ProgramBuildPositiveBuildOpts) { +TEST_F(KernelAndProgramCacheTest, DISABLED_ProgramBuildPositiveBuildOpts) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } context Ctx{Plt}; - program Prg1{Ctx}; - program Prg2{Ctx}; - program Prg3{Ctx}; - program Prg4{Ctx}; - program Prg5{Ctx}; +// program Prg1{Ctx}; +// program Prg2{Ctx}; +// program Prg3{Ctx}; +// program Prg4{Ctx}; +// program Prg5{Ctx}; /* Build 5 instances of the same program. It is expected that there will be 3 * instances of the program in the cache because Build of Prg1 is equal to * build of Prg5 and build of Prg2 is equal to build of Prg3. * */ - Prg1.build_with_kernel_type("-a"); - Prg2.build_with_kernel_type("-b"); - Prg3.build_with_kernel_type("-b"); - Prg4.build_with_kernel_type(); - Prg5.build_with_kernel_type("-a"); +// Prg1.build_with_kernel_type("-a"); +// Prg2.build_with_kernel_type("-b"); +// Prg3.build_with_kernel_type("-b"); +// Prg4.build_with_kernel_type(); +// Prg5.build_with_kernel_type("-a"); auto CtxImpl = detail::getSyclObjImpl(Ctx); detail::KernelProgramCache::ProgramCacheT &Cache = @@ -262,16 +265,16 @@ TEST_F(KernelAndProgramCacheTest, ProgramBuildPositiveBuildOpts) { } // Check that programs built with compile options are not cached. -TEST_F(KernelAndProgramCacheTest, ProgramBuildNegativeCompileOpts) { +TEST_F(KernelAndProgramCacheTest, DISABLED_ProgramBuildNegativeCompileOpts) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } context Ctx{Plt}; - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.compile_with_kernel_type("-g"); - Prg.link(); +// Prg.compile_with_kernel_type("-g"); +// Prg.link(); auto CtxImpl = detail::getSyclObjImpl(Ctx); detail::KernelProgramCache::ProgramCacheT &Cache = CtxImpl->getKernelProgramCache().acquireCachedPrograms().get(); @@ -279,16 +282,16 @@ TEST_F(KernelAndProgramCacheTest, ProgramBuildNegativeCompileOpts) { } // Check that programs built with link options are not cached. -TEST_F(KernelAndProgramCacheTest, ProgramBuildNegativeLinkOpts) { +TEST_F(KernelAndProgramCacheTest, DISABLED_ProgramBuildNegativeLinkOpts) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } context Ctx{Plt}; - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.compile_with_kernel_type(); - Prg.link("-g"); +// Prg.compile_with_kernel_type(); +// Prg.link("-g"); auto CtxImpl = detail::getSyclObjImpl(Ctx); detail::KernelProgramCache::ProgramCacheT &Cache = CtxImpl->getKernelProgramCache().acquireCachedPrograms().get(); @@ -296,7 +299,7 @@ TEST_F(KernelAndProgramCacheTest, ProgramBuildNegativeLinkOpts) { } // Check that kernels built without options are cached. -TEST_F(KernelAndProgramCacheTest, KernelPositive) { +TEST_F(KernelAndProgramCacheTest, DISABLED_KernelPositive) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } @@ -306,17 +309,17 @@ TEST_F(KernelAndProgramCacheTest, KernelPositive) { globalCtx.reset(new TestCtx{CtxImpl->getHandleRef()}); - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.build_with_kernel_type(); - kernel Ker = Prg.get_kernel(); +// Prg.build_with_kernel_type(); +// kernel Ker = Prg.get_kernel(); detail::KernelProgramCache::KernelCacheT &Cache = CtxImpl->getKernelProgramCache().acquireKernelsPerProgramCache().get(); EXPECT_EQ(Cache.size(), 1U) << "Expect non-empty cache for kernels"; } // Check that kernels built with options are cached. -TEST_F(KernelAndProgramCacheTest, KernelPositiveBuildOpts) { +TEST_F(KernelAndProgramCacheTest, DISABLED_KernelPositiveBuildOpts) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } @@ -326,18 +329,18 @@ TEST_F(KernelAndProgramCacheTest, KernelPositiveBuildOpts) { globalCtx.reset(new TestCtx{CtxImpl->getHandleRef()}); - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.build_with_kernel_type("-g"); +// Prg.build_with_kernel_type("-g"); - kernel Ker = Prg.get_kernel(); +// kernel Ker = Prg.get_kernel(); detail::KernelProgramCache::KernelCacheT &Cache = CtxImpl->getKernelProgramCache().acquireKernelsPerProgramCache().get(); EXPECT_EQ(Cache.size(), 1U) << "Expect non-empty cache for kernels"; } // Check that kernels built with compile options are not cached. -TEST_F(KernelAndProgramCacheTest, KernelNegativeCompileOpts) { +TEST_F(KernelAndProgramCacheTest, DISABLED_KernelNegativeCompileOpts) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } @@ -347,18 +350,18 @@ TEST_F(KernelAndProgramCacheTest, KernelNegativeCompileOpts) { globalCtx.reset(new TestCtx{CtxImpl->getHandleRef()}); - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.compile_with_kernel_type("-g"); - Prg.link(); - kernel Ker = Prg.get_kernel(); +// Prg.compile_with_kernel_type("-g"); +// Prg.link(); +// kernel Ker = Prg.get_kernel(); detail::KernelProgramCache::KernelCacheT &Cache = CtxImpl->getKernelProgramCache().acquireKernelsPerProgramCache().get(); EXPECT_EQ(Cache.size(), 0U) << "Expect empty cache for kernels"; } // Check that kernels built with link options are not cached. -TEST_F(KernelAndProgramCacheTest, KernelNegativeLinkOpts) { +TEST_F(KernelAndProgramCacheTest, DISABLED_KernelNegativeLinkOpts) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } @@ -368,11 +371,11 @@ TEST_F(KernelAndProgramCacheTest, KernelNegativeLinkOpts) { globalCtx.reset(new TestCtx{CtxImpl->getHandleRef()}); - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.compile_with_kernel_type(); - Prg.link("-g"); - kernel Ker = Prg.get_kernel(); +// Prg.compile_with_kernel_type(); +// Prg.link("-g"); +// kernel Ker = Prg.get_kernel(); detail::KernelProgramCache::KernelCacheT &Cache = CtxImpl->getKernelProgramCache().acquireKernelsPerProgramCache().get(); EXPECT_EQ(Cache.size(), 0U) << "Expect empty cache for kernels"; @@ -380,7 +383,7 @@ TEST_F(KernelAndProgramCacheTest, KernelNegativeLinkOpts) { // Check that kernels are not cached if program is created from multiple // programs. -TEST_F(KernelAndProgramCacheTest, KernelNegativeLinkedProgs) { +TEST_F(KernelAndProgramCacheTest, DISABLED_KernelNegativeLinkedProgs) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } @@ -390,13 +393,13 @@ TEST_F(KernelAndProgramCacheTest, KernelNegativeLinkedProgs) { globalCtx.reset(new TestCtx{CtxImpl->getHandleRef()}); - program Prg1{Ctx}; - program Prg2{Ctx}; +// program Prg1{Ctx}; +// program Prg2{Ctx}; - Prg1.compile_with_kernel_type(); - Prg2.compile_with_kernel_type(); - program Prg({Prg1, Prg2}); - kernel Ker = Prg.get_kernel(); +// Prg1.compile_with_kernel_type(); +// Prg2.compile_with_kernel_type(); +// program Prg({Prg1, Prg2}); +// kernel Ker = Prg.get_kernel(); detail::KernelProgramCache::KernelCacheT &Cache = CtxImpl->getKernelProgramCache().acquireKernelsPerProgramCache().get(); @@ -404,7 +407,7 @@ TEST_F(KernelAndProgramCacheTest, KernelNegativeLinkedProgs) { } // Check that kernels created from source are not cached. -TEST_F(KernelAndProgramCacheTest, KernelNegativeSource) { +TEST_F(KernelAndProgramCacheTest, DISABLED_KernelNegativeSource) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } @@ -414,10 +417,10 @@ TEST_F(KernelAndProgramCacheTest, KernelNegativeSource) { globalCtx.reset(new TestCtx{CtxImpl->getHandleRef()}); - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.build_with_source(""); - kernel Ker = Prg.get_kernel("test"); +// Prg.build_with_source(""); +// kernel Ker = Prg.get_kernel("test"); detail::KernelProgramCache::KernelCacheT &Cache = CtxImpl->getKernelProgramCache().acquireKernelsPerProgramCache().get(); @@ -439,7 +442,7 @@ class MockKernelProgramCache : public detail::KernelProgramCache { }; // Check that kernels built without options are cached. -TEST_F(KernelAndProgramFastCacheTest, KernelPositive) { +TEST_F(KernelAndProgramFastCacheTest, DISABLED_KernelPositive) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } @@ -449,17 +452,17 @@ TEST_F(KernelAndProgramFastCacheTest, KernelPositive) { globalCtx.reset(new TestCtx{CtxImpl->getHandleRef()}); - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.build_with_kernel_type(); - kernel Ker = Prg.get_kernel(); +// Prg.build_with_kernel_type(); +// kernel Ker = Prg.get_kernel(); detail::KernelProgramCache::KernelFastCacheT &Cache = MockKernelProgramCache::getFastCache(CtxImpl->getKernelProgramCache()); EXPECT_EQ(Cache.size(), 1U) << "Expect non-empty cache for kernels"; } // Check that kernels built with options are cached. -TEST_F(KernelAndProgramFastCacheTest, KernelPositiveBuildOpts) { +TEST_F(KernelAndProgramFastCacheTest, DISABLED_KernelPositiveBuildOpts) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } @@ -469,18 +472,18 @@ TEST_F(KernelAndProgramFastCacheTest, KernelPositiveBuildOpts) { globalCtx.reset(new TestCtx{CtxImpl->getHandleRef()}); - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.build_with_kernel_type("-g"); +// Prg.build_with_kernel_type("-g"); - kernel Ker = Prg.get_kernel(); +// kernel Ker = Prg.get_kernel(); detail::KernelProgramCache::KernelFastCacheT &Cache = MockKernelProgramCache::getFastCache(CtxImpl->getKernelProgramCache()); EXPECT_EQ(Cache.size(), 1U) << "Expect non-empty cache for kernels"; } // Check that kernels built with compile options are not cached. -TEST_F(KernelAndProgramFastCacheTest, KernelNegativeCompileOpts) { +TEST_F(KernelAndProgramFastCacheTest, DISABLED_KernelNegativeCompileOpts) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } @@ -490,18 +493,18 @@ TEST_F(KernelAndProgramFastCacheTest, KernelNegativeCompileOpts) { globalCtx.reset(new TestCtx{CtxImpl->getHandleRef()}); - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.compile_with_kernel_type("-g"); - Prg.link(); - kernel Ker = Prg.get_kernel(); +// Prg.compile_with_kernel_type("-g"); +// Prg.link(); +// kernel Ker = Prg.get_kernel(); detail::KernelProgramCache::KernelFastCacheT &Cache = MockKernelProgramCache::getFastCache(CtxImpl->getKernelProgramCache()); EXPECT_EQ(Cache.size(), 0U) << "Expect empty cache for kernels"; } // Check that kernels built with link options are not cached. -TEST_F(KernelAndProgramFastCacheTest, KernelNegativeLinkOpts) { +TEST_F(KernelAndProgramFastCacheTest, DISABLED_KernelNegativeLinkOpts) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } @@ -511,11 +514,11 @@ TEST_F(KernelAndProgramFastCacheTest, KernelNegativeLinkOpts) { globalCtx.reset(new TestCtx{CtxImpl->getHandleRef()}); - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.compile_with_kernel_type(); - Prg.link("-g"); - kernel Ker = Prg.get_kernel(); +// Prg.compile_with_kernel_type(); +// Prg.link("-g"); +// kernel Ker = Prg.get_kernel(); detail::KernelProgramCache::KernelFastCacheT &Cache = MockKernelProgramCache::getFastCache(CtxImpl->getKernelProgramCache()); EXPECT_EQ(Cache.size(), 0U) << "Expect empty cache for kernels"; @@ -523,7 +526,7 @@ TEST_F(KernelAndProgramFastCacheTest, KernelNegativeLinkOpts) { // Check that kernels are not cached if program is created from multiple // programs. -TEST_F(KernelAndProgramFastCacheTest, KernelNegativeLinkedProgs) { +TEST_F(KernelAndProgramFastCacheTest, DISABLED_KernelNegativeLinkedProgs) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } @@ -533,13 +536,13 @@ TEST_F(KernelAndProgramFastCacheTest, KernelNegativeLinkedProgs) { globalCtx.reset(new TestCtx{CtxImpl->getHandleRef()}); - program Prg1{Ctx}; - program Prg2{Ctx}; +// program Prg1{Ctx}; +// program Prg2{Ctx}; - Prg1.compile_with_kernel_type(); - Prg2.compile_with_kernel_type(); - program Prg({Prg1, Prg2}); - kernel Ker = Prg.get_kernel(); +// Prg1.compile_with_kernel_type(); +// Prg2.compile_with_kernel_type(); +// program Prg({Prg1, Prg2}); +// kernel Ker = Prg.get_kernel(); detail::KernelProgramCache::KernelFastCacheT &Cache = MockKernelProgramCache::getFastCache(CtxImpl->getKernelProgramCache()); @@ -547,7 +550,7 @@ TEST_F(KernelAndProgramFastCacheTest, KernelNegativeLinkedProgs) { } // Check that kernels created from source are not cached. -TEST_F(KernelAndProgramFastCacheTest, KernelNegativeSource) { +TEST_F(KernelAndProgramFastCacheTest, DISABLED_KernelNegativeSource) { if (Plt.is_host() || Plt.get_backend() != backend::opencl) { return; } @@ -557,10 +560,10 @@ TEST_F(KernelAndProgramFastCacheTest, KernelNegativeSource) { globalCtx.reset(new TestCtx{CtxImpl->getHandleRef()}); - program Prg{Ctx}; +// program Prg{Ctx}; - Prg.build_with_source(""); - kernel Ker = Prg.get_kernel("test"); +// Prg.build_with_source(""); +// kernel Ker = Prg.get_kernel("test"); detail::KernelProgramCache::KernelFastCacheT &Cache = MockKernelProgramCache::getFastCache(CtxImpl->getKernelProgramCache()); diff --git a/sycl/unittests/kernel-and-program/KernelInfo.cpp b/sycl/unittests/kernel-and-program/KernelInfo.cpp index 0763c13b85101..05ae4a2b250dc 100644 --- a/sycl/unittests/kernel-and-program/KernelInfo.cpp +++ b/sycl/unittests/kernel-and-program/KernelInfo.cpp @@ -118,21 +118,21 @@ class KernelInfoTest : public ::testing::Test { std::unique_ptr Mock; }; -TEST_F(KernelInfoTest, GetPrivateMemUsage) { +TEST_F(KernelInfoTest, DISABLED_GetPrivateMemUsage) { if (Plt.is_host()) { return; } context Ctx{Plt.get_devices()[0]}; - program Prg{Ctx}; + // program Prg{Ctx}; TestContext.reset(new TestCtx(Ctx)); - Prg.build_with_source(""); + // Prg.build_with_source(""); - kernel Ker = Prg.get_kernel(""); + // kernel Ker = Prg.get_kernel(""); - Ker.get_info( - Ctx.get_devices()[0]); + // Ker.get_info( + // Ctx.get_devices()[0]); EXPECT_EQ(TestContext->PrivateMemSizeCalled, true) << "Expect piKernelGetGroupInfo to be " << "called with PI_KERNEL_GROUP_INFO_PRIVATE_MEM_SIZE"; diff --git a/sycl/unittests/kernel-and-program/KernelRelease.cpp b/sycl/unittests/kernel-and-program/KernelRelease.cpp index 0238868114b12..4cfa29bbe8342 100644 --- a/sycl/unittests/kernel-and-program/KernelRelease.cpp +++ b/sycl/unittests/kernel-and-program/KernelRelease.cpp @@ -83,7 +83,7 @@ static pi_result redefinedKernelSetExecInfo(pi_kernel kernel, return PI_SUCCESS; } -TEST(KernelReleaseTest, GetKernelRelease) { +TEST(KernelReleaseTest, DISABLED_GetKernelRelease) { platform Plt{default_selector()}; if (Plt.is_host()) { std::cout << "The program/kernel methods are mostly no-op on the host " @@ -106,10 +106,10 @@ TEST(KernelReleaseTest, GetKernelRelease) { context Ctx{Plt.get_devices()[0]}; TestContext.reset(new TestCtx(Ctx)); - program Prg{Ctx}; - Prg.build_with_source(""); + // program Prg{Ctx}; + // Prg.build_with_source(""); - { kernel Krnl = Prg.get_kernel(""); } + // { kernel Krnl = Prg.get_kernel(""); } ASSERT_EQ(TestContext->KernelReferenceCount, 0) << "Reference count not equal to 0 after kernel destruction"; diff --git a/sycl/unittests/misc/KernelBuildOptions.cpp b/sycl/unittests/misc/KernelBuildOptions.cpp index 705bf43760b69..3fbb078f6b701 100644 --- a/sycl/unittests/misc/KernelBuildOptions.cpp +++ b/sycl/unittests/misc/KernelBuildOptions.cpp @@ -253,37 +253,3 @@ TEST(KernelBuildOptions, KernelBundleBasic) { auto LinkBundle = sycl::link(ObjBundle, ObjBundle.get_devices()); EXPECT_EQ(BuildOpts, "-link-img"); } - -TEST(KernelBuildOptions, Program) { - sycl::platform Plt{sycl::default_selector()}; - if (Plt.is_host()) { - std::cerr << "Test is not supported on host, skipping\n"; - return; // test is not supported on host. - } - - if (Plt.get_backend() == sycl::backend::ext_oneapi_cuda) { - std::cerr << "Test is not supported on CUDA platform, skipping\n"; - return; - } - - if (Plt.get_backend() == sycl::backend::ext_oneapi_hip) { - std::cerr << "Test is not supported on HIP platform, skipping\n"; - return; - } - - sycl::unittest::PiMock Mock{Plt}; - setupDefaultMockAPIs(Mock); - - const sycl::device Dev = Plt.get_devices()[0]; - - sycl::queue Queue{Dev}; - - const sycl::context Ctx = Queue.get_context(); - sycl::program Prg1(Ctx); - sycl::program Prg2(Ctx); - - Prg1.build_with_source(""); - EXPECT_TRUE(BuildOpts.size() == 0) << "Expect empty build options"; - Prg2.build_with_source("", "-api-opts"); - EXPECT_EQ(BuildOpts, "-api-opts"); -} diff --git a/sycl/unittests/program_manager/SubDevices.cpp b/sycl/unittests/program_manager/SubDevices.cpp index 3e3c1b774438f..630cef774f827 100644 --- a/sycl/unittests/program_manager/SubDevices.cpp +++ b/sycl/unittests/program_manager/SubDevices.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include -#include #include #include