DPC++ Runtime
Runtime libraries for oneAPI DPC++
cg.hpp
Go to the documentation of this file.
1 //==-------------- CG.hpp - SYCL standard header file ----------------------==//
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 <sycl/accessor.hpp> // for AccessorImplHost, AccessorImplPtr
12 #include <sycl/detail/cg_types.hpp> // for ArgDesc, HostTask, HostKernelBase
13 #include <sycl/detail/common.hpp> // for code_location
14 #include <sycl/detail/helpers.hpp> // for context_impl
15 #include <sycl/detail/pi.h> // for pi_mem_advice, _pi_ext_command_b...
16 #include <sycl/detail/pi.hpp> // for PiImageOffset, PiImageRegion
17 #include <sycl/event.hpp> // for event_impl
18 #include <sycl/exception_list.hpp> // for queue_impl
19 #include <sycl/kernel.hpp> // for kernel_impl
20 #include <sycl/kernel_bundle.hpp> // for kernel_bundle_impl
21 
22 #include <assert.h> // for assert
23 #include <memory> // for shared_ptr, unique_ptr
24 #include <stddef.h> // for size_t
25 #include <stdint.h> // for int32_t
26 #include <string> // for string
27 #include <utility> // for move
28 #include <vector> // for vector
29 
30 namespace sycl {
31 inline namespace _V1 {
32 
33 // Forward declarations
34 class queue;
35 
36 namespace ext::oneapi::experimental::detail {
37 class exec_graph_impl;
38 }
39 
40 namespace detail {
41 
42 class event_impl;
43 using EventImplPtr = std::shared_ptr<event_impl>;
44 
45 class stream_impl;
46 class queue_impl;
47 class kernel_bundle_impl;
48 
49 // If there's a need to add new members to CG classes without breaking ABI
50 // compatibility, we can bring back the extended members mechanism. See
51 // https://github.com/intel/llvm/pull/6759
53 class CG {
54 public:
56  enum CGTYPE : unsigned int {
57  None = 0,
58  Kernel = 1,
62  Barrier = 5,
64  Fill = 7,
66  CopyUSM = 10,
67  FillUSM = 11,
70  AdviseUSM = 15,
71  Copy2DUSM = 16,
72  Fill2DUSM = 17,
78  CopyImage = 23,
81  };
82 
84  StorageInitHelper() = default;
85  StorageInitHelper(std::vector<std::vector<char>> ArgsStorage,
86  std::vector<detail::AccessorImplPtr> AccStorage,
87  std::vector<std::shared_ptr<const void>> SharedPtrStorage,
88  std::vector<AccessorImplHost *> Requirements,
89  std::vector<detail::EventImplPtr> Events)
90  : MArgsStorage(std::move(ArgsStorage)),
91  MAccStorage(std::move(AccStorage)),
92  MSharedPtrStorage(std::move(SharedPtrStorage)),
93  MRequirements(std::move(Requirements)), MEvents(std::move(Events)) {}
96  // The following storages are needed to ensure that arguments won't die
97  // while we are using them.
99  std::vector<std::vector<char>> MArgsStorage;
101  std::vector<detail::AccessorImplPtr> MAccStorage;
103  std::vector<std::shared_ptr<const void>> MSharedPtrStorage;
104 
107  std::vector<AccessorImplHost *> MRequirements;
109  std::vector<detail::EventImplPtr> MEvents;
110  };
111 
113  : MType(Type), MData(std::move(D)) {
114  // Capture the user code-location from Q.submit(), Q.parallel_for()
115  // etc for later use; if code location information is not available,
116  // the file name and function name members will be empty strings
117  if (loc.functionName())
118  MFunctionName = loc.functionName();
119  if (loc.fileName())
120  MFileName = loc.fileName();
121  MLine = loc.lineNumber();
122  MColumn = loc.columnNumber();
123  }
124 
125  CG(CG &&CommandGroup) = default;
126  CG(const CG &CommandGroup) = default;
127 
128  CGTYPE getType() const { return MType; }
129 
130  std::vector<std::vector<char>> &getArgsStorage() {
131  return MData.MArgsStorage;
132  }
133  std::vector<detail::AccessorImplPtr> &getAccStorage() {
134  return MData.MAccStorage;
135  }
136  std::vector<std::shared_ptr<const void>> &getSharedPtrStorage() {
137  return MData.MSharedPtrStorage;
138  }
139 
140  std::vector<AccessorImplHost *> &getRequirements() {
141  return MData.MRequirements;
142  }
143  std::vector<detail::EventImplPtr> &getEvents() { return MData.MEvents; }
144 
145  virtual std::vector<std::shared_ptr<const void>>
147  return {};
148  }
149  virtual void clearAuxiliaryResources(){};
150 
151  virtual ~CG() = default;
152 
153 private:
154  CGTYPE MType;
155  StorageInitHelper MData;
156 
157 public:
158  // Member variables to capture the user code-location
159  // information from Q.submit(), Q.parallel_for() etc
160  // Storage for function name and source file name
162  // Storage for line and column of code location
163  int32_t MLine, MColumn;
164 };
165 
167 class CGExecKernel : public CG {
168 public:
171  std::shared_ptr<HostKernelBase> MHostKernel;
172  std::shared_ptr<detail::kernel_impl> MSyclKernel;
173  std::shared_ptr<detail::kernel_bundle_impl> MKernelBundle;
174  std::vector<ArgDesc> MArgs;
176  std::vector<std::shared_ptr<detail::stream_impl>> MStreams;
177  std::vector<std::shared_ptr<const void>> MAuxiliaryResources;
179  bool MKernelIsCooperative = false;
180 
181  CGExecKernel(NDRDescT NDRDesc, std::shared_ptr<HostKernelBase> HKernel,
182  std::shared_ptr<detail::kernel_impl> SyclKernel,
183  std::shared_ptr<detail::kernel_bundle_impl> KernelBundle,
184  CG::StorageInitHelper CGData, std::vector<ArgDesc> Args,
185  std::string KernelName,
186  std::vector<std::shared_ptr<detail::stream_impl>> Streams,
187  std::vector<std::shared_ptr<const void>> AuxiliaryResources,
188  CGTYPE Type,
189  sycl::detail::pi::PiKernelCacheConfig KernelCacheConfig,
190  bool KernelIsCooperative, detail::code_location loc = {})
191  : CG(Type, std::move(CGData), std::move(loc)),
192  MNDRDesc(std::move(NDRDesc)), MHostKernel(std::move(HKernel)),
193  MSyclKernel(std::move(SyclKernel)),
194  MKernelBundle(std::move(KernelBundle)), MArgs(std::move(Args)),
195  MKernelName(std::move(KernelName)), MStreams(std::move(Streams)),
196  MAuxiliaryResources(std::move(AuxiliaryResources)),
197  MKernelCacheConfig(std::move(KernelCacheConfig)),
198  MKernelIsCooperative(KernelIsCooperative) {
199  assert(getType() == Kernel && "Wrong type of exec kernel CG.");
200  }
201 
202  CGExecKernel(const CGExecKernel &CGExec) = default;
203 
204  std::vector<ArgDesc> getArguments() const { return MArgs; }
206  std::vector<std::shared_ptr<detail::stream_impl>> getStreams() const {
207  return MStreams;
208  }
209 
210  std::vector<std::shared_ptr<const void>>
211  getAuxiliaryResources() const override {
212  return MAuxiliaryResources;
213  }
214  void clearAuxiliaryResources() override { MAuxiliaryResources.clear(); }
215 
216  std::shared_ptr<detail::kernel_bundle_impl> getKernelBundle() {
217  return MKernelBundle;
218  }
219 
220  void clearStreams() { MStreams.clear(); }
221  bool hasStreams() { return !MStreams.empty(); }
222 };
223 
225 class CGCopy : public CG {
226  void *MSrc;
227  void *MDst;
228  std::vector<std::shared_ptr<const void>> MAuxiliaryResources;
229 
230 public:
231  CGCopy(CGTYPE CopyType, void *Src, void *Dst, CG::StorageInitHelper CGData,
232  std::vector<std::shared_ptr<const void>> AuxiliaryResources,
233  detail::code_location loc = {})
234  : CG(CopyType, std::move(CGData), std::move(loc)), MSrc(Src), MDst(Dst),
235  MAuxiliaryResources{AuxiliaryResources} {}
236  void *getSrc() { return MSrc; }
237  void *getDst() { return MDst; }
238 
239  std::vector<std::shared_ptr<const void>>
240  getAuxiliaryResources() const override {
241  return MAuxiliaryResources;
242  }
243  void clearAuxiliaryResources() override { MAuxiliaryResources.clear(); }
244 };
245 
247 class CGFill : public CG {
248 public:
249  std::vector<char> MPattern;
251 
252  CGFill(std::vector<char> Pattern, void *Ptr, CG::StorageInitHelper CGData,
253  detail::code_location loc = {})
254  : CG(Fill, std::move(CGData), std::move(loc)),
255  MPattern(std::move(Pattern)), MPtr((AccessorImplHost *)Ptr) {}
257 };
258 
260 class CGUpdateHost : public CG {
261  AccessorImplHost *MPtr;
262 
263 public:
265  detail::code_location loc = {})
266  : CG(UpdateHost, std::move(CGData), std::move(loc)),
267  MPtr((AccessorImplHost *)Ptr) {}
268 
269  AccessorImplHost *getReqToUpdate() { return MPtr; }
270 };
271 
273 class CGCopyUSM : public CG {
274  void *MSrc;
275  void *MDst;
276  size_t MLength;
277 
278 public:
279  CGCopyUSM(void *Src, void *Dst, size_t Length, CG::StorageInitHelper CGData,
280  detail::code_location loc = {})
281  : CG(CopyUSM, std::move(CGData), std::move(loc)), MSrc(Src), MDst(Dst),
282  MLength(Length) {}
283 
284  void *getSrc() { return MSrc; }
285  void *getDst() { return MDst; }
286  size_t getLength() { return MLength; }
287 };
288 
290 class CGFillUSM : public CG {
291  std::vector<char> MPattern;
292  void *MDst;
293  size_t MLength;
294 
295 public:
296  CGFillUSM(std::vector<char> Pattern, void *DstPtr, size_t Length,
298  : CG(FillUSM, std::move(CGData), std::move(loc)),
299  MPattern(std::move(Pattern)), MDst(DstPtr), MLength(Length) {}
300  void *getDst() { return MDst; }
301  size_t getLength() { return MLength; }
302  int getFill() { return MPattern[0]; }
303 };
304 
306 class CGPrefetchUSM : public CG {
307  void *MDst;
308  size_t MLength;
309 
310 public:
311  CGPrefetchUSM(void *DstPtr, size_t Length, CG::StorageInitHelper CGData,
312  detail::code_location loc = {})
313  : CG(PrefetchUSM, std::move(CGData), std::move(loc)), MDst(DstPtr),
314  MLength(Length) {}
315  void *getDst() { return MDst; }
316  size_t getLength() { return MLength; }
317 };
318 
320 class CGAdviseUSM : public CG {
321  void *MDst;
322  size_t MLength;
323  pi_mem_advice MAdvice;
324 
325 public:
326  CGAdviseUSM(void *DstPtr, size_t Length, pi_mem_advice Advice,
327  CG::StorageInitHelper CGData, CGTYPE Type,
328  detail::code_location loc = {})
329  : CG(Type, std::move(CGData), std::move(loc)), MDst(DstPtr),
330  MLength(Length), MAdvice(Advice) {}
331  void *getDst() { return MDst; }
332  size_t getLength() { return MLength; }
333  pi_mem_advice getAdvice() { return MAdvice; }
334 };
335 
336 class CGHostTask : public CG {
337 public:
338  std::unique_ptr<HostTask> MHostTask;
339  // queue for host-interop task
340  std::shared_ptr<detail::queue_impl> MQueue;
341  // context for host-interop task
342  std::shared_ptr<detail::context_impl> MContext;
343  std::vector<ArgDesc> MArgs;
344 
345  CGHostTask(std::unique_ptr<HostTask> HostTask,
346  std::shared_ptr<detail::queue_impl> Queue,
347  std::shared_ptr<detail::context_impl> Context,
348  std::vector<ArgDesc> Args, CG::StorageInitHelper CGData,
349  CGTYPE Type, detail::code_location loc = {})
350  : CG(Type, std::move(CGData), std::move(loc)),
351  MHostTask(std::move(HostTask)), MQueue(Queue), MContext(Context),
352  MArgs(std::move(Args)) {}
353 };
354 
355 class CGBarrier : public CG {
356 public:
357  std::vector<detail::EventImplPtr> MEventsWaitWithBarrier;
358 
359  CGBarrier(std::vector<detail::EventImplPtr> EventsWaitWithBarrier,
360  CG::StorageInitHelper CGData, CGTYPE Type,
361  detail::code_location loc = {})
362  : CG(Type, std::move(CGData), std::move(loc)),
363  MEventsWaitWithBarrier(std::move(EventsWaitWithBarrier)) {}
364 };
365 
367 class CGCopy2DUSM : public CG {
368  void *MSrc;
369  void *MDst;
370  size_t MSrcPitch;
371  size_t MDstPitch;
372  size_t MWidth;
373  size_t MHeight;
374 
375 public:
376  CGCopy2DUSM(void *Src, void *Dst, size_t SrcPitch, size_t DstPitch,
377  size_t Width, size_t Height, CG::StorageInitHelper CGData,
378  detail::code_location loc = {})
379  : CG(Copy2DUSM, std::move(CGData), std::move(loc)), MSrc(Src), MDst(Dst),
380  MSrcPitch(SrcPitch), MDstPitch(DstPitch), MWidth(Width),
381  MHeight(Height) {}
382 
383  void *getSrc() const { return MSrc; }
384  void *getDst() const { return MDst; }
385  size_t getSrcPitch() const { return MSrcPitch; }
386  size_t getDstPitch() const { return MDstPitch; }
387  size_t getWidth() const { return MWidth; }
388  size_t getHeight() const { return MHeight; }
389 };
390 
392 class CGFill2DUSM : public CG {
393  std::vector<char> MPattern;
394  void *MDst;
395  size_t MPitch;
396  size_t MWidth;
397  size_t MHeight;
398 
399 public:
400  CGFill2DUSM(std::vector<char> Pattern, void *DstPtr, size_t Pitch,
401  size_t Width, size_t Height, CG::StorageInitHelper CGData,
402  detail::code_location loc = {})
403  : CG(Fill2DUSM, std::move(CGData), std::move(loc)),
404  MPattern(std::move(Pattern)), MDst(DstPtr), MPitch(Pitch),
405  MWidth(Width), MHeight(Height) {}
406  void *getDst() const { return MDst; }
407  size_t getPitch() const { return MPitch; }
408  size_t getWidth() const { return MWidth; }
409  size_t getHeight() const { return MHeight; }
410  const std::vector<char> &getPattern() const { return MPattern; }
411 };
412 
414 class CGMemset2DUSM : public CG {
415  char MValue;
416  void *MDst;
417  size_t MPitch;
418  size_t MWidth;
419  size_t MHeight;
420 
421 public:
422  CGMemset2DUSM(char Value, void *DstPtr, size_t Pitch, size_t Width,
423  size_t Height, CG::StorageInitHelper CGData,
424  detail::code_location loc = {})
425  : CG(Memset2DUSM, std::move(CGData), std::move(loc)), MValue(Value),
426  MDst(DstPtr), MPitch(Pitch), MWidth(Width), MHeight(Height) {}
427  void *getDst() const { return MDst; }
428  size_t getPitch() const { return MPitch; }
429  size_t getWidth() const { return MWidth; }
430  size_t getHeight() const { return MHeight; }
431  char getValue() const { return MValue; }
432 };
433 
435 class CGReadWriteHostPipe : public CG {
436  std::string PipeName;
437  bool Blocking;
438  void *HostPtr;
439  size_t TypeSize;
440  bool IsReadOp;
441 
442 public:
443  CGReadWriteHostPipe(const std::string &Name, bool Block, void *Ptr,
444  size_t Size, bool Read, CG::StorageInitHelper CGData,
445  detail::code_location loc = {})
446  : CG(ReadWriteHostPipe, std::move(CGData), std::move(loc)),
447  PipeName(Name), Blocking(Block), HostPtr(Ptr), TypeSize(Size),
448  IsReadOp(Read) {}
449 
450  std::string getPipeName() { return PipeName; }
451  void *getHostPtr() { return HostPtr; }
452  size_t getTypeSize() { return TypeSize; }
453  bool isBlocking() { return Blocking; }
454  bool isReadHostPipe() { return IsReadOp; }
455 };
456 
458 class CGCopyToDeviceGlobal : public CG {
459  void *MSrc;
460  void *MDeviceGlobalPtr;
461  bool MIsDeviceImageScoped;
462  size_t MNumBytes;
463  size_t MOffset;
464 
465 public:
466  CGCopyToDeviceGlobal(void *Src, void *DeviceGlobalPtr,
467  bool IsDeviceImageScoped, size_t NumBytes, size_t Offset,
468  CG::StorageInitHelper CGData,
469  detail::code_location loc = {})
470  : CG(CopyToDeviceGlobal, std::move(CGData), std::move(loc)), MSrc(Src),
471  MDeviceGlobalPtr(DeviceGlobalPtr),
472  MIsDeviceImageScoped(IsDeviceImageScoped), MNumBytes(NumBytes),
473  MOffset(Offset) {}
474 
475  void *getSrc() { return MSrc; }
476  void *getDeviceGlobalPtr() { return MDeviceGlobalPtr; }
477  bool isDeviceImageScoped() { return MIsDeviceImageScoped; }
478  size_t getNumBytes() { return MNumBytes; }
479  size_t getOffset() { return MOffset; }
480 };
481 
483 class CGCopyFromDeviceGlobal : public CG {
484  void *MDeviceGlobalPtr;
485  void *MDest;
486  bool MIsDeviceImageScoped;
487  size_t MNumBytes;
488  size_t MOffset;
489 
490 public:
491  CGCopyFromDeviceGlobal(void *DeviceGlobalPtr, void *Dest,
492  bool IsDeviceImageScoped, size_t NumBytes,
493  size_t Offset, CG::StorageInitHelper CGData,
494  detail::code_location loc = {})
495  : CG(CopyFromDeviceGlobal, std::move(CGData), std::move(loc)),
496  MDeviceGlobalPtr(DeviceGlobalPtr), MDest(Dest),
497  MIsDeviceImageScoped(IsDeviceImageScoped), MNumBytes(NumBytes),
498  MOffset(Offset) {}
499 
500  void *getDeviceGlobalPtr() { return MDeviceGlobalPtr; }
501  void *getDest() { return MDest; }
502  bool isDeviceImageScoped() { return MIsDeviceImageScoped; }
503  size_t getNumBytes() { return MNumBytes; }
504  size_t getOffset() { return MOffset; }
505 };
507 class CGCopyImage : public CG {
508  void *MSrc;
509  void *MDst;
512  sycl::detail::pi::PiImageCopyFlags MImageCopyFlags;
517 
518 public:
519  CGCopyImage(void *Src, void *Dst, sycl::detail::pi::PiMemImageDesc ImageDesc,
521  sycl::detail::pi::PiImageCopyFlags ImageCopyFlags,
527  : CG(CopyImage, std::move(CGData), std::move(loc)), MSrc(Src), MDst(Dst),
528  MImageDesc(ImageDesc), MImageFormat(ImageFormat),
529  MImageCopyFlags(ImageCopyFlags), MSrcOffset(SrcOffset),
530  MDstOffset(DstOffset), MHostExtent(HostExtent),
531  MCopyExtent(CopyExtent) {}
532 
533  void *getSrc() const { return MSrc; }
534  void *getDst() const { return MDst; }
535  sycl::detail::pi::PiMemImageDesc getDesc() const { return MImageDesc; }
536  sycl::detail::pi::PiMemImageFormat getFormat() const { return MImageFormat; }
538  return MImageCopyFlags;
539  }
540  sycl::detail::pi::PiImageOffset getSrcOffset() const { return MSrcOffset; }
541  sycl::detail::pi::PiImageOffset getDstOffset() const { return MDstOffset; }
542  sycl::detail::pi::PiImageRegion getHostExtent() const { return MHostExtent; }
543  sycl::detail::pi::PiImageRegion getCopyExtent() const { return MCopyExtent; }
544 };
545 
547 class CGSemaphoreWait : public CG {
548  sycl::detail::pi::PiInteropSemaphoreHandle MInteropSemaphoreHandle;
549 
550 public:
552  sycl::detail::pi::PiInteropSemaphoreHandle InteropSemaphoreHandle,
554  : CG(SemaphoreWait, std::move(CGData), std::move(loc)),
555  MInteropSemaphoreHandle(InteropSemaphoreHandle) {}
556 
558  return MInteropSemaphoreHandle;
559  }
560 };
561 
563 class CGSemaphoreSignal : public CG {
564  sycl::detail::pi::PiInteropSemaphoreHandle MInteropSemaphoreHandle;
565 
566 public:
568  sycl::detail::pi::PiInteropSemaphoreHandle InteropSemaphoreHandle,
570  : CG(SemaphoreSignal, std::move(CGData), std::move(loc)),
571  MInteropSemaphoreHandle(InteropSemaphoreHandle) {}
572 
574  return MInteropSemaphoreHandle;
575  }
576 };
577 
579 class CGExecCommandBuffer : public CG {
580 public:
582  std::shared_ptr<sycl::ext::oneapi::experimental::detail::exec_graph_impl>
584 
586  const sycl::detail::pi::PiExtCommandBuffer &CommandBuffer,
587  const std::shared_ptr<
589  CG::StorageInitHelper CGData)
590  : CG(CGTYPE::ExecCommandBuffer, std::move(CGData)),
591  MCommandBuffer(CommandBuffer), MExecGraph(ExecGraph) {}
592 };
593 
594 } // namespace detail
595 } // namespace _V1
596 } // namespace sycl
The file contains implementations of accessor class.
"Advise USM" command group class.
Definition: cg.hpp:320
CGAdviseUSM(void *DstPtr, size_t Length, pi_mem_advice Advice, CG::StorageInitHelper CGData, CGTYPE Type, detail::code_location loc={})
Definition: cg.hpp:326
pi_mem_advice getAdvice()
Definition: cg.hpp:333
CGBarrier(std::vector< detail::EventImplPtr > EventsWaitWithBarrier, CG::StorageInitHelper CGData, CGTYPE Type, detail::code_location loc={})
Definition: cg.hpp:359
std::vector< detail::EventImplPtr > MEventsWaitWithBarrier
Definition: cg.hpp:357
"Copy 2D USM" command group class.
Definition: cg.hpp:367
size_t getDstPitch() const
Definition: cg.hpp:386
size_t getWidth() const
Definition: cg.hpp:387
void * getSrc() const
Definition: cg.hpp:383
void * getDst() const
Definition: cg.hpp:384
size_t getHeight() const
Definition: cg.hpp:388
size_t getSrcPitch() const
Definition: cg.hpp:385
CGCopy2DUSM(void *Src, void *Dst, size_t SrcPitch, size_t DstPitch, size_t Width, size_t Height, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:376
"Copy to device_global" command group class.
Definition: cg.hpp:483
CGCopyFromDeviceGlobal(void *DeviceGlobalPtr, void *Dest, bool IsDeviceImageScoped, size_t NumBytes, size_t Offset, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:491
"Copy Image" command group class.
Definition: cg.hpp:507
void * getDst() const
Definition: cg.hpp:534
sycl::detail::pi::PiImageOffset getDstOffset() const
Definition: cg.hpp:541
sycl::detail::pi::PiImageCopyFlags getCopyFlags() const
Definition: cg.hpp:537
void * getSrc() const
Definition: cg.hpp:533
CGCopyImage(void *Src, void *Dst, sycl::detail::pi::PiMemImageDesc ImageDesc, sycl::detail::pi::PiMemImageFormat ImageFormat, sycl::detail::pi::PiImageCopyFlags ImageCopyFlags, sycl::detail::pi::PiImageOffset SrcOffset, sycl::detail::pi::PiImageOffset DstOffset, sycl::detail::pi::PiImageRegion HostExtent, sycl::detail::pi::PiImageRegion CopyExtent, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:519
sycl::detail::pi::PiImageRegion getCopyExtent() const
Definition: cg.hpp:543
sycl::detail::pi::PiImageOffset getSrcOffset() const
Definition: cg.hpp:540
sycl::detail::pi::PiImageRegion getHostExtent() const
Definition: cg.hpp:542
sycl::detail::pi::PiMemImageFormat getFormat() const
Definition: cg.hpp:536
sycl::detail::pi::PiMemImageDesc getDesc() const
Definition: cg.hpp:535
"Copy to device_global" command group class.
Definition: cg.hpp:458
CGCopyToDeviceGlobal(void *Src, void *DeviceGlobalPtr, bool IsDeviceImageScoped, size_t NumBytes, size_t Offset, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:466
"Copy USM" command group class.
Definition: cg.hpp:273
CGCopyUSM(void *Src, void *Dst, size_t Length, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:279
"Copy memory" command group class.
Definition: cg.hpp:225
void clearAuxiliaryResources() override
Definition: cg.hpp:243
std::vector< std::shared_ptr< const void > > getAuxiliaryResources() const override
Definition: cg.hpp:240
CGCopy(CGTYPE CopyType, void *Src, void *Dst, CG::StorageInitHelper CGData, std::vector< std::shared_ptr< const void >> AuxiliaryResources, detail::code_location loc={})
Definition: cg.hpp:231
"Execute command-buffer" command group class.
Definition: cg.hpp:579
sycl::detail::pi::PiExtCommandBuffer MCommandBuffer
Definition: cg.hpp:581
CGExecCommandBuffer(const sycl::detail::pi::PiExtCommandBuffer &CommandBuffer, const std::shared_ptr< sycl::ext::oneapi::experimental::detail::exec_graph_impl > &ExecGraph, CG::StorageInitHelper CGData)
Definition: cg.hpp:585
std::shared_ptr< sycl::ext::oneapi::experimental::detail::exec_graph_impl > MExecGraph
Definition: cg.hpp:583
"Execute kernel" command group class.
Definition: cg.hpp:167
std::shared_ptr< detail::kernel_bundle_impl > MKernelBundle
Definition: cg.hpp:173
std::vector< std::shared_ptr< const void > > getAuxiliaryResources() const override
Definition: cg.hpp:211
std::vector< std::shared_ptr< const void > > MAuxiliaryResources
Definition: cg.hpp:177
void clearAuxiliaryResources() override
Definition: cg.hpp:214
std::string getKernelName() const
Definition: cg.hpp:205
std::vector< ArgDesc > MArgs
Definition: cg.hpp:174
NDRDescT MNDRDesc
Stores ND-range description.
Definition: cg.hpp:170
CGExecKernel(NDRDescT NDRDesc, std::shared_ptr< HostKernelBase > HKernel, std::shared_ptr< detail::kernel_impl > SyclKernel, std::shared_ptr< detail::kernel_bundle_impl > KernelBundle, CG::StorageInitHelper CGData, std::vector< ArgDesc > Args, std::string KernelName, std::vector< std::shared_ptr< detail::stream_impl >> Streams, std::vector< std::shared_ptr< const void >> AuxiliaryResources, CGTYPE Type, sycl::detail::pi::PiKernelCacheConfig KernelCacheConfig, bool KernelIsCooperative, detail::code_location loc={})
Definition: cg.hpp:181
sycl::detail::pi::PiKernelCacheConfig MKernelCacheConfig
Definition: cg.hpp:178
std::shared_ptr< detail::kernel_impl > MSyclKernel
Definition: cg.hpp:172
std::shared_ptr< HostKernelBase > MHostKernel
Definition: cg.hpp:171
CGExecKernel(const CGExecKernel &CGExec)=default
std::vector< std::shared_ptr< detail::stream_impl > > getStreams() const
Definition: cg.hpp:206
std::vector< std::shared_ptr< detail::stream_impl > > MStreams
Definition: cg.hpp:176
std::shared_ptr< detail::kernel_bundle_impl > getKernelBundle()
Definition: cg.hpp:216
std::vector< ArgDesc > getArguments() const
Definition: cg.hpp:204
"Fill 2D USM" command group class.
Definition: cg.hpp:392
void * getDst() const
Definition: cg.hpp:406
size_t getWidth() const
Definition: cg.hpp:408
CGFill2DUSM(std::vector< char > Pattern, void *DstPtr, size_t Pitch, size_t Width, size_t Height, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:400
size_t getHeight() const
Definition: cg.hpp:409
const std::vector< char > & getPattern() const
Definition: cg.hpp:410
size_t getPitch() const
Definition: cg.hpp:407
"Fill USM" command group class.
Definition: cg.hpp:290
CGFillUSM(std::vector< char > Pattern, void *DstPtr, size_t Length, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:296
"Fill memory" command group class.
Definition: cg.hpp:247
std::vector< char > MPattern
Definition: cg.hpp:249
AccessorImplHost * getReqToFill()
Definition: cg.hpp:256
AccessorImplHost * MPtr
Definition: cg.hpp:250
CGFill(std::vector< char > Pattern, void *Ptr, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:252
std::unique_ptr< HostTask > MHostTask
Definition: cg.hpp:338
CGHostTask(std::unique_ptr< HostTask > HostTask, std::shared_ptr< detail::queue_impl > Queue, std::shared_ptr< detail::context_impl > Context, std::vector< ArgDesc > Args, CG::StorageInitHelper CGData, CGTYPE Type, detail::code_location loc={})
Definition: cg.hpp:345
std::shared_ptr< detail::context_impl > MContext
Definition: cg.hpp:342
std::shared_ptr< detail::queue_impl > MQueue
Definition: cg.hpp:340
std::vector< ArgDesc > MArgs
Definition: cg.hpp:343
"Memset 2D USM" command group class.
Definition: cg.hpp:414
size_t getPitch() const
Definition: cg.hpp:428
size_t getWidth() const
Definition: cg.hpp:429
size_t getHeight() const
Definition: cg.hpp:430
CGMemset2DUSM(char Value, void *DstPtr, size_t Pitch, size_t Width, size_t Height, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:422
"Prefetch USM" command group class.
Definition: cg.hpp:306
CGPrefetchUSM(void *DstPtr, size_t Length, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:311
"ReadWriteHostPipe" command group class.
Definition: cg.hpp:435
CGReadWriteHostPipe(const std::string &Name, bool Block, void *Ptr, size_t Size, bool Read, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:443
"Semaphore Signal" command group class.
Definition: cg.hpp:563
sycl::detail::pi::PiInteropSemaphoreHandle getInteropSemaphoreHandle() const
Definition: cg.hpp:573
CGSemaphoreSignal(sycl::detail::pi::PiInteropSemaphoreHandle InteropSemaphoreHandle, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:567
"Semaphore Wait" command group class.
Definition: cg.hpp:547
CGSemaphoreWait(sycl::detail::pi::PiInteropSemaphoreHandle InteropSemaphoreHandle, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:551
sycl::detail::pi::PiInteropSemaphoreHandle getInteropSemaphoreHandle() const
Definition: cg.hpp:557
"Update host" command group class.
Definition: cg.hpp:260
AccessorImplHost * getReqToUpdate()
Definition: cg.hpp:269
CGUpdateHost(void *Ptr, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:264
Base class for all types of command groups.
Definition: cg.hpp:53
std::vector< detail::AccessorImplPtr > & getAccStorage()
Definition: cg.hpp:133
CG(CGTYPE Type, StorageInitHelper D, detail::code_location loc={})
Definition: cg.hpp:112
std::vector< detail::EventImplPtr > & getEvents()
Definition: cg.hpp:143
CG(const CG &CommandGroup)=default
std::vector< std::vector< char > > & getArgsStorage()
Definition: cg.hpp:130
virtual void clearAuxiliaryResources()
Definition: cg.hpp:149
virtual std::vector< std::shared_ptr< const void > > getAuxiliaryResources() const
Definition: cg.hpp:146
virtual ~CG()=default
std::string MFileName
Definition: cg.hpp:161
std::vector< AccessorImplHost * > & getRequirements()
Definition: cg.hpp:140
int32_t MColumn
Definition: cg.hpp:163
CG(CG &&CommandGroup)=default
std::vector< std::shared_ptr< const void > > & getSharedPtrStorage()
Definition: cg.hpp:136
CGTYPE getType() const
Definition: cg.hpp:128
CGTYPE
Type of the command group.
Definition: cg.hpp:56
std::string MFunctionName
Definition: cg.hpp:161
The class is an impl counterpart of the sycl::kernel_bundle.
Class representing the implementation of command_graph<executable>.
::pi_interop_semaphore_handle PiInteropSemaphoreHandle
Definition: pi.hpp:165
std::shared_ptr< event_impl > EventImplPtr
Definition: cg.hpp:43
std::string string
Definition: handler.hpp:426
Definition: access.hpp:18
_pi_kernel_cache_config
Definition: pi.h:788
_pi_mem_advice
Definition: pi.h:586
_pi_image_copy_flags
Definition: pi.h:663
C++ wrapper of extern "C" PI interfaces.
StorageInitHelper(StorageInitHelper &&)=default
std::vector< detail::AccessorImplPtr > MAccStorage
Storage for accessors.
Definition: cg.hpp:101
std::vector< std::vector< char > > MArgsStorage
Storage for standard layout arguments.
Definition: cg.hpp:99
StorageInitHelper(std::vector< std::vector< char >> ArgsStorage, std::vector< detail::AccessorImplPtr > AccStorage, std::vector< std::shared_ptr< const void >> SharedPtrStorage, std::vector< AccessorImplHost * > Requirements, std::vector< detail::EventImplPtr > Events)
Definition: cg.hpp:85
std::vector< std::shared_ptr< const void > > MSharedPtrStorage
Storage for shared_ptrs.
Definition: cg.hpp:103
std::vector< detail::EventImplPtr > MEvents
List of events that order the execution of this CG.
Definition: cg.hpp:109
StorageInitHelper(const StorageInitHelper &)=default
std::vector< AccessorImplHost * > MRequirements
List of requirements that specify which memory is needed for the command group to be executed.
Definition: cg.hpp:107