DPC++ Runtime
Runtime libraries for oneAPI DPC++
kernel_bundle_impl.hpp
Go to the documentation of this file.
1 //==------- kernel_bundle_impl.hpp - SYCL kernel_bundle_impl ---------------==//
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 
12 #include <detail/kernel_impl.hpp>
14 #include <sycl/backend_types.hpp>
15 #include <sycl/context.hpp>
16 #include <sycl/detail/common.hpp>
17 #include <sycl/detail/pi.h>
18 #include <sycl/device.hpp>
19 #include <sycl/kernel_bundle.hpp>
20 
21 #include <algorithm>
22 #include <cassert>
23 #include <cstring>
24 #include <memory>
25 #include <vector>
26 
27 namespace sycl {
29 namespace detail {
30 
31 static bool checkAllDevicesAreInContext(const std::vector<device> &Devices,
32  const context &Context) {
33  return std::all_of(
34  Devices.begin(), Devices.end(), [&Context](const device &Dev) {
35  return getSyclObjImpl(Context)->isDeviceValid(getSyclObjImpl(Dev));
36  });
37 }
38 
39 static bool checkAllDevicesHaveAspect(const std::vector<device> &Devices,
40  aspect Aspect) {
41  return std::all_of(Devices.begin(), Devices.end(),
42  [&Aspect](const device &Dev) { return Dev.has(Aspect); });
43 }
44 
45 // The class is an impl counterpart of the sycl::kernel_bundle.
46 // It provides an access and utilities to manage set of sycl::device_images
47 // objects.
49 
50  using SpecConstMapT = std::map<std::string, std::vector<unsigned char>>;
51 
52  void common_ctor_checks(bundle_state State) {
53  const bool AllDevicesInTheContext =
54  checkAllDevicesAreInContext(MDevices, MContext);
55  if (MDevices.empty() || !AllDevicesInTheContext)
56  throw sycl::exception(
57  make_error_code(errc::invalid),
58  "Not all devices are associated with the context or "
59  "vector of devices is empty");
60 
61  if (bundle_state::input == State &&
62  !checkAllDevicesHaveAspect(MDevices, aspect::online_compiler))
63  throw sycl::exception(make_error_code(errc::invalid),
64  "Not all devices have aspect::online_compiler");
65 
66  if (bundle_state::object == State &&
67  !checkAllDevicesHaveAspect(MDevices, aspect::online_linker))
68  throw sycl::exception(make_error_code(errc::invalid),
69  "Not all devices have aspect::online_linker");
70  }
71 
72 public:
73  kernel_bundle_impl(context Ctx, std::vector<device> Devs, bundle_state State)
74  : MContext(std::move(Ctx)), MDevices(std::move(Devs)), MState(State) {
75 
76  common_ctor_checks(State);
77 
78  MDeviceImages = detail::ProgramManager::getInstance().getSYCLDeviceImages(
79  MContext, MDevices, State);
80  }
81 
82  // Interop constructor used by make_kernel
83  kernel_bundle_impl(context Ctx, std::vector<device> Devs)
84  : MContext(Ctx), MDevices(Devs), MState(bundle_state::executable) {
85  if (!checkAllDevicesAreInContext(Devs, Ctx))
86  throw sycl::exception(
87  make_error_code(errc::invalid),
88  "Not all devices are associated with the context or "
89  "vector of devices is empty");
90  MIsInterop = true;
91  }
92 
93  // Interop constructor
94  kernel_bundle_impl(context Ctx, std::vector<device> Devs,
95  device_image_plain &DevImage)
96  : kernel_bundle_impl(Ctx, Devs) {
97  MDeviceImages.push_back(DevImage);
98  }
99 
100  // Matches sycl::build and sycl::compile
101  // Have one constructor because sycl::build and sycl::compile have the same
102  // signature
104  std::vector<device> Devs, const property_list &PropList,
105  bundle_state TargetState)
106  : MContext(InputBundle.get_context()), MDevices(std::move(Devs)),
107  MState(TargetState) {
108 
109  MSpecConstValues = getSyclObjImpl(InputBundle)->get_spec_const_map_ref();
110 
111  const std::vector<device> &InputBundleDevices =
112  getSyclObjImpl(InputBundle)->get_devices();
113  const bool AllDevsAssociatedWithInputBundle =
114  std::all_of(MDevices.begin(), MDevices.end(),
115  [&InputBundleDevices](const device &Dev) {
116  return InputBundleDevices.end() !=
117  std::find(InputBundleDevices.begin(),
118  InputBundleDevices.end(), Dev);
119  });
120  if (MDevices.empty() || !AllDevsAssociatedWithInputBundle)
121  throw sycl::exception(
122  make_error_code(errc::invalid),
123  "Not all devices are in the set of associated "
124  "devices for input bundle or vector of devices is empty");
125 
126  for (const device_image_plain &DeviceImage : InputBundle) {
127  // Skip images which are not compatible with devices provided
128  if (std::none_of(
129  MDevices.begin(), MDevices.end(),
130  [&DeviceImage](const device &Dev) {
131  return getSyclObjImpl(DeviceImage)->compatible_with_device(Dev);
132  }))
133  continue;
134 
135  switch (TargetState) {
136  case bundle_state::object:
137  MDeviceImages.push_back(detail::ProgramManager::getInstance().compile(
138  DeviceImage, MDevices, PropList));
139  break;
140  case bundle_state::executable:
141  MDeviceImages.push_back(detail::ProgramManager::getInstance().build(
142  DeviceImage, MDevices, PropList));
143  break;
144  case bundle_state::input:
145  throw sycl::runtime_error(
146  "Internal error. The target state should not be input",
147  PI_ERROR_INVALID_OPERATION);
148  break;
149  }
150  }
151  }
152 
153  // Matches sycl::link
155  const std::vector<kernel_bundle<bundle_state::object>> &ObjectBundles,
156  std::vector<device> Devs, const property_list &PropList)
157  : MDevices(std::move(Devs)), MState(bundle_state::executable) {
158 
159  if (MDevices.empty())
160  throw sycl::exception(make_error_code(errc::invalid),
161  "Vector of devices is empty");
162 
163  if (ObjectBundles.empty())
164  return;
165 
166  MContext = ObjectBundles[0].get_context();
167  for (size_t I = 1; I < ObjectBundles.size(); ++I) {
168  if (ObjectBundles[I].get_context() != MContext)
169  throw sycl::exception(
170  make_error_code(errc::invalid),
171  "Not all input bundles have the same associated context");
172  }
173 
174  // Check if any of the devices in devs are not in the set of associated
175  // devices for any of the bundles in ObjectBundles
176  const bool AllDevsAssociatedWithInputBundles = std::all_of(
177  MDevices.begin(), MDevices.end(), [&ObjectBundles](const device &Dev) {
178  // Number of devices is expected to be small
179  return std::all_of(
180  ObjectBundles.begin(), ObjectBundles.end(),
181  [&Dev](const kernel_bundle<bundle_state::object> &KernelBundle) {
182  const std::vector<device> &BundleDevices =
183  getSyclObjImpl(KernelBundle)->get_devices();
184  return BundleDevices.end() != std::find(BundleDevices.begin(),
185  BundleDevices.end(),
186  Dev);
187  });
188  });
189  if (!AllDevsAssociatedWithInputBundles)
190  throw sycl::exception(make_error_code(errc::invalid),
191  "Not all devices are in the set of associated "
192  "devices for input bundles");
193 
194  // TODO: Unify with c'tor for sycl::comile and sycl::build by calling
195  // sycl::join on vector of kernel_bundles
196 
197  // The loop below just links each device image separately, not linking any
198  // two device images together. This is correct so long as each device image
199  // has no unresolved symbols. That's the case when device images are created
200  // from generic SYCL APIs. There's no way in generic SYCL to create a kernel
201  // which references an undefined symbol. If we decide in the future to allow
202  // a backend interop API to create a "sycl::kernel_bundle" that references
203  // undefined symbols, then the logic in this loop will need to be changed.
204  for (const kernel_bundle<bundle_state::object> &ObjectBundle :
205  ObjectBundles) {
206  for (const device_image_plain &DeviceImage : ObjectBundle) {
207 
208  // Skip images which are not compatible with devices provided
209  if (std::none_of(MDevices.begin(), MDevices.end(),
210  [&DeviceImage](const device &Dev) {
211  return getSyclObjImpl(DeviceImage)
212  ->compatible_with_device(Dev);
213  }))
214  continue;
215 
216  std::vector<device_image_plain> LinkedResults =
217  detail::ProgramManager::getInstance().link(DeviceImage, MDevices,
218  PropList);
219  MDeviceImages.insert(MDeviceImages.end(), LinkedResults.begin(),
220  LinkedResults.end());
221  }
222  }
223 
224  for (const kernel_bundle<bundle_state::object> &Bundle : ObjectBundles) {
225  const KernelBundleImplPtr BundlePtr = getSyclObjImpl(Bundle);
226  for (const std::pair<const std::string, std::vector<unsigned char>>
227  &SpecConst : BundlePtr->MSpecConstValues) {
228  MSpecConstValues[SpecConst.first] = SpecConst.second;
229  }
230  }
231  }
232 
233  kernel_bundle_impl(context Ctx, std::vector<device> Devs,
234  const std::vector<kernel_id> &KernelIDs,
235  bundle_state State)
236  : MContext(std::move(Ctx)), MDevices(std::move(Devs)), MState(State) {
237 
238  common_ctor_checks(State);
239 
240  MDeviceImages = detail::ProgramManager::getInstance().getSYCLDeviceImages(
241  MContext, MDevices, KernelIDs, State);
242  }
243 
244  kernel_bundle_impl(context Ctx, std::vector<device> Devs,
245  const DevImgSelectorImpl &Selector, bundle_state State)
246  : MContext(std::move(Ctx)), MDevices(std::move(Devs)), MState(State) {
247 
248  common_ctor_checks(State);
249 
250  MDeviceImages = detail::ProgramManager::getInstance().getSYCLDeviceImages(
251  MContext, MDevices, Selector, State);
252  }
253 
254  // C'tor matches sycl::join API
255  kernel_bundle_impl(const std::vector<detail::KernelBundleImplPtr> &Bundles,
256  bundle_state State)
257  : MState(State) {
258  if (Bundles.empty())
259  return;
260 
261  MContext = Bundles[0]->MContext;
262  MDevices = Bundles[0]->MDevices;
263  for (size_t I = 1; I < Bundles.size(); ++I) {
264  if (Bundles[I]->MContext != MContext)
265  throw sycl::exception(
266  make_error_code(errc::invalid),
267  "Not all input bundles have the same associated context.");
268  if (Bundles[I]->MDevices != MDevices)
269  throw sycl::exception(
270  make_error_code(errc::invalid),
271  "Not all input bundles have the same set of associated devices.");
272  }
273 
274  for (const detail::KernelBundleImplPtr &Bundle : Bundles) {
275 
276  MDeviceImages.insert(MDeviceImages.end(), Bundle->MDeviceImages.begin(),
277  Bundle->MDeviceImages.end());
278  }
279 
280  std::sort(MDeviceImages.begin(), MDeviceImages.end(),
282 
283  if (get_bundle_state() == bundle_state::input) {
284  // Copy spec constants values from the device images to be removed.
285  auto MergeSpecConstants = [this](const device_image_plain &Img) {
286  const detail::DeviceImageImplPtr &ImgImpl = getSyclObjImpl(Img);
287  const std::map<std::string,
288  std::vector<device_image_impl::SpecConstDescT>>
289  &SpecConsts = ImgImpl->get_spec_const_data_ref();
290  const std::vector<unsigned char> &Blob =
291  ImgImpl->get_spec_const_blob_ref();
292  for (const std::pair<const std::string,
293  std::vector<device_image_impl::SpecConstDescT>>
294  &SpecConst : SpecConsts) {
295  if (SpecConst.second.front().IsSet)
296  set_specialization_constant_raw_value(
297  SpecConst.first.c_str(),
298  Blob.data() + SpecConst.second.front().BlobOffset,
299  SpecConst.second.back().CompositeOffset +
300  SpecConst.second.back().Size);
301  }
302  };
303  std::for_each(MDeviceImages.begin(), MDeviceImages.end(),
304  MergeSpecConstants);
305  }
306 
307  const auto DevImgIt =
308  std::unique(MDeviceImages.begin(), MDeviceImages.end());
309 
310  // Remove duplicate device images.
311  MDeviceImages.erase(DevImgIt, MDeviceImages.end());
312 
313  for (const detail::KernelBundleImplPtr &Bundle : Bundles) {
314  for (const std::pair<const std::string, std::vector<unsigned char>>
315  &SpecConst : Bundle->MSpecConstValues) {
316  set_specialization_constant_raw_value(SpecConst.first.c_str(),
317  SpecConst.second.data(),
318  SpecConst.second.size());
319  }
320  }
321  }
322 
323  bool empty() const noexcept { return MDeviceImages.empty(); }
324 
325  backend get_backend() const noexcept {
326  return MContext.get_platform().get_backend();
327  }
328 
329  context get_context() const noexcept { return MContext; }
330 
331  const std::vector<device> &get_devices() const noexcept { return MDevices; }
332 
333  std::vector<kernel_id> get_kernel_ids() const {
334  // Collect kernel ids from all device images, then remove duplicates
335 
336  std::vector<kernel_id> Result;
337  for (const device_image_plain &DeviceImage : MDeviceImages) {
338  const std::vector<kernel_id> &KernelIDs =
339  getSyclObjImpl(DeviceImage)->get_kernel_ids();
340 
341  Result.insert(Result.end(), KernelIDs.begin(), KernelIDs.end());
342  }
343  std::sort(Result.begin(), Result.end(), LessByNameComp{});
344 
345  auto NewIt = std::unique(Result.begin(), Result.end(), EqualByNameComp{});
346  Result.erase(NewIt, Result.end());
347 
348  return Result;
349  }
350 
351  kernel
352  get_kernel(const kernel_id &KernelID,
353  const std::shared_ptr<detail::kernel_bundle_impl> &Self) const {
354 
355  auto It = std::find_if(MDeviceImages.begin(), MDeviceImages.end(),
356  [&KernelID](const device_image_plain &DeviceImage) {
357  return DeviceImage.has_kernel(KernelID);
358  });
359 
360  if (MDeviceImages.end() == It)
361  throw sycl::exception(make_error_code(errc::invalid),
362  "The kernel bundle does not contain the kernel "
363  "identified by kernelId.");
364 
365  const std::shared_ptr<detail::device_image_impl> &DeviceImageImpl =
367 
368  RT::PiKernel Kernel = nullptr;
369  const KernelArgMask *ArgMask = nullptr;
370  std::tie(Kernel, std::ignore, ArgMask) =
371  detail::ProgramManager::getInstance().getOrCreateKernel(
372  MContext, KernelID.get_name(), /*PropList=*/{},
373  DeviceImageImpl->get_program_ref());
374 
375  std::shared_ptr<kernel_impl> KernelImpl =
376  std::make_shared<kernel_impl>(Kernel, detail::getSyclObjImpl(MContext),
377  DeviceImageImpl, Self, ArgMask);
378 
379  return detail::createSyclObjFromImpl<kernel>(KernelImpl);
380  }
381 
382  bool has_kernel(const kernel_id &KernelID) const noexcept {
383  return std::any_of(MDeviceImages.begin(), MDeviceImages.end(),
384  [&KernelID](const device_image_plain &DeviceImage) {
385  return DeviceImage.has_kernel(KernelID);
386  });
387  }
388 
389  bool has_kernel(const kernel_id &KernelID, const device &Dev) const noexcept {
390  return std::any_of(
391  MDeviceImages.begin(), MDeviceImages.end(),
392  [&KernelID, &Dev](const device_image_plain &DeviceImage) {
393  return DeviceImage.has_kernel(KernelID, Dev);
394  });
395  }
396 
397  bool contains_specialization_constants() const noexcept {
398  return std::any_of(
399  MDeviceImages.begin(), MDeviceImages.end(),
400  [](const device_image_plain &DeviceImage) {
401  return getSyclObjImpl(DeviceImage)->has_specialization_constants();
402  });
403  }
404 
405  bool native_specialization_constant() const noexcept {
406  return contains_specialization_constants() &&
407  std::all_of(MDeviceImages.begin(), MDeviceImages.end(),
408  [](const device_image_plain &DeviceImage) {
409  return getSyclObjImpl(DeviceImage)
410  ->all_specialization_constant_native();
411  });
412  }
413 
414  bool has_specialization_constant(const char *SpecName) const noexcept {
415  return std::any_of(MDeviceImages.begin(), MDeviceImages.end(),
416  [SpecName](const device_image_plain &DeviceImage) {
417  return getSyclObjImpl(DeviceImage)
418  ->has_specialization_constant(SpecName);
419  });
420  }
421 
422  void set_specialization_constant_raw_value(const char *SpecName,
423  const void *Value,
424  size_t Size) noexcept {
425  if (has_specialization_constant(SpecName))
426  for (const device_image_plain &DeviceImage : MDeviceImages)
427  getSyclObjImpl(DeviceImage)
428  ->set_specialization_constant_raw_value(SpecName, Value);
429  else {
430  std::vector<unsigned char> &Val = MSpecConstValues[std::string{SpecName}];
431  Val.resize(Size);
432  std::memcpy(Val.data(), Value, Size);
433  }
434  }
435 
436  void get_specialization_constant_raw_value(const char *SpecName,
437  void *ValueRet) const noexcept {
438  for (const device_image_plain &DeviceImage : MDeviceImages)
439  if (getSyclObjImpl(DeviceImage)->has_specialization_constant(SpecName)) {
440  getSyclObjImpl(DeviceImage)
441  ->get_specialization_constant_raw_value(SpecName, ValueRet);
442  return;
443  }
444 
445  // Specialization constant wasn't found in any of the device images,
446  // try to fetch value from kernel_bundle.
447  if (MSpecConstValues.count(std::string{SpecName}) != 0) {
448  const std::vector<unsigned char> &Val =
449  MSpecConstValues.at(std::string{SpecName});
450  auto *Dest = static_cast<unsigned char *>(ValueRet);
451  std::uninitialized_copy(Val.begin(), Val.end(), Dest);
452  return;
453  }
454 
455  assert(false &&
456  "get_specialization_constant_raw_value called for missing constant");
457  }
458 
459  bool is_specialization_constant_set(const char *SpecName) const noexcept {
460  bool SetInDevImg =
461  std::any_of(MDeviceImages.begin(), MDeviceImages.end(),
462  [SpecName](const device_image_plain &DeviceImage) {
463  return getSyclObjImpl(DeviceImage)
464  ->is_specialization_constant_set(SpecName);
465  });
466  return SetInDevImg || MSpecConstValues.count(std::string{SpecName}) != 0;
467  }
468 
469  const device_image_plain *begin() const { return MDeviceImages.data(); }
470 
471  const device_image_plain *end() const {
472  return MDeviceImages.data() + MDeviceImages.size();
473  }
474 
475  size_t size() const noexcept { return MDeviceImages.size(); }
476 
477  bundle_state get_bundle_state() const { return MState; }
478 
479  const SpecConstMapT &get_spec_const_map_ref() const noexcept {
480  return MSpecConstValues;
481  }
482 
483  bool isInterop() const { return MIsInterop; }
484 
485  bool add_kernel(const kernel_id &KernelID, const device &Dev) {
486  // Skip if kernel is already there
487  if (has_kernel(KernelID, Dev))
488  return true;
489 
490  // First try and get images in current bundle state
491  const bundle_state BundleState = get_bundle_state();
492  std::vector<device_image_plain> NewDevImgs =
493  detail::ProgramManager::getInstance().getSYCLDeviceImages(
494  MContext, {Dev}, {KernelID}, BundleState);
495 
496  // No images found so we report as not inserted
497  if (NewDevImgs.empty())
498  return false;
499 
500  // Propagate already set specialization constants to the new images
501  for (device_image_plain &DevImg : NewDevImgs)
502  for (auto SpecConst : MSpecConstValues)
503  getSyclObjImpl(DevImg)->set_specialization_constant_raw_value(
504  SpecConst.first.c_str(), SpecConst.second.data());
505 
506  // Add the images to the collection
507  MDeviceImages.insert(MDeviceImages.end(), NewDevImgs.begin(),
508  NewDevImgs.end());
509  return true;
510  }
511 
512 private:
513  context MContext;
514  std::vector<device> MDevices;
515  std::vector<device_image_plain> MDeviceImages;
516  // This map stores values for specialization constants, that are missing
517  // from any device image.
518  SpecConstMapT MSpecConstValues;
519  bool MIsInterop = false;
520  bundle_state MState;
521 };
522 
523 } // namespace detail
524 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
525 } // namespace sycl
sycl::_V1::build
kernel_bundle< bundle_state::executable > build(const kernel_bundle< bundle_state::input > &InputBundle, const std::vector< device > &Devs, const property_list &PropList={})
Definition: kernel_bundle.hpp:723
sycl::_V1::property_list
Objects of the property_list class are containers for the SYCL properties.
Definition: property_list.hpp:24
sycl::_V1::detail::LessByNameComp
Definition: kernel_id_impl.hpp:16
sycl::_V1::detail::checkAllDevicesAreInContext
static bool checkAllDevicesAreInContext(const std::vector< device > &Devices, const context &Context)
Definition: kernel_bundle_impl.hpp:31
sycl::_V1::detail::kernel_bundle_impl::get_context
context get_context() const noexcept
Definition: kernel_bundle_impl.hpp:329
pi.h
sycl::_V1::detail::kernel_bundle_impl::kernel_bundle_impl
kernel_bundle_impl(const std::vector< detail::KernelBundleImplPtr > &Bundles, bundle_state State)
Definition: kernel_bundle_impl.hpp:255
sycl::_V1::backend
backend
Definition: backend_types.hpp:21
sycl::_V1::compile
kernel_bundle< bundle_state::object > compile(const kernel_bundle< bundle_state::input > &InputBundle, const std::vector< device > &Devs, const property_list &PropList={})
Definition: kernel_bundle.hpp:641
sycl::_V1::make_error_code
std::error_code make_error_code(sycl::errc E) noexcept
Constructs an error code using e and sycl_category()
Definition: exception.cpp:94
sycl::_V1::detail::kernel_bundle_impl::has_specialization_constant
bool has_specialization_constant(const char *SpecName) const noexcept
Definition: kernel_bundle_impl.hpp:414
sycl::_V1::detail::kernel_bundle_impl::kernel_bundle_impl
kernel_bundle_impl(context Ctx, std::vector< device > Devs, const std::vector< kernel_id > &KernelIDs, bundle_state State)
Definition: kernel_bundle_impl.hpp:233
device.hpp
sycl::_V1::detail::DeviceImageImplPtr
std::shared_ptr< device_image_impl > DeviceImageImplPtr
Definition: kernel_bundle.hpp:72
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:11
sycl::_V1::detail::kernel_bundle_impl::begin
const device_image_plain * begin() const
Definition: kernel_bundle_impl.hpp:469
sycl::_V1::detail::kernel_bundle_impl::add_kernel
bool add_kernel(const kernel_id &KernelID, const device &Dev)
Definition: kernel_bundle_impl.hpp:485
sycl::_V1::detail::memcpy
void memcpy(void *Dst, const void *Src, size_t Size)
Definition: memcpy.hpp:16
sycl::_V1::detail::kernel_bundle_impl::get_bundle_state
bundle_state get_bundle_state() const
Definition: kernel_bundle_impl.hpp:477
sycl::_V1::detail::kernel_bundle_impl::get_devices
const std::vector< device > & get_devices() const noexcept
Definition: kernel_bundle_impl.hpp:331
sycl::_V1::detail::tie
auto tie(Ts &...Args)
Definition: tuple.hpp:40
sycl::_V1::detail::for_each
Function for_each(Group g, Ptr first, Ptr last, Function f)
Definition: group_algorithm.hpp:172
context.hpp
sycl::_V1::detail::kernel_bundle_impl::kernel_bundle_impl
kernel_bundle_impl(const std::vector< kernel_bundle< bundle_state::object >> &ObjectBundles, std::vector< device > Devs, const property_list &PropList)
Definition: kernel_bundle_impl.hpp:154
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14
sycl::_V1::detail::KernelBundleImplPtr
std::shared_ptr< detail::kernel_bundle_impl > KernelBundleImplPtr
Definition: kernel_bundle.hpp:138
sycl::_V1::detail::EqualByNameComp
Definition: kernel_id_impl.hpp:23
sycl::_V1::kernel
Provides an abstraction of a SYCL kernel.
Definition: kernel.hpp:72
sycl::_V1::detail::kernel_bundle_impl::end
const device_image_plain * end() const
Definition: kernel_bundle_impl.hpp:471
sycl::_V1::detail::kernel_bundle_impl::kernel_bundle_impl
kernel_bundle_impl(const kernel_bundle< bundle_state::input > &InputBundle, std::vector< device > Devs, const property_list &PropList, bundle_state TargetState)
Definition: kernel_bundle_impl.hpp:103
sycl::_V1::detail::kernel_bundle_impl::isInterop
bool isInterop() const
Definition: kernel_bundle_impl.hpp:483
sycl::_V1::detail::LessByHash
Definition: device_image_impl.hpp:35
sycl::_V1::detail::kernel_bundle_impl::is_specialization_constant_set
bool is_specialization_constant_set(const char *SpecName) const noexcept
Definition: kernel_bundle_impl.hpp:459
kernel_bundle.hpp
sycl::_V1::detail::kernel_bundle_impl::kernel_bundle_impl
kernel_bundle_impl(context Ctx, std::vector< device > Devs)
Definition: kernel_bundle_impl.hpp:83
sycl::_V1::detail::kernel_bundle_impl::kernel_bundle_impl
kernel_bundle_impl(context Ctx, std::vector< device > Devs, const DevImgSelectorImpl &Selector, bundle_state State)
Definition: kernel_bundle_impl.hpp:244
sycl::_V1::detail::KernelArgMask
std::vector< bool > KernelArgMask
Definition: kernel_arg_mask.hpp:16
sycl::_V1::detail::kernel_bundle_impl::set_specialization_constant_raw_value
void set_specialization_constant_raw_value(const char *SpecName, const void *Value, size_t Size) noexcept
Definition: kernel_bundle_impl.hpp:422
sycl::_V1::kernel_id
Objects of the class identify kernel is some kernel_bundle related APIs.
Definition: kernel_bundle.hpp:44
sycl::_V1::kernel_bundle
The kernel_bundle class represents collection of device images in a particular state.
Definition: kernel.hpp:30
common.hpp
sycl::_V1::detail::kernel_bundle_impl::get_backend
backend get_backend() const noexcept
Definition: kernel_bundle_impl.hpp:325
sycl::_V1::device
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:49
sycl::_V1::detail::kernel_bundle_impl::has_kernel
bool has_kernel(const kernel_id &KernelID) const noexcept
Definition: kernel_bundle_impl.hpp:382
none_of
bool none_of(const simd_mask< _Tp, _Abi > &) noexcept
program_manager.hpp
sycl::_V1::detail::pi::PiKernel
::pi_kernel PiKernel
Definition: pi.hpp:133
sycl::_V1::detail::kernel_bundle_impl::kernel_bundle_impl
kernel_bundle_impl(context Ctx, std::vector< device > Devs, device_image_plain &DevImage)
Definition: kernel_bundle_impl.hpp:94
sycl::_V1::detail::kernel_bundle_impl::kernel_bundle_impl
kernel_bundle_impl(context Ctx, std::vector< device > Devs, bundle_state State)
Definition: kernel_bundle_impl.hpp:73
all_of
bool all_of(const simd_mask< _Tp, _Abi > &) noexcept
sycl::_V1::detail::kernel_bundle_impl::get_kernel_ids
std::vector< kernel_id > get_kernel_ids() const
Definition: kernel_bundle_impl.hpp:333
device_image_impl.hpp
sycl::_V1::detail::kernel_bundle_impl::get_specialization_constant_raw_value
void get_specialization_constant_raw_value(const char *SpecName, void *ValueRet) const noexcept
Definition: kernel_bundle_impl.hpp:436
sycl::_V1::detail::device_image_plain
Definition: kernel_bundle.hpp:76
backend_types.hpp
std
Definition: accessor.hpp:3914
sycl::_V1::detail::kernel_bundle_impl::size
size_t size() const noexcept
Definition: kernel_bundle_impl.hpp:475
any_of
bool any_of(const simd_mask< _Tp, _Abi > &) noexcept
sycl::_V1::detail::kernel_bundle_impl
Definition: kernel_bundle_impl.hpp:48
kernel_impl.hpp
sycl::_V1::detail::kernel_bundle_impl::contains_specialization_constants
bool contains_specialization_constants() const noexcept
Definition: kernel_bundle_impl.hpp:397
sycl::_V1::bundle_state
bundle_state
Definition: kernel_bundle_enums.hpp:14
sycl::_V1::kernel_id::get_name
const char * get_name() const noexcept
Definition: kernel_bundle.cpp:21
sycl::_V1::detail::kernel_bundle_impl::get_spec_const_map_ref
const SpecConstMapT & get_spec_const_map_ref() const noexcept
Definition: kernel_bundle_impl.hpp:479
sycl::_V1::detail::checkAllDevicesHaveAspect
static bool checkAllDevicesHaveAspect(const std::vector< device > &Devices, aspect Aspect)
Definition: kernel_bundle_impl.hpp:39
sycl::_V1::detail::kernel_bundle_impl::has_kernel
bool has_kernel(const kernel_id &KernelID, const device &Dev) const noexcept
Definition: kernel_bundle_impl.hpp:389
sycl::_V1::detail::kernel_bundle_impl::get_kernel
kernel get_kernel(const kernel_id &KernelID, const std::shared_ptr< detail::kernel_bundle_impl > &Self) const
Definition: kernel_bundle_impl.hpp:352
sycl::_V1::bundle_state::executable
@ executable
sycl::_V1::detail::kernel_bundle_impl::native_specialization_constant
bool native_specialization_constant() const noexcept
Definition: kernel_bundle_impl.hpp:405
sycl::_V1::detail::getSyclObjImpl
decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject)
Definition: common.hpp:302
sycl::_V1::detail::kernel_bundle_impl::empty
bool empty() const noexcept
Definition: kernel_bundle_impl.hpp:323
sycl::_V1::context
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:41
sycl::_V1::detail::DevImgSelectorImpl
std::function< bool(const detail::DeviceImageImplPtr &DevImgImpl)> DevImgSelectorImpl
Definition: kernel_bundle.hpp:479