DPC++ Runtime
Runtime libraries for oneAPI Data Parallel C++
kernel_bundle.hpp
Go to the documentation of this file.
1 //==------- kernel_bundle.hpp - SYCL kernel_bundle and free functions ------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
11 #include <CL/sycl/context.hpp>
14 #include <CL/sycl/detail/pi.h>
15 #include <CL/sycl/detail/pi.hpp>
16 #include <CL/sycl/device.hpp>
17 #include <CL/sycl/kernel.hpp>
19 
20 #include <cassert>
21 #include <memory>
22 #include <vector>
23 
25 namespace sycl {
26 // Forward declaration
27 template <backend Backend> class backend_traits;
28 template <backend Backend, class SyclT>
29 auto get_native(const SyclT &Obj) -> backend_return_t<Backend, SyclT>;
30 
31 namespace detail {
32 class kernel_id_impl;
33 }
34 
38 class __SYCL_EXPORT kernel_id {
39 public:
40  kernel_id() = delete;
41 
43  const char *get_name() const noexcept;
44 
45  bool operator==(const kernel_id &RHS) const { return impl == RHS.impl; }
46 
47  bool operator!=(const kernel_id &RHS) const { return !(*this == RHS); }
48 
49 private:
50  kernel_id(const char *Name);
51 
52  kernel_id(const std::shared_ptr<detail::kernel_id_impl> &Impl)
53  : impl(std::move(Impl)) {}
54 
55  std::shared_ptr<detail::kernel_id_impl> impl;
56 
57  template <class Obj>
58  friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject);
59 
60  template <class T>
61  friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj);
62 };
63 
64 namespace detail {
65 class device_image_impl;
66 using DeviceImageImplPtr = std::shared_ptr<device_image_impl>;
67 
68 // The class is used as a base for device_image for "untemplating" public
69 // methods.
70 class __SYCL_EXPORT device_image_plain {
71 public:
73  : impl(std::move(Impl)) {}
74 
75  bool operator==(const device_image_plain &RHS) const {
76  return impl == RHS.impl;
77  }
78 
79  bool operator!=(const device_image_plain &RHS) const {
80  return !(*this == RHS);
81  }
82 
83  bool has_kernel(const kernel_id &KernelID) const noexcept;
84 
85  bool has_kernel(const kernel_id &KernelID, const device &Dev) const noexcept;
86 
87  pi_native_handle getNative() const;
88 
89 protected:
91 
92  template <class Obj>
93  friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject);
94 
95  template <class T>
96  friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj);
97 };
98 } // namespace detail
99 
101 template <sycl::bundle_state State>
103 public:
104  device_image() = delete;
105 
108  bool has_kernel(const kernel_id &KernelID) const noexcept {
109  return device_image_plain::has_kernel(KernelID);
110  }
111 
114  bool has_kernel(const kernel_id &KernelID, const device &Dev) const noexcept {
115  return device_image_plain::has_kernel(KernelID, Dev);
116  }
117 
118 private:
120  : device_image_plain(std::move(Impl)) {}
121 
122  template <class Obj>
123  friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject);
124 
125  template <class T>
126  friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj);
127 };
128 
129 namespace detail {
130 class kernel_bundle_impl;
131 using KernelBundleImplPtr = std::shared_ptr<detail::kernel_bundle_impl>;
132 
133 // The class is used as a base for kernel_bundle to "untemplate" it's methods
134 class __SYCL_EXPORT kernel_bundle_plain {
135 public:
137  : impl(std::move(Impl)) {}
138 
139  bool operator==(const kernel_bundle_plain &RHS) const {
140  return impl == RHS.impl;
141  }
142 
143  bool operator!=(const kernel_bundle_plain &RHS) const {
144  return !(*this == RHS);
145  }
146 
147  bool empty() const noexcept;
148 
149  backend get_backend() const noexcept;
150 
151  context get_context() const noexcept;
152 
153  std::vector<device> get_devices() const noexcept;
154 
155  bool has_kernel(const kernel_id &KernelID) const noexcept;
156 
157  bool has_kernel(const kernel_id &KernelID, const device &Dev) const noexcept;
158 
159  std::vector<kernel_id> get_kernel_ids() const;
160 
161  bool contains_specialization_constants() const noexcept;
162 
163  bool native_specialization_constant() const noexcept;
164 
165 protected:
166  // \returns a kernel object which represents the kernel identified by
167  // kernel_id passed
168  kernel get_kernel(const kernel_id &KernelID) const;
169 
170  // \returns an iterator to the first device image kernel_bundle contains
171  const device_image_plain *begin() const;
172 
173  // \returns an iterator to the last device image kernel_bundle contains
174  const device_image_plain *end() const;
175 
176  bool has_specialization_constant_impl(const char *SpecName) const noexcept;
177 
178  void set_specialization_constant_impl(const char *SpecName, void *Value,
179  size_t Size) noexcept;
180 
181  void get_specialization_constant_impl(const char *SpecName,
182  void *Value) const noexcept;
183 
184  bool is_specialization_constant_set(const char *SpecName) const noexcept;
185 
186  detail::KernelBundleImplPtr impl;
187 };
188 
189 } // namespace detail
190 
195 template <bundle_state State>
196 class kernel_bundle : public detail::kernel_bundle_plain {
197 public:
199 
200  kernel_bundle() = delete;
201 
203  bool empty() const noexcept { return kernel_bundle_plain::empty(); }
204 
206  backend get_backend() const noexcept {
207  return kernel_bundle_plain::get_backend();
208  }
209 
211  context get_context() const noexcept {
212  return kernel_bundle_plain::get_context();
213  }
214 
216  std::vector<device> get_devices() const noexcept {
217  return kernel_bundle_plain::get_devices();
218  }
219 
222  bool has_kernel(const kernel_id &KernelID) const noexcept {
223  return kernel_bundle_plain::has_kernel(KernelID);
224  }
225 
229  bool has_kernel(const kernel_id &KernelID, const device &Dev) const noexcept {
230  return kernel_bundle_plain::has_kernel(KernelID, Dev);
231  }
232 
234  std::vector<kernel_id> get_kernel_ids() const {
236  }
237 
240  bool contains_specialization_constants() const noexcept {
241  return kernel_bundle_plain::contains_specialization_constants();
242  }
243 
246  bool native_specialization_constant() const noexcept {
247  return kernel_bundle_plain::native_specialization_constant();
248  }
249 
252  template <bundle_state _State = State,
254  kernel get_kernel(const kernel_id &KernelID) const {
255  return detail::kernel_bundle_plain::get_kernel(KernelID);
256  }
257 
258  // This guard is needed because the libsycl.so can compiled with C++ <=14
259  // while the code requires C++17. This code is not supposed to be used by the
260  // libsycl.so so it should not be a problem.
261 #if __cplusplus > 201402L
262  template <auto &SpecName> bool has_specialization_constant() const noexcept {
265  const char *SpecSymName = detail::get_spec_constant_symbolic_ID<SpecName>();
266  return has_specialization_constant_impl(SpecSymName);
267  }
268 
272  template <auto &SpecName, bundle_state _State = State,
273  typename = detail::enable_if_t<_State == bundle_state::input>>
274  void set_specialization_constant(
275  typename std::remove_reference_t<decltype(SpecName)>::value_type Value) {
276  const char *SpecSymName = detail::get_spec_constant_symbolic_ID<SpecName>();
277  set_specialization_constant_impl(SpecSymName, &Value,
278  sizeof(decltype(Value)));
279  }
280 
283  template <auto &SpecName>
284  typename std::remove_reference_t<decltype(SpecName)>::value_type
285  get_specialization_constant() const {
286  const char *SpecSymName = detail::get_spec_constant_symbolic_ID<SpecName>();
287  if (!is_specialization_constant_set(SpecSymName))
288  return SpecName.getDefaultValue();
289 
290  using SCType =
291  typename std::remove_reference_t<decltype(SpecName)>::value_type;
292 
293  std::array<char *, sizeof(SCType)> RetValue;
294 
295  get_specialization_constant_impl(SpecSymName, RetValue.data());
296 
297  return *reinterpret_cast<SCType *>(RetValue.data());
298  }
299 #endif
300 
303  return reinterpret_cast<device_image_iterator>(
304  kernel_bundle_plain::begin());
305  }
306 
309  return reinterpret_cast<device_image_iterator>(kernel_bundle_plain::end());
310  }
311 
312  template <backend Backend>
313  __SYCL_DEPRECATED("Use SYCL 2020 sycl::get_native free function")
314  std::vector<typename backend_traits<Backend>::template return_type<
316  std::vector<typename backend_traits<Backend>::template return_type<
318  ReturnValue;
319  ReturnValue.reserve(std::distance(begin(), end()));
320 
321  for (const device_image<State> &DevImg : *this) {
322  ReturnValue.push_back(
324  Backend>::template return_type<kernel_bundle<State>>>(
325  DevImg.getNative()));
326  }
327 
328  return ReturnValue;
329  }
330 
331 private:
333  : kernel_bundle_plain(std::move(Impl)) {}
334 
335  template <class Obj>
336  friend decltype(Obj::impl) detail::getSyclObjImpl(const Obj &SyclObject);
337 
338  template <class T>
339  friend T detail::createSyclObjFromImpl(decltype(T::impl) ImplObj);
340 
341  template <backend Backend, class SyclT>
342  friend auto get_native(const SyclT &Obj) -> backend_return_t<Backend, SyclT>;
343 
344  template <backend Backend>
345  backend_return_t<Backend, kernel_bundle<State>> getNative() const {
346  // NOTE: implementation assumes that the return type is a
347  // derivative of std::vector.
348  backend_return_t<Backend, kernel_bundle<State>> ReturnValue;
349  ReturnValue.reserve(std::distance(begin(), end()));
350 
351  for (const device_image<State> &DevImg : *this) {
352  ReturnValue.push_back(
353  detail::pi::cast<typename decltype(ReturnValue)::value_type>(
354  DevImg.getNative()));
355  }
356 
357  return ReturnValue;
358  }
359 };
360 
362 // get_kernel_id API
364 
365 namespace detail {
366 // Internal non-template versions of get_kernel_id API which is used by public
367 // onces
368 __SYCL_EXPORT kernel_id get_kernel_id_impl(std::string KernelName);
369 } // namespace detail
370 
372 template <typename KernelName> kernel_id get_kernel_id() {
374  return detail::get_kernel_id_impl(KI::getName());
375 }
376 
378 __SYCL_EXPORT std::vector<kernel_id> get_kernel_ids();
379 
381 // get_kernel_bundle API
383 
384 namespace detail {
385 
386 // Internal non-template versions of get_kernel_bundle API which is used by
387 // public onces
388 __SYCL_EXPORT detail::KernelBundleImplPtr
389 get_kernel_bundle_impl(const context &Ctx, const std::vector<device> &Devs,
390  bundle_state State);
391 } // namespace detail
392 
397 template <bundle_state State>
399  const std::vector<device> &Devs) {
401  detail::get_kernel_bundle_impl(Ctx, Devs, State);
402 
403  return detail::createSyclObjFromImpl<kernel_bundle<State>>(Impl);
404 }
405 
406 template <bundle_state State>
408  return get_kernel_bundle<State>(Ctx, Ctx.get_devices());
409 }
410 
411 namespace detail {
412 
413 // Internal non-template versions of get_kernel_bundle API which is used by
414 // public onces
415 __SYCL_EXPORT detail::KernelBundleImplPtr
416 get_kernel_bundle_impl(const context &Ctx, const std::vector<device> &Devs,
417  const std::vector<kernel_id> &KernelIDs,
418  bundle_state State);
419 } // namespace detail
420 
429 template <bundle_state State>
430 kernel_bundle<State>
431 get_kernel_bundle(const context &Ctx, const std::vector<device> &Devs,
432  const std::vector<kernel_id> &KernelIDs) {
434  detail::get_kernel_bundle_impl(Ctx, Devs, KernelIDs, State);
435  return detail::createSyclObjFromImpl<kernel_bundle<State>>(Impl);
436 }
437 
438 template <bundle_state State>
439 kernel_bundle<State>
440 get_kernel_bundle(const context &Ctx, const std::vector<kernel_id> &KernelIDs) {
441  return get_kernel_bundle<State>(Ctx, Ctx.get_devices(), KernelIDs);
442 }
443 
444 template <typename KernelName, bundle_state State>
446  return get_kernel_bundle<State>(Ctx, Ctx.get_devices(),
447  {get_kernel_id<KernelName>()});
448 }
449 
450 template <typename KernelName, bundle_state State>
452  const std::vector<device> &Devs) {
453  return get_kernel_bundle<State>(Ctx, Devs, {get_kernel_id<KernelName>()});
454 }
455 
456 namespace detail {
457 
458 // Stable selector function type for passing thru library boundaries
459 using DevImgSelectorImpl =
460  std::function<bool(const detail::DeviceImageImplPtr &DevImgImpl)>;
461 
462 // Internal non-template versions of get_kernel_bundle API which is used by
463 // public onces
464 __SYCL_EXPORT detail::KernelBundleImplPtr
465 get_kernel_bundle_impl(const context &Ctx, const std::vector<device> &Devs,
466  bundle_state State, const DevImgSelectorImpl &Selector);
467 } // namespace detail
468 
471 template <bundle_state State, typename SelectorT>
473  const std::vector<device> &Devs,
474  SelectorT Selector) {
475  detail::DevImgSelectorImpl SelectorWrapper =
476  [Selector](const detail::DeviceImageImplPtr &DevImg) {
477  return Selector(
479  };
480 
482  detail::get_kernel_bundle_impl(Ctx, Devs, State, SelectorWrapper);
483 
484  return detail::createSyclObjFromImpl<sycl::kernel_bundle<State>>(Impl);
485 }
486 
487 template <bundle_state State, typename SelectorT>
488 kernel_bundle<State> get_kernel_bundle(const context &Ctx, SelectorT Selector) {
489  return get_kernel_bundle<State>(Ctx, Ctx.get_devices(), Selector);
490 }
491 
493 // has_kernel_bundle API
495 
496 namespace detail {
497 
498 __SYCL_EXPORT bool has_kernel_bundle_impl(const context &Ctx,
499  const std::vector<device> &Devs,
500  bundle_state State);
501 
502 __SYCL_EXPORT bool
503 has_kernel_bundle_impl(const context &Ctx, const std::vector<device> &Devs,
504  const std::vector<kernel_id> &kernelIds,
505  bundle_state State);
506 } // namespace detail
507 
518 template <bundle_state State>
519 bool has_kernel_bundle(const context &Ctx, const std::vector<device> &Devs) {
520  return detail::has_kernel_bundle_impl(Ctx, Devs, State);
521 }
522 
523 template <bundle_state State>
524 bool has_kernel_bundle(const context &Ctx, const std::vector<device> &Devs,
525  const std::vector<kernel_id> &KernelIDs) {
526  return detail::has_kernel_bundle_impl(Ctx, Devs, KernelIDs, State);
527 }
528 
529 template <bundle_state State> bool has_kernel_bundle(const context &Ctx) {
530  return has_kernel_bundle<State>(Ctx, Ctx.get_devices());
531 }
532 
533 template <bundle_state State>
534 bool has_kernel_bundle(const context &Ctx,
535  const std::vector<kernel_id> &KernelIDs) {
536  return has_kernel_bundle<State>(Ctx, Ctx.get_devices(), KernelIDs);
537 }
538 
539 template <typename KernelName, bundle_state State>
540 bool has_kernel_bundle(const context &Ctx) {
541  return has_kernel_bundle<State>(Ctx, {get_kernel_id<KernelName>()});
542 }
543 
544 template <typename KernelName, bundle_state State>
545 bool has_kernel_bundle(const context &Ctx, const std::vector<device> &Devs) {
546  return has_kernel_bundle<State>(Ctx, Devs, {get_kernel_id<KernelName>()});
547 }
548 
550 // is_compatible API
552 
555 bool is_compatible(const std::vector<kernel_id> &KernelIDs, const device &Dev);
556 
557 template <typename KernelName> bool is_compatible(const device &Dev) {
558  return is_compatible({get_kernel_id<KernelName>()}, Dev);
559 }
560 
562 // join API
564 
565 namespace detail {
566 
567 __SYCL_EXPORT std::shared_ptr<detail::kernel_bundle_impl>
568 join_impl(const std::vector<detail::KernelBundleImplPtr> &Bundles);
569 }
570 
573 template <sycl::bundle_state State>
574 sycl::kernel_bundle<State>
575 join(const std::vector<sycl::kernel_bundle<State>> &Bundles) {
576  // Convert kernel_bundle<State> to impls to abstract template parameter away
577  std::vector<detail::KernelBundleImplPtr> KernelBundleImpls;
578  KernelBundleImpls.reserve(Bundles.size());
579  for (const sycl::kernel_bundle<State> &Bundle : Bundles)
580  KernelBundleImpls.push_back(detail::getSyclObjImpl(Bundle));
581 
582  std::shared_ptr<detail::kernel_bundle_impl> Impl =
583  detail::join_impl(KernelBundleImpls);
584  return detail::createSyclObjFromImpl<kernel_bundle<State>>(Impl);
585 }
586 
588 // compile API
590 
591 namespace detail {
592 
593 __SYCL_EXPORT std::shared_ptr<detail::kernel_bundle_impl>
594 compile_impl(const kernel_bundle<bundle_state::input> &InputBundle,
595  const std::vector<device> &Devs, const property_list &PropList);
596 }
597 
602 inline kernel_bundle<bundle_state::object>
604  const std::vector<device> &Devs, const property_list &PropList = {}) {
606  detail::compile_impl(InputBundle, Devs, PropList);
608  kernel_bundle<sycl::bundle_state::object>>(Impl);
609 }
610 
611 inline kernel_bundle<bundle_state::object>
613  const property_list &PropList = {}) {
614  return compile(InputBundle, InputBundle.get_devices(), PropList);
615 }
616 
618 // link API
620 
621 namespace detail {
622 __SYCL_EXPORT std::vector<sycl::device> find_device_intersection(
623  const std::vector<kernel_bundle<bundle_state::object>> &ObjectBundles);
624 
625 __SYCL_EXPORT std::shared_ptr<detail::kernel_bundle_impl>
626 link_impl(const std::vector<kernel_bundle<bundle_state::object>> &ObjectBundles,
627  const std::vector<device> &Devs, const property_list &PropList);
628 } // namespace detail
629 
635 inline kernel_bundle<bundle_state::executable>
636 link(const std::vector<kernel_bundle<bundle_state::object>> &ObjectBundles,
637  const std::vector<device> &Devs, const property_list &PropList = {}) {
639  detail::link_impl(ObjectBundles, Devs, PropList);
641  kernel_bundle<sycl::bundle_state::executable>>(Impl);
642 }
643 
644 inline kernel_bundle<bundle_state::executable>
646  const property_list &PropList = {}) {
647  return link(std::vector<kernel_bundle<bundle_state::object>>{ObjectBundle},
648  ObjectBundle.get_devices(), PropList);
649 }
650 
651 inline kernel_bundle<bundle_state::executable>
652 link(const std::vector<kernel_bundle<bundle_state::object>> &ObjectBundles,
653  const property_list &PropList = {}) {
654  std::vector<sycl::device> IntersectDevices =
655  find_device_intersection(ObjectBundles);
656  return link(ObjectBundles, IntersectDevices, PropList);
657 }
658 
659 inline kernel_bundle<bundle_state::executable>
661  const std::vector<device> &Devs, const property_list &PropList = {}) {
662  return link(std::vector<kernel_bundle<bundle_state::object>>{ObjectBundle},
663  Devs, PropList);
664 }
665 
667 // build API
669 
670 namespace detail {
671 __SYCL_EXPORT std::shared_ptr<detail::kernel_bundle_impl>
672 build_impl(const kernel_bundle<bundle_state::input> &InputBundle,
673  const std::vector<device> &Devs, const property_list &PropList);
674 }
675 
680 inline kernel_bundle<bundle_state::executable>
682  const std::vector<device> &Devs, const property_list &PropList = {}) {
684  detail::build_impl(InputBundle, Devs, PropList);
686  kernel_bundle<sycl::bundle_state::executable>>(Impl);
687 }
688 
689 inline kernel_bundle<bundle_state::executable>
691  const property_list &PropList = {}) {
692  return build(InputBundle, InputBundle.get_devices(), PropList);
693 }
694 
695 } // namespace sycl
696 } // __SYCL_INLINE_NAMESPACE(cl)
697 
698 namespace std {
699 template <> struct hash<cl::sycl::kernel_id> {
700  size_t operator()(const cl::sycl::kernel_id &KernelID) const {
701  return hash<std::shared_ptr<cl::sycl::detail::kernel_id_impl>>()(
703  }
704 };
705 
706 template <cl::sycl::bundle_state State>
707 struct hash<cl::sycl::device_image<State>> {
708  size_t operator()(const cl::sycl::device_image<State> &DeviceImage) const {
709  return hash<std::shared_ptr<cl::sycl::detail::device_image_impl>>()(
710  cl::sycl::detail::getSyclObjImpl(DeviceImage));
711  }
712 };
713 
714 template <cl::sycl::bundle_state State>
715 struct hash<cl::sycl::kernel_bundle<State>> {
716  size_t operator()(const cl::sycl::kernel_bundle<State> &KernelBundle) const {
717  return hash<std::shared_ptr<cl::sycl::detail::kernel_bundle_impl>>()(
718  cl::sycl::detail::getSyclObjImpl(KernelBundle));
719  }
720 };
721 } // namespace std
cl::sycl::backend
backend
Definition: backend_types.hpp:21
cl::sycl::kernel_bundle::get_kernel
kernel get_kernel(const kernel_id &KernelID) const
Definition: kernel_bundle.hpp:254
cl::sycl::detail::get_kernel_bundle_impl
detail::KernelBundleImplPtr get_kernel_bundle_impl(const context &Ctx, const std::vector< device > &Devs, bundle_state State, const DevImgSelectorImpl &Selector)
Definition: kernel_bundle.cpp:136
cl::sycl::kernel_bundle::native_specialization_constant
bool native_specialization_constant() const noexcept
Definition: kernel_bundle.hpp:246
pi.h
cl::sycl::kernel_bundle
The kernel_bundle class represents collection of device images in a particular state.
Definition: kernel.hpp:26
cl::sycl::kernel_bundle::get_kernel_ids
std::vector< kernel_id > get_kernel_ids() const
Definition: kernel_bundle.hpp:234
cl::sycl::is_compatible
bool is_compatible(const device &Dev)
Definition: kernel_bundle.hpp:557
cl::sycl::kernel_bundle::get_context
context get_context() const noexcept
Definition: kernel_bundle.hpp:211
cl::sycl::distance
float distance(T p0, T p1) __NOEXC
Definition: builtins.hpp:996
cl::sycl::info::device
device
Definition: info_desc.hpp:47
cl::sycl::detail::device_image_plain::getNative
pi_native_handle getNative() const
Definition: kernel_bundle.cpp:37
cl::sycl::kernel_bundle::has_kernel
bool has_kernel(const kernel_id &KernelID, const device &Dev) const noexcept
Definition: kernel_bundle.hpp:229
cl::sycl::detail::createSyclObjFromImpl
T createSyclObjFromImpl(decltype(T::impl) ImplObj)
Definition: common.hpp:180
device.hpp
cl::sycl::kernel_bundle::begin
device_image_iterator begin() const
Definition: kernel_bundle.hpp:302
__SYCL_DEPRECATED
#define __SYCL_DEPRECATED(message)
Definition: defines_elementary.hpp:43
cl::sycl::detail::device_image_plain
Definition: kernel_bundle.hpp:70
cl::sycl::join
sycl::kernel_bundle< State > join(const std::vector< sycl::kernel_bundle< State >> &Bundles)
Definition: kernel_bundle.hpp:575
context.hpp
cl::sycl::build
kernel_bundle< bundle_state::executable > build(const kernel_bundle< bundle_state::input > &InputBundle, const property_list &PropList={})
Definition: kernel_bundle.hpp:690
cl::sycl::detail::link_impl
std::shared_ptr< detail::kernel_bundle_impl > link_impl(const std::vector< kernel_bundle< bundle_state::object >> &ObjectBundles, const std::vector< device > &Devs, const property_list &PropList)
Definition: kernel_bundle.cpp:233
cl::sycl::backend_traits
Definition: backend.hpp:49
cl::sycl::detail::KernelBundleImplPtr
std::shared_ptr< detail::kernel_bundle_impl > KernelBundleImplPtr
Definition: kernel_bundle.hpp:131
cl::sycl::device_image::has_kernel
bool has_kernel(const kernel_id &KernelID) const noexcept
Definition: kernel_bundle.hpp:108
cl::sycl::detail::compile_impl
std::shared_ptr< detail::kernel_bundle_impl > compile_impl(const kernel_bundle< bundle_state::input > &InputBundle, const std::vector< device > &Devs, const property_list &PropList)
Definition: kernel_bundle.cpp:226
cl::sycl::property_list
Objects of the property_list class are containers for the SYCL properties.
Definition: property_list.hpp:25
pi.hpp
cl::sycl::detail::has_kernel_bundle_impl
bool has_kernel_bundle_impl(const context &Ctx, const std::vector< device > &Devs, const std::vector< kernel_id > &kernelIds, bundle_state State)
Definition: kernel_bundle.cpp:173
cast
To cast(From value)
Definition: pi_opencl.cpp:42
cl::sycl::detail::remove_reference_t
typename std::remove_reference< T >::type remove_reference_t
Definition: stl_type_traits.hpp:35
cl::sycl::bundle_state
bundle_state
Definition: kernel_bundle_enums.hpp:14
cl::sycl::kernel_bundle::contains_specialization_constants
bool contains_specialization_constants() const noexcept
Definition: kernel_bundle.hpp:240
cl::sycl::kernel_bundle::has_kernel
bool has_kernel(const kernel_id &KernelID) const noexcept
Definition: kernel_bundle.hpp:222
kernel.hpp
cl::sycl::device
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:34
cl::sycl::device_image
Objects of the class represents an instance of an image in a specific state.
Definition: kernel_bundle.hpp:102
cl::sycl::kernel_id
Objects of the class identify kernel is some kernel_bundle related APIs.
Definition: kernel_bundle.hpp:38
cl::sycl::get_native
auto get_native(const SyclT &Obj) -> backend_return_t< Backend, SyclT >
kernel_bundle_enums.hpp
cl::sycl::detail::device_image_plain::operator==
bool operator==(const device_image_plain &RHS) const
Definition: kernel_bundle.hpp:75
cl::sycl::detail::device_image_plain::impl
detail::DeviceImageImplPtr impl
Definition: kernel_bundle.hpp:90
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
cl::sycl::detail::kernel_bundle_plain::operator!=
bool operator!=(const kernel_bundle_plain &RHS) const
Definition: kernel_bundle.hpp:143
cl::sycl::detail::device_image_plain::operator!=
bool operator!=(const device_image_plain &RHS) const
Definition: kernel_bundle.hpp:79
cl::sycl::detail::kernel_bundle_plain::operator==
bool operator==(const kernel_bundle_plain &RHS) const
Definition: kernel_bundle.hpp:139
cl::sycl::detail::KernelInfo
Definition: kernel_desc.hpp:70
cl::sycl::get_kernel_ids
std::vector< kernel_id > get_kernel_ids()
Definition: kernel_bundle.cpp:274
pi_native_handle
uintptr_t pi_native_handle
Definition: pi.h:72
cl::sycl::context::get_devices
std::vector< device > get_devices() const
Gets devices associated with this SYCL context.
Definition: context.cpp:127
cl::sycl::has_kernel_bundle
bool has_kernel_bundle(const context &Ctx, const std::vector< device > &Devs)
Definition: kernel_bundle.hpp:545
std::hash< cl::sycl::device_image< State > >::operator()
size_t operator()(const cl::sycl::device_image< State > &DeviceImage) const
Definition: kernel_bundle.hpp:708
cl::sycl::get_kernel_bundle
kernel_bundle< State > get_kernel_bundle(const context &Ctx, SelectorT Selector)
Definition: kernel_bundle.hpp:488
cl::sycl::link
kernel_bundle< bundle_state::executable > link(const kernel_bundle< bundle_state::object > &ObjectBundle, const std::vector< device > &Devs, const property_list &PropList={})
Definition: kernel_bundle.hpp:660
cl::sycl::detail::DevImgSelectorImpl
std::function< bool(const detail::DeviceImageImplPtr &DevImgImpl)> DevImgSelectorImpl
Definition: kernel_bundle.hpp:460
cl::sycl::device_image::has_kernel
bool has_kernel(const kernel_id &KernelID, const device &Dev) const noexcept
Definition: kernel_bundle.hpp:114
cl::sycl::detail::getSyclObjImpl
decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject)
Definition: common.hpp:163
cl::sycl::detail::find_device_intersection
std::vector< sycl::device > find_device_intersection(const std::vector< kernel_bundle< bundle_state::object >> &ObjectBundles)
Definition: kernel_bundle.cpp:248
std
Definition: accessor.hpp:2356
kernel_desc.hpp
cl::sycl::detail::kernel_bundle_plain::impl
detail::KernelBundleImplPtr impl
Definition: kernel_bundle.hpp:186
cl::sycl::kernel_bundle::empty
bool empty() const noexcept
Definition: kernel_bundle.hpp:203
cl::sycl::detail::build_impl
std::shared_ptr< detail::kernel_bundle_impl > build_impl(const kernel_bundle< bundle_state::input > &InputBundle, const std::vector< device > &Devs, const property_list &PropList)
Definition: kernel_bundle.cpp:240
cl::sycl::kernel_bundle::get_backend
backend get_backend() const noexcept
Definition: kernel_bundle.hpp:206
cl::sycl::get_kernel_id
kernel_id get_kernel_id()
Definition: kernel_bundle.hpp:372
cl::sycl::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:35
std::hash< cl::sycl::kernel_id >::operator()
size_t operator()(const cl::sycl::kernel_id &KernelID) const
Definition: kernel_bundle.hpp:700
cl::sycl::kernel_bundle::get_devices
std::vector< device > get_devices() const noexcept
Definition: kernel_bundle.hpp:216
common.hpp
cl::sycl::kernel_id::operator!=
bool operator!=(const kernel_id &RHS) const
Definition: kernel_bundle.hpp:47
cl::sycl::detail::kernel_bundle_plain::kernel_bundle_plain
kernel_bundle_plain(const detail::KernelBundleImplPtr &Impl)
Definition: kernel_bundle.hpp:136
cl::sycl::detail::join_impl
std::shared_ptr< detail::kernel_bundle_impl > join_impl(const std::vector< detail::KernelBundleImplPtr > &Bundles)
Definition: kernel_bundle.cpp:143
cl::sycl::info::context
context
Definition: info_desc.hpp:38
std::hash< cl::sycl::kernel_bundle< State > >::operator()
size_t operator()(const cl::sycl::kernel_bundle< State > &KernelBundle) const
Definition: kernel_bundle.hpp:716
cl::sycl::detail::kernel_bundle_plain
Definition: kernel_bundle.hpp:134
cl::sycl::detail::enable_if_t
typename std::enable_if< B, T >::type enable_if_t
Definition: stl_type_traits.hpp:24
cl::sycl::detail::device_image_plain::device_image_plain
device_image_plain(const detail::DeviceImageImplPtr &Impl)
Definition: kernel_bundle.hpp:72
cl::sycl::kernel
Provides an abstraction of a SYCL kernel.
Definition: kernel.hpp:65
cl::sycl::kernel_bundle::end
device_image_iterator end() const
Definition: kernel_bundle.hpp:308
cl::sycl::detail::get_kernel_id_impl
kernel_id get_kernel_id_impl(std::string KernelName)
Definition: kernel_bundle.cpp:117
cl::sycl::kernel_id::operator==
bool operator==(const kernel_id &RHS) const
Definition: kernel_bundle.hpp:45
cl::sycl::compile
kernel_bundle< bundle_state::object > compile(const kernel_bundle< bundle_state::input > &InputBundle, const property_list &PropList={})
Definition: kernel_bundle.hpp:612
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12
cl::sycl::detail::DeviceImageImplPtr
std::shared_ptr< device_image_impl > DeviceImageImplPtr
Definition: kernel_bundle.hpp:66