From 91fef6724f3efd285b47cf0a4a74c9034d381a4b Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Fri, 1 Oct 2021 20:22:23 +0300 Subject: [PATCH] [SYCL] Make kernel_bundle interop more conformant (#4672) Mark kernel bundle's get_native as const to fix sycl::get_native compilation issues, fix incorrect kernel bundle trait. Tests: intel/llvm-test-suite#489 --- sycl/include/CL/sycl/backend/opencl.hpp | 5 +++-- sycl/include/CL/sycl/kernel_bundle.hpp | 17 ++--------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/sycl/include/CL/sycl/backend/opencl.hpp b/sycl/include/CL/sycl/backend/opencl.hpp index 6854484cd6e08..7820f0e398102 100644 --- a/sycl/include/CL/sycl/backend/opencl.hpp +++ b/sycl/include/CL/sycl/backend/opencl.hpp @@ -16,6 +16,8 @@ #include #include +#include + __SYCL_INLINE_NAMESPACE(cl) { namespace sycl { @@ -75,8 +77,7 @@ struct BackendInput> { template struct BackendReturn> { - // TODO: Per SYCL 2020 this should be std::vector - using type = cl_program; + using type = std::vector; }; template <> struct BackendInput { diff --git a/sycl/include/CL/sycl/kernel_bundle.hpp b/sycl/include/CL/sycl/kernel_bundle.hpp index 21398c232aa9e..1a5ac4941e4bc 100644 --- a/sycl/include/CL/sycl/kernel_bundle.hpp +++ b/sycl/include/CL/sycl/kernel_bundle.hpp @@ -311,21 +311,8 @@ class kernel_bundle : public detail::kernel_bundle_plain { template __SYCL_DEPRECATED("Use SYCL 2020 sycl::get_native free function") - std::vector::template return_type< - kernel_bundle>> get_native() { - std::vector::template return_type< - kernel_bundle>> - ReturnValue; - ReturnValue.reserve(std::distance(begin(), end())); - - for (const device_image &DevImg : *this) { - ReturnValue.push_back( - detail::pi::cast::template return_type>>( - DevImg.getNative())); - } - - return ReturnValue; + auto get_native() const -> backend_return_t> { + return getNative(); } private: