Skip to content

Commit

Permalink
[SYCL] Make kernel_bundle interop more conformant (#4672)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Alexander Batashev authored Oct 1, 2021
1 parent 0b97344 commit 91fef67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
5 changes: 3 additions & 2 deletions sycl/include/CL/sycl/backend/opencl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <CL/sycl/detail/cl.h>
#include <CL/sycl/kernel_bundle.hpp>

#include <vector>

__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {

Expand Down Expand Up @@ -75,8 +77,7 @@ struct BackendInput<backend::opencl, kernel_bundle<State>> {

template <bundle_state State>
struct BackendReturn<backend::opencl, kernel_bundle<State>> {
// TODO: Per SYCL 2020 this should be std::vector<cl_program>
using type = cl_program;
using type = std::vector<cl_program>;
};

template <> struct BackendInput<backend::opencl, kernel> {
Expand Down
17 changes: 2 additions & 15 deletions sycl/include/CL/sycl/kernel_bundle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,21 +311,8 @@ class kernel_bundle : public detail::kernel_bundle_plain {

template <backend Backend>
__SYCL_DEPRECATED("Use SYCL 2020 sycl::get_native free function")
std::vector<typename backend_traits<Backend>::template return_type<
kernel_bundle<State>>> get_native() {
std::vector<typename backend_traits<Backend>::template return_type<
kernel_bundle<State>>>
ReturnValue;
ReturnValue.reserve(std::distance(begin(), end()));

for (const device_image<State> &DevImg : *this) {
ReturnValue.push_back(
detail::pi::cast<typename backend_traits<
Backend>::template return_type<kernel_bundle<State>>>(
DevImg.getNative()));
}

return ReturnValue;
auto get_native() const -> backend_return_t<Backend, kernel_bundle<State>> {
return getNative<Backend>();
}

private:
Expand Down

0 comments on commit 91fef67

Please sign in to comment.