Skip to content

Commit cf018f1

Browse files
author
Andrew Lamzed-Short
authored
[SYCL] Implement kernel_bundle::get_kernel function (#8294)
`kernel_bundle` was missing the `template <typename KernelName> kernel get_kernel() const;` from its complete list of queries from the spec [4.11.12.1](https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:bundles.query). This patch implements this missing function. An E2E test was required in order to test this, the test for this patch is intel/llvm-test-suite#1589.
1 parent a7a33f3 commit cf018f1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sycl/include/sycl/kernel_bundle.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,14 @@ class kernel_bundle : public detail::kernel_bundle_plain,
276276
return detail::kernel_bundle_plain::get_kernel(KernelID);
277277
}
278278

279+
/// \returns a kernel object which represents the kernel identified by
280+
/// KernelName.
281+
template <typename KernelName, bundle_state _State = State,
282+
typename = detail::enable_if_t<_State == bundle_state::executable>>
283+
kernel get_kernel() const {
284+
return detail::kernel_bundle_plain::get_kernel(get_kernel_id<KernelName>());
285+
}
286+
279287
/// \returns true if any device image in the kernel_bundle uses specialization
280288
/// constant whose address is SpecName
281289
template <auto &SpecName> bool has_specialization_constant() const noexcept {

0 commit comments

Comments
 (0)