From fb0f90384ab4e58d1a5b6eea6a39dbb56e137b42 Mon Sep 17 00:00:00 2001 From: Alexander Flegontov Date: Mon, 22 Jun 2020 18:31:00 +0300 Subject: [PATCH 1/5] [SYCL] Fix assert when calling get_binaries() on host Signed-off-by: Alexander Flegontov --- sycl/source/detail/program_impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/source/detail/program_impl.cpp b/sycl/source/detail/program_impl.cpp index 4a8197d8f9e2e..1e2fddb4882e5 100644 --- a/sycl/source/detail/program_impl.cpp +++ b/sycl/source/detail/program_impl.cpp @@ -305,8 +305,8 @@ kernel program_impl::get_kernel(string_class KernelName, vector_class> program_impl::get_binaries() const { throw_if_state_is(program_state::none); vector_class> Result; - const detail::plugin &Plugin = getPlugin(); if (!is_host()) { + const detail::plugin &Plugin = getPlugin(); vector_class BinarySizes(MDevices.size()); Plugin.call( MProgram, PI_PROGRAM_INFO_BINARY_SIZES, From 160c65c1efd7e16a0bc6bda0cab98c7f71415c24 Mon Sep 17 00:00:00 2001 From: alexanderfle <61590714+alexanderfle@users.noreply.github.com> Date: Mon, 22 Jun 2020 18:59:36 +0300 Subject: [PATCH 2/5] Update sycl/source/detail/program_impl.cpp Co-authored-by: Alexey Bader --- sycl/source/detail/program_impl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sycl/source/detail/program_impl.cpp b/sycl/source/detail/program_impl.cpp index 1e2fddb4882e5..7d38b47fce965 100644 --- a/sycl/source/detail/program_impl.cpp +++ b/sycl/source/detail/program_impl.cpp @@ -305,8 +305,11 @@ kernel program_impl::get_kernel(string_class KernelName, vector_class> program_impl::get_binaries() const { throw_if_state_is(program_state::none); vector_class> Result; - if (!is_host()) { - const detail::plugin &Plugin = getPlugin(); + if (is_host()) + return {}; + + vector_class> Result; + const detail::plugin &Plugin = getPlugin(); vector_class BinarySizes(MDevices.size()); Plugin.call( MProgram, PI_PROGRAM_INFO_BINARY_SIZES, From f0237f9cc062f4673ae482c2ba7a71475270e7f3 Mon Sep 17 00:00:00 2001 From: Alexander Flegontov Date: Mon, 22 Jun 2020 19:21:52 +0300 Subject: [PATCH 3/5] [SYCL] Apply clang-format and remove extra } Signed-off-by: Alexander Flegontov --- sycl/source/detail/program_impl.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/sycl/source/detail/program_impl.cpp b/sycl/source/detail/program_impl.cpp index 7d38b47fce965..5671e6b1d02ff 100644 --- a/sycl/source/detail/program_impl.cpp +++ b/sycl/source/detail/program_impl.cpp @@ -310,20 +310,19 @@ vector_class> program_impl::get_binaries() const { vector_class> Result; const detail::plugin &Plugin = getPlugin(); - vector_class BinarySizes(MDevices.size()); - Plugin.call( - MProgram, PI_PROGRAM_INFO_BINARY_SIZES, - sizeof(size_t) * BinarySizes.size(), BinarySizes.data(), nullptr); - - vector_class Pointers; - for (size_t I = 0; I < BinarySizes.size(); ++I) { - Result.emplace_back(BinarySizes[I]); - Pointers.push_back(Result[I].data()); - } - Plugin.call(MProgram, PI_PROGRAM_INFO_BINARIES, - sizeof(char *) * Pointers.size(), - Pointers.data(), nullptr); + vector_class BinarySizes(MDevices.size()); + Plugin.call( + MProgram, PI_PROGRAM_INFO_BINARY_SIZES, + sizeof(size_t) * BinarySizes.size(), BinarySizes.data(), nullptr); + + vector_class Pointers; + for (size_t I = 0; I < BinarySizes.size(); ++I) { + Result.emplace_back(BinarySizes[I]); + Pointers.push_back(Result[I].data()); } + Plugin.call(MProgram, PI_PROGRAM_INFO_BINARIES, + sizeof(char *) * Pointers.size(), + Pointers.data(), nullptr); return Result; } From 9593044e72b4e86b476fad7bf6dc52bd3f5f3225 Mon Sep 17 00:00:00 2001 From: Alexander Flegontov Date: Mon, 22 Jun 2020 19:34:58 +0300 Subject: [PATCH 4/5] [SYCL] Apply clang-format 2 Signed-off-by: Alexander Flegontov --- sycl/source/detail/program_impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/source/detail/program_impl.cpp b/sycl/source/detail/program_impl.cpp index 5671e6b1d02ff..6b8b7951f9593 100644 --- a/sycl/source/detail/program_impl.cpp +++ b/sycl/source/detail/program_impl.cpp @@ -307,7 +307,7 @@ vector_class> program_impl::get_binaries() const { vector_class> Result; if (is_host()) return {}; - + vector_class> Result; const detail::plugin &Plugin = getPlugin(); vector_class BinarySizes(MDevices.size()); From 296d2f598c18f2277fb542324a6c8c4e76ce1dae Mon Sep 17 00:00:00 2001 From: Alexander Flegontov Date: Mon, 22 Jun 2020 19:42:07 +0300 Subject: [PATCH 5/5] [SYCL] Remove strange line Signed-off-by: Alexander Flegontov --- sycl/source/detail/program_impl.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/sycl/source/detail/program_impl.cpp b/sycl/source/detail/program_impl.cpp index 6b8b7951f9593..d315a0ee23c7a 100644 --- a/sycl/source/detail/program_impl.cpp +++ b/sycl/source/detail/program_impl.cpp @@ -304,7 +304,6 @@ kernel program_impl::get_kernel(string_class KernelName, vector_class> program_impl::get_binaries() const { throw_if_state_is(program_state::none); - vector_class> Result; if (is_host()) return {};