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,
82  };
83 
85  StorageInitHelper() = default;
86  StorageInitHelper(std::vector<std::vector<char>> ArgsStorage,
87  std::vector<detail::AccessorImplPtr> AccStorage,
88  std::vector<std::shared_ptr<const void>> SharedPtrStorage,
89  std::vector<AccessorImplHost *> Requirements,
90  std::vector<detail::EventImplPtr> Events)
91  : MArgsStorage(std::move(ArgsStorage)),
92  MAccStorage(std::move(AccStorage)),
93  MSharedPtrStorage(std::move(SharedPtrStorage)),
94  MRequirements(std::move(Requirements)), MEvents(std::move(Events)) {}
97  // The following storages are needed to ensure that arguments won't die
98  // while we are using them.
100  std::vector<std::vector<char>> MArgsStorage;
102  std::vector<detail::AccessorImplPtr> MAccStorage;
104  std::vector<std::shared_ptr<const void>> MSharedPtrStorage;
105 
108  std::vector<AccessorImplHost *> MRequirements;
110  std::vector<detail::EventImplPtr> MEvents;
111  };
112 
114  : MType(Type), MData(std::move(D)) {
115  // Capture the user code-location from Q.submit(), Q.parallel_for()
116  // etc for later use; if code location information is not available,
117  // the file name and function name members will be empty strings
118  if (loc.functionName())
119  MFunctionName = loc.functionName();
120  if (loc.fileName())
121  MFileName = loc.fileName();
122  MLine = loc.lineNumber();
123  MColumn = loc.columnNumber();
124  }
125 
126  CG(CG &&CommandGroup) = default;
127  CG(const CG &CommandGroup) = default;
128 
129  CGTYPE getType() const { return MType; }
130 
131  std::vector<std::vector<char>> &getArgsStorage() {
132  return MData.MArgsStorage;
133  }
134  std::vector<detail::AccessorImplPtr> &getAccStorage() {
135  return MData.MAccStorage;
136  }
137  std::vector<std::shared_ptr<const void>> &getSharedPtrStorage() {
138  return MData.MSharedPtrStorage;
139  }
140 
141  std::vector<AccessorImplHost *> &getRequirements() {
142  return MData.MRequirements;
143  }
144  std::vector<detail::EventImplPtr> &getEvents() { return MData.MEvents; }
145 
146  virtual std::vector<std::shared_ptr<const void>>
148  return {};
149  }
150  virtual void clearAuxiliaryResources(){};
151 
152  virtual ~CG() = default;
153 
154 private:
155  CGTYPE MType;
156  StorageInitHelper MData;
157 
158 public:
159  // Member variables to capture the user code-location
160  // information from Q.submit(), Q.parallel_for() etc
161  // Storage for function name and source file name
162  std::string MFunctionName, MFileName;
163  // Storage for line and column of code location
164  int32_t MLine, MColumn;
165 };
166 
168 class CGExecKernel : public CG {
169 public:
172  std::shared_ptr<HostKernelBase> MHostKernel;
173  std::shared_ptr<detail::kernel_impl> MSyclKernel;
174  std::shared_ptr<detail::kernel_bundle_impl> MKernelBundle;
175  std::vector<ArgDesc> MArgs;
176  std::string MKernelName;
177  std::vector<std::shared_ptr<detail::stream_impl>> MStreams;
178  std::vector<std::shared_ptr<const void>> MAuxiliaryResources;
180  bool MKernelIsCooperative = false;
181 
182  CGExecKernel(NDRDescT NDRDesc, std::shared_ptr<HostKernelBase> HKernel,
183  std::shared_ptr<detail::kernel_impl> SyclKernel,
184  std::shared_ptr<detail::kernel_bundle_impl> KernelBundle,
185  CG::StorageInitHelper CGData, std::vector<ArgDesc> Args,
186  std::string KernelName,
187  std::vector<std::shared_ptr<detail::stream_impl>> Streams,
188  std::vector<std::shared_ptr<const void>> AuxiliaryResources,
189  CGTYPE Type,
190  sycl::detail::pi::PiKernelCacheConfig KernelCacheConfig,
191  bool KernelIsCooperative, detail::code_location loc = {})
192  : CG(Type, std::move(CGData), std::move(loc)),
193  MNDRDesc(std::move(NDRDesc)), MHostKernel(std::move(HKernel)),
194  MSyclKernel(std::move(SyclKernel)),
195  MKernelBundle(std::move(KernelBundle)), MArgs(std::move(Args)),
196  MKernelName(std::move(KernelName)), MStreams(std::move(Streams)),
197  MAuxiliaryResources(std::move(AuxiliaryResources)),
198  MKernelCacheConfig(std::move(KernelCacheConfig)),
199  MKernelIsCooperative(KernelIsCooperative) {
200  assert(getType() == Kernel && "Wrong type of exec kernel CG.");
201  }
202 
203  CGExecKernel(const CGExecKernel &CGExec) = default;
204 
205  std::vector<ArgDesc> getArguments() const { return MArgs; }
206  std::string getKernelName() const { return MKernelName; }
207  std::vector<std::shared_ptr<detail::stream_impl>> getStreams() const {
208  return MStreams;
209  }
210 
211  std::vector<std::shared_ptr<const void>>
212  getAuxiliaryResources() const override {
213  return MAuxiliaryResources;
214  }
215  void clearAuxiliaryResources() override { MAuxiliaryResources.clear(); }
216 
217  std::shared_ptr<detail::kernel_bundle_impl> getKernelBundle() {
218  return MKernelBundle;
219  }
220 
221  void clearStreams() { MStreams.clear(); }
222  bool hasStreams() { return !MStreams.empty(); }
223 };
224 
226 class CGCopy : public CG {
227  void *MSrc;
228  void *MDst;
229  std::vector<std::shared_ptr<const void>> MAuxiliaryResources;
230 
231 public:
232  CGCopy(CGTYPE CopyType, void *Src, void *Dst, CG::StorageInitHelper CGData,
233  std::vector<std::shared_ptr<const void>> AuxiliaryResources,
234  detail::code_location loc = {})
235  : CG(CopyType, std::move(CGData), std::move(loc)), MSrc(Src), MDst(Dst),
236  MAuxiliaryResources{AuxiliaryResources} {}
237  void *getSrc() { return MSrc; }
238  void *getDst() { return MDst; }
239 
240  std::vector<std::shared_ptr<const void>>
241  getAuxiliaryResources() const override {
242  return MAuxiliaryResources;
243  }
244  void clearAuxiliaryResources() override { MAuxiliaryResources.clear(); }
245 };
246 
248 class CGFill : public CG {
249 public:
250  std::vector<char> MPattern;
252 
253  CGFill(std::vector<char> Pattern, void *Ptr, CG::StorageInitHelper CGData,
254  detail::code_location loc = {})
255  : CG(Fill, std::move(CGData), std::move(loc)),
256  MPattern(std::move(Pattern)), MPtr((AccessorImplHost *)Ptr) {}
258 };
259 
261 class CGUpdateHost : public CG {
262  AccessorImplHost *MPtr;
263 
264 public:
266  detail::code_location loc = {})
267  : CG(UpdateHost, std::move(CGData), std::move(loc)),
268  MPtr((AccessorImplHost *)Ptr) {}
269 
270  AccessorImplHost *getReqToUpdate() { return MPtr; }
271 };
272 
274 class CGCopyUSM : public CG {
275  void *MSrc;
276  void *MDst;
277  size_t MLength;
278 
279 public:
280  CGCopyUSM(void *Src, void *Dst, size_t Length, CG::StorageInitHelper CGData,
281  detail::code_location loc = {})
282  : CG(CopyUSM, std::move(CGData), std::move(loc)), MSrc(Src), MDst(Dst),
283  MLength(Length) {}
284 
285  void *getSrc() { return MSrc; }
286  void *getDst() { return MDst; }
287  size_t getLength() { return MLength; }
288 };
289 
291 class CGFillUSM : public CG {
292  std::vector<char> MPattern;
293  void *MDst;
294  size_t MLength;
295 
296 public:
297  CGFillUSM(std::vector<char> Pattern, void *DstPtr, size_t Length,
299  : CG(FillUSM, std::move(CGData), std::move(loc)),
300  MPattern(std::move(Pattern)), MDst(DstPtr), MLength(Length) {}
301  void *getDst() { return MDst; }
302  size_t getLength() { return MLength; }
303  int getFill() { return MPattern[0]; }
304 };
305 
307 class CGPrefetchUSM : public CG {
308  void *MDst;
309  size_t MLength;
310 
311 public:
312  CGPrefetchUSM(void *DstPtr, size_t Length, CG::StorageInitHelper CGData,
313  detail::code_location loc = {})
314  : CG(PrefetchUSM, std::move(CGData), std::move(loc)), MDst(DstPtr),
315  MLength(Length) {}
316  void *getDst() { return MDst; }
317  size_t getLength() { return MLength; }
318 };
319 
321 class CGAdviseUSM : public CG {
322  void *MDst;
323  size_t MLength;
324  pi_mem_advice MAdvice;
325 
326 public:
327  CGAdviseUSM(void *DstPtr, size_t Length, pi_mem_advice Advice,
328  CG::StorageInitHelper CGData, CGTYPE Type,
329  detail::code_location loc = {})
330  : CG(Type, std::move(CGData), std::move(loc)), MDst(DstPtr),
331  MLength(Length), MAdvice(Advice) {}
332  void *getDst() { return MDst; }
333  size_t getLength() { return MLength; }
334  pi_mem_advice getAdvice() { return MAdvice; }
335 };
336 
337 class CGBarrier : public CG {
338 public:
339  std::vector<detail::EventImplPtr> MEventsWaitWithBarrier;
340 
341  CGBarrier(std::vector<detail::EventImplPtr> EventsWaitWithBarrier,
342  CG::StorageInitHelper CGData, CGTYPE Type,
343  detail::code_location loc = {})
344  : CG(Type, std::move(CGData), std::move(loc)),
345  MEventsWaitWithBarrier(std::move(EventsWaitWithBarrier)) {}
346 };
347 
348 class CGProfilingTag : public CG {
349 public:
351  : CG(CG::ProfilingTag, std::move(CGData), std::move(loc)) {}
352 };
353 
355 class CGCopy2DUSM : public CG {
356  void *MSrc;
357  void *MDst;
358  size_t MSrcPitch;
359  size_t MDstPitch;
360  size_t MWidth;
361  size_t MHeight;
362 
363 public:
364  CGCopy2DUSM(void *Src, void *Dst, size_t SrcPitch, size_t DstPitch,
365  size_t Width, size_t Height, CG::StorageInitHelper CGData,
366  detail::code_location loc = {})
367  : CG(Copy2DUSM, std::move(CGData), std::move(loc)), MSrc(Src), MDst(Dst),
368  MSrcPitch(SrcPitch), MDstPitch(DstPitch), MWidth(Width),
369  MHeight(Height) {}
370 
371  void *getSrc() const { return MSrc; }
372  void *getDst() const { return MDst; }
373  size_t getSrcPitch() const { return MSrcPitch; }
374  size_t getDstPitch() const { return MDstPitch; }
375  size_t getWidth() const { return MWidth; }
376  size_t getHeight() const { return MHeight; }
377 };
378 
380 class CGFill2DUSM : public CG {
381  std::vector<char> MPattern;
382  void *MDst;
383  size_t MPitch;
384  size_t MWidth;
385  size_t MHeight;
386 
387 public:
388  CGFill2DUSM(std::vector<char> Pattern, void *DstPtr, size_t Pitch,
389  size_t Width, size_t Height, CG::StorageInitHelper CGData,
390  detail::code_location loc = {})
391  : CG(Fill2DUSM, std::move(CGData), std::move(loc)),
392  MPattern(std::move(Pattern)), MDst(DstPtr), MPitch(Pitch),
393  MWidth(Width), MHeight(Height) {}
394  void *getDst() const { return MDst; }
395  size_t getPitch() const { return MPitch; }
396  size_t getWidth() const { return MWidth; }
397  size_t getHeight() const { return MHeight; }
398  const std::vector<char> &getPattern() const { return MPattern; }
399 };
400 
402 class CGMemset2DUSM : public CG {
403  char MValue;
404  void *MDst;
405  size_t MPitch;
406  size_t MWidth;
407  size_t MHeight;
408 
409 public:
410  CGMemset2DUSM(char Value, void *DstPtr, size_t Pitch, size_t Width,
411  size_t Height, CG::StorageInitHelper CGData,
412  detail::code_location loc = {})
413  : CG(Memset2DUSM, std::move(CGData), std::move(loc)), MValue(Value),
414  MDst(DstPtr), MPitch(Pitch), MWidth(Width), MHeight(Height) {}
415  void *getDst() const { return MDst; }
416  size_t getPitch() const { return MPitch; }
417  size_t getWidth() const { return MWidth; }
418  size_t getHeight() const { return MHeight; }
419  char getValue() const { return MValue; }
420 };
421 
423 class CGReadWriteHostPipe : public CG {
424  std::string PipeName;
425  bool Blocking;
426  void *HostPtr;
427  size_t TypeSize;
428  bool IsReadOp;
429 
430 public:
431  CGReadWriteHostPipe(const std::string &Name, bool Block, void *Ptr,
432  size_t Size, bool Read, CG::StorageInitHelper CGData,
433  detail::code_location loc = {})
434  : CG(ReadWriteHostPipe, std::move(CGData), std::move(loc)),
435  PipeName(Name), Blocking(Block), HostPtr(Ptr), TypeSize(Size),
436  IsReadOp(Read) {}
437 
438  std::string getPipeName() { return PipeName; }
439  void *getHostPtr() { return HostPtr; }
440  size_t getTypeSize() { return TypeSize; }
441  bool isBlocking() { return Blocking; }
442  bool isReadHostPipe() { return IsReadOp; }
443 };
444 
446 class CGCopyToDeviceGlobal : public CG {
447  void *MSrc;
448  void *MDeviceGlobalPtr;
449  bool MIsDeviceImageScoped;
450  size_t MNumBytes;
451  size_t MOffset;
452 
453 public:
454  CGCopyToDeviceGlobal(void *Src, void *DeviceGlobalPtr,
455  bool IsDeviceImageScoped, size_t NumBytes, size_t Offset,
456  CG::StorageInitHelper CGData,
457  detail::code_location loc = {})
458  : CG(CopyToDeviceGlobal, std::move(CGData), std::move(loc)), MSrc(Src),
459  MDeviceGlobalPtr(DeviceGlobalPtr),
460  MIsDeviceImageScoped(IsDeviceImageScoped), MNumBytes(NumBytes),
461  MOffset(Offset) {}
462 
463  void *getSrc() { return MSrc; }
464  void *getDeviceGlobalPtr() { return MDeviceGlobalPtr; }
465  bool isDeviceImageScoped() { return MIsDeviceImageScoped; }
466  size_t getNumBytes() { return MNumBytes; }
467  size_t getOffset() { return MOffset; }
468 };
469 
471 class CGCopyFromDeviceGlobal : public CG {
472  void *MDeviceGlobalPtr;
473  void *MDest;
474  bool MIsDeviceImageScoped;
475  size_t MNumBytes;
476  size_t MOffset;
477 
478 public:
479  CGCopyFromDeviceGlobal(void *DeviceGlobalPtr, void *Dest,
480  bool IsDeviceImageScoped, size_t NumBytes,
481  size_t Offset, CG::StorageInitHelper CGData,
482  detail::code_location loc = {})
483  : CG(CopyFromDeviceGlobal, std::move(CGData), std::move(loc)),
484  MDeviceGlobalPtr(DeviceGlobalPtr), MDest(Dest),
485  MIsDeviceImageScoped(IsDeviceImageScoped), MNumBytes(NumBytes),
486  MOffset(Offset) {}
487 
488  void *getDeviceGlobalPtr() { return MDeviceGlobalPtr; }
489  void *getDest() { return MDest; }
490  bool isDeviceImageScoped() { return MIsDeviceImageScoped; }
491  size_t getNumBytes() { return MNumBytes; }
492  size_t getOffset() { return MOffset; }
493 };
495 class CGCopyImage : public CG {
496  void *MSrc;
497  void *MDst;
500  sycl::detail::pi::PiImageCopyFlags MImageCopyFlags;
505 
506 public:
507  CGCopyImage(void *Src, void *Dst, sycl::detail::pi::PiMemImageDesc ImageDesc,
509  sycl::detail::pi::PiImageCopyFlags ImageCopyFlags,
515  : CG(CopyImage, std::move(CGData), std::move(loc)), MSrc(Src), MDst(Dst),
516  MImageDesc(ImageDesc), MImageFormat(ImageFormat),
517  MImageCopyFlags(ImageCopyFlags), MSrcOffset(SrcOffset),
518  MDstOffset(DstOffset), MHostExtent(HostExtent),
519  MCopyExtent(CopyExtent) {}
520 
521  void *getSrc() const { return MSrc; }
522  void *getDst() const { return MDst; }
523  sycl::detail::pi::PiMemImageDesc getDesc() const { return MImageDesc; }
524  sycl::detail::pi::PiMemImageFormat getFormat() const { return MImageFormat; }
526  return MImageCopyFlags;
527  }
528  sycl::detail::pi::PiImageOffset getSrcOffset() const { return MSrcOffset; }
529  sycl::detail::pi::PiImageOffset getDstOffset() const { return MDstOffset; }
530  sycl::detail::pi::PiImageRegion getHostExtent() const { return MHostExtent; }
531  sycl::detail::pi::PiImageRegion getCopyExtent() const { return MCopyExtent; }
532 };
533 
535 class CGSemaphoreWait : public CG {
536  sycl::detail::pi::PiInteropSemaphoreHandle MInteropSemaphoreHandle;
537 
538 public:
540  sycl::detail::pi::PiInteropSemaphoreHandle InteropSemaphoreHandle,
542  : CG(SemaphoreWait, std::move(CGData), std::move(loc)),
543  MInteropSemaphoreHandle(InteropSemaphoreHandle) {}
544 
546  return MInteropSemaphoreHandle;
547  }
548 };
549 
551 class CGSemaphoreSignal : public CG {
552  sycl::detail::pi::PiInteropSemaphoreHandle MInteropSemaphoreHandle;
553 
554 public:
556  sycl::detail::pi::PiInteropSemaphoreHandle InteropSemaphoreHandle,
558  : CG(SemaphoreSignal, std::move(CGData), std::move(loc)),
559  MInteropSemaphoreHandle(InteropSemaphoreHandle) {}
560 
562  return MInteropSemaphoreHandle;
563  }
564 };
565 
567 class CGExecCommandBuffer : public CG {
568 public:
570  std::shared_ptr<sycl::ext::oneapi::experimental::detail::exec_graph_impl>
572 
574  const sycl::detail::pi::PiExtCommandBuffer &CommandBuffer,
575  const std::shared_ptr<
577  CG::StorageInitHelper CGData)
578  : CG(CGTYPE::ExecCommandBuffer, std::move(CGData)),
579  MCommandBuffer(CommandBuffer), MExecGraph(ExecGraph) {}
580 };
581 
582 } // namespace detail
583 } // namespace _V1
584 } // namespace sycl
The file contains implementations of accessor class.
"Advise USM" command group class.
Definition: cg.hpp:321
CGAdviseUSM(void *DstPtr, size_t Length, pi_mem_advice Advice, CG::StorageInitHelper CGData, CGTYPE Type, detail::code_location loc={})
Definition: cg.hpp:327
pi_mem_advice getAdvice()
Definition: cg.hpp:334
CGBarrier(std::vector< detail::EventImplPtr > EventsWaitWithBarrier, CG::StorageInitHelper CGData, CGTYPE Type, detail::code_location loc={})
Definition: cg.hpp:341
std::vector< detail::EventImplPtr > MEventsWaitWithBarrier
Definition: cg.hpp:339
"Copy 2D USM" command group class.
Definition: cg.hpp:355
size_t getDstPitch() const
Definition: cg.hpp:374
size_t getWidth() const
Definition: cg.hpp:375
void * getSrc() const
Definition: cg.hpp:371
void * getDst() const
Definition: cg.hpp:372
size_t getHeight() const
Definition: cg.hpp:376
size_t getSrcPitch() const
Definition: cg.hpp:373
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:364
"Copy to device_global" command group class.
Definition: cg.hpp:471
CGCopyFromDeviceGlobal(void *DeviceGlobalPtr, void *Dest, bool IsDeviceImageScoped, size_t NumBytes, size_t Offset, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:479
"Copy Image" command group class.
Definition: cg.hpp:495
void * getDst() const
Definition: cg.hpp:522
sycl::detail::pi::PiImageOffset getDstOffset() const
Definition: cg.hpp:529
sycl::detail::pi::PiImageCopyFlags getCopyFlags() const
Definition: cg.hpp:525
void * getSrc() const
Definition: cg.hpp:521
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:507
sycl::detail::pi::PiImageRegion getCopyExtent() const
Definition: cg.hpp:531
sycl::detail::pi::PiImageOffset getSrcOffset() const
Definition: cg.hpp:528
sycl::detail::pi::PiImageRegion getHostExtent() const
Definition: cg.hpp:530
sycl::detail::pi::PiMemImageFormat getFormat() const
Definition: cg.hpp:524
sycl::detail::pi::PiMemImageDesc getDesc() const
Definition: cg.hpp:523
"Copy to device_global" command group class.
Definition: cg.hpp:446
CGCopyToDeviceGlobal(void *Src, void *DeviceGlobalPtr, bool IsDeviceImageScoped, size_t NumBytes, size_t Offset, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:454
"Copy USM" command group class.
Definition: cg.hpp:274
CGCopyUSM(void *Src, void *Dst, size_t Length, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:280
"Copy memory" command group class.
Definition: cg.hpp:226
void clearAuxiliaryResources() override
Definition: cg.hpp:244
std::vector< std::shared_ptr< const void > > getAuxiliaryResources() const override
Definition: cg.hpp:241
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:232
"Execute command-buffer" command group class.
Definition: cg.hpp:567
sycl::detail::pi::PiExtCommandBuffer MCommandBuffer
Definition: cg.hpp:569
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:573
std::shared_ptr< sycl::ext::oneapi::experimental::detail::exec_graph_impl > MExecGraph
Definition: cg.hpp:571
"Execute kernel" command group class.
Definition: cg.hpp:168
std::shared_ptr< detail::kernel_bundle_impl > MKernelBundle
Definition: cg.hpp:174
std::vector< std::shared_ptr< const void > > getAuxiliaryResources() const override
Definition: cg.hpp:212
std::vector< std::shared_ptr< const void > > MAuxiliaryResources
Definition: cg.hpp:178
void clearAuxiliaryResources() override
Definition: cg.hpp:215
std::string getKernelName() const
Definition: cg.hpp:206
std::vector< ArgDesc > MArgs
Definition: cg.hpp:175
NDRDescT MNDRDesc
Stores ND-range description.
Definition: cg.hpp:171
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:182
sycl::detail::pi::PiKernelCacheConfig MKernelCacheConfig
Definition: cg.hpp:179
std::shared_ptr< detail::kernel_impl > MSyclKernel
Definition: cg.hpp:173
std::shared_ptr< HostKernelBase > MHostKernel
Definition: cg.hpp:172
CGExecKernel(const CGExecKernel &CGExec)=default
std::vector< std::shared_ptr< detail::stream_impl > > getStreams() const
Definition: cg.hpp:207
std::vector< std::shared_ptr< detail::stream_impl > > MStreams
Definition: cg.hpp:177
std::shared_ptr< detail::kernel_bundle_impl > getKernelBundle()
Definition: cg.hpp:217
std::vector< ArgDesc > getArguments() const
Definition: cg.hpp:205
"Fill 2D USM" command group class.
Definition: cg.hpp:380
void * getDst() const
Definition: cg.hpp:394
size_t getWidth() const
Definition: cg.hpp:396
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:388
size_t getHeight() const
Definition: cg.hpp:397
const std::vector< char > & getPattern() const
Definition: cg.hpp:398
size_t getPitch() const
Definition: cg.hpp:395
"Fill USM" command group class.
Definition: cg.hpp:291
CGFillUSM(std::vector< char > Pattern, void *DstPtr, size_t Length, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:297
"Fill memory" command group class.
Definition: cg.hpp:248
std::vector< char > MPattern
Definition: cg.hpp:250
AccessorImplHost * getReqToFill()
Definition: cg.hpp:257
AccessorImplHost * MPtr
Definition: cg.hpp:251
CGFill(std::vector< char > Pattern, void *Ptr, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:253
"Memset 2D USM" command group class.
Definition: cg.hpp:402
size_t getPitch() const
Definition: cg.hpp:416
size_t getWidth() const
Definition: cg.hpp:417
size_t getHeight() const
Definition: cg.hpp:418
CGMemset2DUSM(char Value, void *DstPtr, size_t Pitch, size_t Width, size_t Height, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:410
"Prefetch USM" command group class.
Definition: cg.hpp:307
CGPrefetchUSM(void *DstPtr, size_t Length, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:312
CGProfilingTag(CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:350
"ReadWriteHostPipe" command group class.
Definition: cg.hpp:423
CGReadWriteHostPipe(const std::string &Name, bool Block, void *Ptr, size_t Size, bool Read, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:431
"Semaphore Signal" command group class.
Definition: cg.hpp:551
sycl::detail::pi::PiInteropSemaphoreHandle getInteropSemaphoreHandle() const
Definition: cg.hpp:561
CGSemaphoreSignal(sycl::detail::pi::PiInteropSemaphoreHandle InteropSemaphoreHandle, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:555
"Semaphore Wait" command group class.
Definition: cg.hpp:535
CGSemaphoreWait(sycl::detail::pi::PiInteropSemaphoreHandle InteropSemaphoreHandle, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:539
sycl::detail::pi::PiInteropSemaphoreHandle getInteropSemaphoreHandle() const
Definition: cg.hpp:545
"Update host" command group class.
Definition: cg.hpp:261
AccessorImplHost * getReqToUpdate()
Definition: cg.hpp:270
CGUpdateHost(void *Ptr, CG::StorageInitHelper CGData, detail::code_location loc={})
Definition: cg.hpp:265
Base class for all types of command groups.
Definition: cg.hpp:53
std::vector< detail::AccessorImplPtr > & getAccStorage()
Definition: cg.hpp:134
CG(CGTYPE Type, StorageInitHelper D, detail::code_location loc={})
Definition: cg.hpp:113
std::vector< detail::EventImplPtr > & getEvents()
Definition: cg.hpp:144
CG(const CG &CommandGroup)=default
std::vector< std::vector< char > > & getArgsStorage()
Definition: cg.hpp:131
virtual void clearAuxiliaryResources()
Definition: cg.hpp:150
virtual std::vector< std::shared_ptr< const void > > getAuxiliaryResources() const
Definition: cg.hpp:147
virtual ~CG()=default
std::string MFileName
Definition: cg.hpp:162
std::vector< AccessorImplHost * > & getRequirements()
Definition: cg.hpp:141
int32_t MColumn
Definition: cg.hpp:164
CG(CG &&CommandGroup)=default
std::vector< std::shared_ptr< const void > > & getSharedPtrStorage()
Definition: cg.hpp:137
CGTYPE getType() const
Definition: cg.hpp:129
CGTYPE
Type of the command group.
Definition: cg.hpp:56
std::string MFunctionName
Definition: cg.hpp:162
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:148
std::shared_ptr< event_impl > EventImplPtr
Definition: cg.hpp:43
Definition: access.hpp:18
_pi_kernel_cache_config
Definition: pi.h:835
_pi_mem_advice
Definition: pi.h:626
_pi_image_copy_flags
Definition: pi.h:703
C++ wrapper of extern "C" PI interfaces.
StorageInitHelper(StorageInitHelper &&)=default
std::vector< detail::AccessorImplPtr > MAccStorage
Storage for accessors.
Definition: cg.hpp:102
std::vector< std::vector< char > > MArgsStorage
Storage for standard layout arguments.
Definition: cg.hpp:100
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:86
std::vector< std::shared_ptr< const void > > MSharedPtrStorage
Storage for shared_ptrs.
Definition: cg.hpp:104
std::vector< detail::EventImplPtr > MEvents
List of events that order the execution of this CG.
Definition: cg.hpp:110
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:108