DPC++ Runtime
Runtime libraries for oneAPI DPC++
commands.hpp
Go to the documentation of this file.
1 //==-------------- commands.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 <atomic>
12 #include <cstdint>
13 #include <deque>
14 #include <memory>
15 #include <optional>
16 #include <set>
17 #include <unordered_set>
18 #include <vector>
19 
20 #include <detail/accessor_impl.hpp>
21 #include <detail/event_impl.hpp>
23 #include <sycl/access/access.hpp>
24 #include <sycl/detail/cg.hpp>
25 
26 namespace sycl {
28 namespace detail {
29 
30 #ifdef XPTI_ENABLE_INSTRUMENTATION
31 bool CurrentCodeLocationValid();
32 #endif
33 
34 class queue_impl;
35 class event_impl;
36 class context_impl;
37 class DispatchHostTask;
38 
39 using QueueImplPtr = std::shared_ptr<detail::queue_impl>;
40 using EventImplPtr = std::shared_ptr<detail::event_impl>;
41 using ContextImplPtr = std::shared_ptr<detail::context_impl>;
42 using StreamImplPtr = std::shared_ptr<detail::stream_impl>;
43 
44 class Command;
45 class AllocaCommand;
46 class AllocaCommandBase;
47 class ReleaseCommand;
48 class ExecCGCommand;
49 class EmptyCommand;
50 
52 
55  enum ResultT {
59  SyclEnqueueFailed
60  };
61  EnqueueResultT(ResultT Result = SyclEnqueueSuccess, Command *Cmd = nullptr,
62  pi_int32 ErrCode = PI_SUCCESS)
63  : MResult(Result), MCmd(Cmd), MErrCode(ErrCode) {}
70 };
71 
73 struct DepDesc {
74  DepDesc(Command *DepCommand, const Requirement *Req,
75  AllocaCommandBase *AllocaCmd)
76  : MDepCommand(DepCommand), MDepRequirement(Req), MAllocaCmd(AllocaCmd) {}
77 
78  friend bool operator<(const DepDesc &Lhs, const DepDesc &Rhs) {
79  return std::tie(Lhs.MDepRequirement, Lhs.MDepCommand) <
81  }
82 
84  Command *MDepCommand = nullptr;
86  const Requirement *MDepRequirement = nullptr;
89  AllocaCommandBase *MAllocaCmd = nullptr;
90 };
91 
99 class Command {
100 public:
101  enum CommandType {
112  FUSION
113  };
114 
115  Command(CommandType Type, QueueImplPtr Queue);
116 
120  [[nodiscard]] Command *addDep(DepDesc NewDep,
121  std::vector<Command *> &ToCleanUp);
122 
126  [[nodiscard]] Command *addDep(EventImplPtr Event,
127  std::vector<Command *> &ToCleanUp);
128 
129  void addUser(Command *NewUser) { MUsers.insert(NewUser); }
130 
132  CommandType getType() const { return MType; }
133 
141  virtual bool enqueue(EnqueueResultT &EnqueueResult, BlockingT Blocking,
142  std::vector<Command *> &ToCleanUp);
143 
144  bool isFinished();
145 
146  bool isSuccessfullyEnqueued() const {
147  return MEnqueueStatus == EnqueueResultT::SyclEnqueueSuccess;
148  }
149 
150  // Shows that command could not be enqueued, now it may be true for empty task
151  // only
152  bool isEnqueueBlocked() const {
153  return MIsBlockable && MEnqueueStatus == EnqueueResultT::SyclEnqueueBlocked;
154  }
155  // Shows that command could be enqueued, but is blocking enqueue of all
156  // commands depending on it. Regular usage - host task.
157  bool isBlocking() const { return isHostTask() && !MEvent->isCompleted(); }
158 
159  void addBlockedUserUnique(const EventImplPtr &NewUser) {
160  if (std::find(MBlockedUsers.begin(), MBlockedUsers.end(), NewUser) !=
161  MBlockedUsers.end())
162  return;
163  MBlockedUsers.push_back(NewUser);
164  }
165 
166  const QueueImplPtr &getQueue() const { return MQueue; }
167 
168  const EventImplPtr &getEvent() const { return MEvent; }
169 
170  // Methods needed to support SYCL instrumentation
171 
173  void emitInstrumentationDataProxy();
175  virtual void emitInstrumentationData() = 0;
178  void resolveReleaseDependencies(std::set<Command *> &list);
180  void emitEdgeEventForCommandDependence(
181  Command *Cmd, void *ObjAddr, bool IsCommand,
182  std::optional<access::mode> AccMode = std::nullopt);
184  void emitEdgeEventForEventDependence(Command *Cmd, RT::PiEvent &EventAddr);
186  void emitEnqueuedEventSignal(RT::PiEvent &PiEventAddr);
191  uint64_t makeTraceEventProlog(void *MAddress);
194  void makeTraceEventEpilog();
196  void emitInstrumentation(uint16_t Type, const char *Txt = nullptr);
197 
198  // End Methods needed to support SYCL instrumentation
199 
200  virtual void printDot(std::ostream &Stream) const = 0;
201 
202  virtual const Requirement *getRequirement() const {
203  assert(false && "Internal Error. The command has no stored requirement");
204  return nullptr;
205  }
206 
207  virtual ~Command() { MEvent->cleanDepEventsThroughOneLevel(); }
208 
209  const char *getBlockReason() const;
210 
213  virtual const ContextImplPtr &getWorkerContext() const;
214 
217  const QueueImplPtr &getWorkerQueue() const;
218 
220  virtual bool producesPiEvent() const;
221 
223  virtual bool supportsPostEnqueueCleanup() const;
224 
226  virtual bool readyForCleanup() const;
227 
230  std::vector<RT::PiEvent>
231  getPiEvents(const std::vector<EventImplPtr> &EventImpls) const;
235  std::vector<RT::PiEvent>
236  getPiEventsBlocking(const std::vector<EventImplPtr> &EventImpls) const;
237 
238  bool isHostTask() const;
239 
240 protected:
244 
247  std::vector<EventImplPtr> &MPreparedDepsEvents;
248  std::vector<EventImplPtr> &MPreparedHostDepsEvents;
249 
250  void waitForEvents(QueueImplPtr Queue, std::vector<EventImplPtr> &RawEvents,
251  RT::PiEvent &Event);
252 
253  void waitForPreparedHostEvents() const;
254 
266  [[nodiscard]] Command *processDepEvent(EventImplPtr DepEvent,
267  const DepDesc &Dep,
268  std::vector<Command *> &ToCleanUp);
269 
271  virtual pi_int32 enqueueImp() = 0;
272 
276  std::mutex MEnqueueMtx;
277 
278  friend class DispatchHostTask;
279 
280 public:
281  const std::vector<EventImplPtr> &getPreparedHostDepsEvents() const {
282  return MPreparedHostDepsEvents;
283  }
284 
285  const std::vector<EventImplPtr> &getPreparedDepsEvents() const {
286  return MPreparedDepsEvents;
287  }
288 
289  // XPTI instrumentation. Copy code location details to the internal struct.
290  // Memory is allocated in this method and released in destructor.
291  void copySubmissionCodeLocation();
292 
299  MPreparedDepsEvents.clear();
300  MPreparedHostDepsEvents.clear();
301  MDeps.clear();
302  }
303 
305  std::vector<DepDesc> MDeps;
307  std::unordered_set<Command *> MUsers;
309  bool MIsBlockable = false;
311  unsigned MLeafCounter = 0;
312 
313  struct Marks {
315  bool MVisited = false;
317  bool MToBeDeleted = false;
318  };
321 
322  enum class BlockReason : int { HostAccessor = 0, HostTask };
323 
324  // Only have reasonable value while MIsBlockable is true
326 
328  std::atomic<EnqueueResultT::ResultT> MEnqueueStatus;
329 
330  // All member variables defined here are needed for the SYCL instrumentation
331  // layer. Do not guard these variables below with XPTI_ENABLE_INSTRUMENTATION
332  // to ensure we have the same object layout when the macro in the library and
333  // SYCL app are not the same.
334 
336  void *MTraceEvent = nullptr;
340  int32_t MStreamID = -1;
343  void *MAddress = nullptr;
345  std::string MAddressString;
347  std::string MCommandNodeType;
349  std::string MCommandName;
351  bool MTraceEventPrologComplete = false;
353  bool MFirstInstance = false;
355  uint64_t MInstanceID = 0;
362  std::string MSubmissionFileName;
364 
365  // This flag allows to control whether host event should be set complete
366  // after successfull enqueue of command. Event is considered as host event if
367  // either it's is_host() return true or there is no backend representation
368  // of event (i.e. getHandleRef() return reference to nullptr value).
369  // By default the flag is set to true due to most of host operations are
370  // synchronous. The only asynchronous operation currently is host-task.
371  bool MShouldCompleteEventIfPossible = true;
372 
376  bool MMarkedForCleanup = false;
377 
383  std::vector<EventImplPtr> MBlockedUsers;
384  std::mutex MBlockedUsersMutex;
385 };
386 
389 class EmptyCommand : public Command {
390 public:
391  EmptyCommand(QueueImplPtr Queue);
392 
393  void printDot(std::ostream &Stream) const final;
394  const Requirement *getRequirement() const final { return &MRequirements[0]; }
395  void addRequirement(Command *DepCmd, AllocaCommandBase *AllocaCmd,
396  const Requirement *Req);
397 
398  void emitInstrumentationData() override;
399 
400  bool producesPiEvent() const final;
401 
402 private:
403  pi_int32 enqueueImp() final;
404 
405  // Employing deque here as it allows to push_back/emplace_back without
406  // invalidation of pointer or reference to stored data item regardless of
407  // iterator invalidation.
408  std::deque<Requirement> MRequirements;
409 };
410 
413 class ReleaseCommand : public Command {
414 public:
415  ReleaseCommand(QueueImplPtr Queue, AllocaCommandBase *AllocaCmd);
416 
417  void printDot(std::ostream &Stream) const final;
418  void emitInstrumentationData() override;
419  bool producesPiEvent() const final;
420  bool supportsPostEnqueueCleanup() const final;
421  bool readyForCleanup() const final;
422 
423 private:
424  pi_int32 enqueueImp() final;
425 
427  AllocaCommandBase *MAllocaCmd = nullptr;
428 };
429 
431 class AllocaCommandBase : public Command {
432 public:
434  AllocaCommandBase *LinkedAllocaCmd, bool IsConst);
435 
436  ReleaseCommand *getReleaseCmd() { return &MReleaseCmd; }
437 
438  SYCLMemObjI *getSYCLMemObj() const { return MRequirement.MSYCLMemObj; }
439 
440  virtual void *getMemAllocation() const = 0;
441 
442  const Requirement *getRequirement() const final { return &MRequirement; }
443 
444  void emitInstrumentationData() override;
445 
446  bool producesPiEvent() const final;
447 
448  bool supportsPostEnqueueCleanup() const final;
449 
450  bool readyForCleanup() const final;
451 
452  void *MMemAllocation = nullptr;
453 
459  AllocaCommandBase *MLinkedAllocaCmd = nullptr;
461  bool MIsActive = true;
462 
465  bool MIsLeaderAlloca = true;
466  // Indicates that the data in this allocation must not be modified
467  bool MIsConst = false;
468 
469 protected:
470  Requirement MRequirement;
471  ReleaseCommand MReleaseCmd;
472 };
473 
477 public:
479  bool InitFromUserData = true,
480  AllocaCommandBase *LinkedAllocaCmd = nullptr,
481  bool IsConst = false);
482 
483  void *getMemAllocation() const final { return MMemAllocation; }
484  void printDot(std::ostream &Stream) const final;
485  void emitInstrumentationData() override;
486 
487 private:
488  pi_int32 enqueueImp() final;
489 
492  bool MInitFromUserData = false;
493 };
494 
497 public:
499  AllocaCommandBase *ParentAlloca,
500  std::vector<Command *> &ToEnqueue,
501  std::vector<Command *> &ToCleanUp);
502 
503  void *getMemAllocation() const final;
504  void printDot(std::ostream &Stream) const final;
505  AllocaCommandBase *getParentAlloca() { return MParentAlloca; }
506  void emitInstrumentationData() override;
507 
508 private:
509  pi_int32 enqueueImp() final;
510 
511  AllocaCommandBase *MParentAlloca = nullptr;
512 };
513 
515 class MapMemObject : public Command {
516 public:
517  MapMemObject(AllocaCommandBase *SrcAllocaCmd, Requirement Req, void **DstPtr,
518  QueueImplPtr Queue, access::mode MapMode);
519 
520  void printDot(std::ostream &Stream) const final;
521  const Requirement *getRequirement() const final { return &MSrcReq; }
522  void emitInstrumentationData() override;
523 
524 private:
525  pi_int32 enqueueImp() final;
526 
527  AllocaCommandBase *MSrcAllocaCmd = nullptr;
528  Requirement MSrcReq;
529  void **MDstPtr = nullptr;
530  access::mode MMapMode;
531 };
532 
534 class UnMapMemObject : public Command {
535 public:
536  UnMapMemObject(AllocaCommandBase *DstAllocaCmd, Requirement Req,
537  void **SrcPtr, QueueImplPtr Queue);
538 
539  void printDot(std::ostream &Stream) const final;
540  const Requirement *getRequirement() const final { return &MDstReq; }
541  void emitInstrumentationData() override;
542  bool producesPiEvent() const final;
543 
544 private:
545  pi_int32 enqueueImp() final;
546 
547  AllocaCommandBase *MDstAllocaCmd = nullptr;
548  Requirement MDstReq;
549  void **MSrcPtr = nullptr;
550 };
551 
554 class MemCpyCommand : public Command {
555 public:
556  MemCpyCommand(Requirement SrcReq, AllocaCommandBase *SrcAllocaCmd,
557  Requirement DstReq, AllocaCommandBase *DstAllocaCmd,
558  QueueImplPtr SrcQueue, QueueImplPtr DstQueue);
559 
560  void printDot(std::ostream &Stream) const final;
561  const Requirement *getRequirement() const final { return &MDstReq; }
562  void emitInstrumentationData() final;
563  const ContextImplPtr &getWorkerContext() const final;
564  bool producesPiEvent() const final;
565 
566 private:
567  pi_int32 enqueueImp() final;
568 
569  QueueImplPtr MSrcQueue;
570  Requirement MSrcReq;
571  AllocaCommandBase *MSrcAllocaCmd = nullptr;
572  Requirement MDstReq;
573  AllocaCommandBase *MDstAllocaCmd = nullptr;
574 };
575 
578 class MemCpyCommandHost : public Command {
579 public:
580  MemCpyCommandHost(Requirement SrcReq, AllocaCommandBase *SrcAllocaCmd,
581  Requirement DstReq, void **DstPtr, QueueImplPtr SrcQueue,
582  QueueImplPtr DstQueue);
583 
584  void printDot(std::ostream &Stream) const final;
585  const Requirement *getRequirement() const final { return &MDstReq; }
586  void emitInstrumentationData() final;
587  const ContextImplPtr &getWorkerContext() const final;
588 
589 private:
590  pi_int32 enqueueImp() final;
591 
592  QueueImplPtr MSrcQueue;
593  Requirement MSrcReq;
594  AllocaCommandBase *MSrcAllocaCmd = nullptr;
595  Requirement MDstReq;
596  void **MDstPtr = nullptr;
597 };
598 
600  const std::string &PipeName, bool blocking,
601  void *ptr, size_t size,
602  std::vector<RT::PiEvent> &RawEvents,
603  RT::PiEvent *OutEvent, bool read);
604 
606  const QueueImplPtr &Queue, NDRDescT &NDRDesc, std::vector<ArgDesc> &Args,
607  const std::shared_ptr<detail::kernel_bundle_impl> &KernelBundleImplPtr,
608  const std::shared_ptr<detail::kernel_impl> &MSyclKernel,
609  const std::string &KernelName, const detail::OSModuleHandle &OSModuleHandle,
610  std::vector<RT::PiEvent> &RawEvents, RT::PiEvent *OutEvent,
611  const std::function<void *(Requirement *Req)> &getMemAllocationFunc,
612  RT::PiKernelCacheConfig KernelCacheConfig);
613 
614 class KernelFusionCommand;
615 
618 class ExecCGCommand : public Command {
619 public:
620  ExecCGCommand(std::unique_ptr<detail::CG> CommandGroup, QueueImplPtr Queue);
621 
622  std::vector<std::shared_ptr<const void>> getAuxiliaryResources() const;
623 
624  void clearAuxiliaryResources();
625 
626  void printDot(std::ostream &Stream) const final;
627  void emitInstrumentationData() final;
628 
629  detail::CG &getCG() const { return *MCommandGroup; }
630 
631  // MEmptyCmd is only employed if this command refers to host-task.
632  // The mechanism of lookup for single EmptyCommand amongst users of
633  // host-task-representing command is unreliable. This unreliability roots in
634  // the cleanup process.
635  EmptyCommand *MEmptyCmd = nullptr;
636 
637  // MFusionCommand is employed to mark a CG command as part of a kernel fusion
638  // and allows to refer back to the corresponding KernelFusionCommand if
639  // necessary.
640  KernelFusionCommand *MFusionCmd = nullptr;
641 
642  bool producesPiEvent() const final;
643 
644  bool supportsPostEnqueueCleanup() const final;
645 
646  bool readyForCleanup() const final;
647 
648 private:
649  pi_int32 enqueueImp() final;
650 
651  AllocaCommandBase *getAllocaForReq(Requirement *Req);
652 
653  std::unique_ptr<detail::CG> MCommandGroup;
654 
655  friend class Command;
656 };
657 
658 // For XPTI instrumentation only.
659 // Method used to emit data in cases when we do not create node in graph.
660 // Very close to ExecCGCommand::emitInstrumentationData content.
662  const std::shared_ptr<detail::kernel_impl> &SyclKernel,
663  const detail::code_location &CodeLoc, const std::string &SyclKernelName,
664  const QueueImplPtr &Queue, const NDRDescT &NDRDesc,
665  const std::shared_ptr<detail::kernel_bundle_impl> &KernelBundleImplPtr,
666  const detail::OSModuleHandle &OSModHandle, std::vector<ArgDesc> &CGArgs);
667 
669 public:
671  AllocaCommandBase *SrcAllocaCmd, void **DstPtr);
672 
673  void printDot(std::ostream &Stream) const final;
674  const Requirement *getRequirement() const final { return &MDstReq; }
675  void emitInstrumentationData() final;
676 
677 private:
678  pi_int32 enqueueImp() final;
679 
680  AllocaCommandBase *MSrcAllocaCmd = nullptr;
681  Requirement MDstReq;
682  void **MDstPtr = nullptr;
683 };
684 
687 class KernelFusionCommand : public Command {
688 public:
689  enum class FusionStatus { ACTIVE, CANCELLED, COMPLETE, DELETED };
690 
691  explicit KernelFusionCommand(QueueImplPtr Queue);
692 
693  void printDot(std::ostream &Stream) const final;
694  void emitInstrumentationData() final;
695  bool producesPiEvent() const final;
696 
697  std::vector<Command *> &auxiliaryCommands();
698 
699  void addToFusionList(ExecCGCommand *Kernel);
700 
701  std::vector<ExecCGCommand *> &getFusionList();
702 
706  void setFusionStatus(FusionStatus Status);
707 
708  bool isActive() const { return MStatus == FusionStatus::ACTIVE; }
709 
710  bool readyForDeletion() const { return MStatus == FusionStatus::DELETED; }
711 
712 private:
713  pi_int32 enqueueImp() final;
714 
715  std::vector<ExecCGCommand *> MFusionList;
716 
717  std::vector<Command *> MAuxiliaryCommands;
718 
719  FusionStatus MStatus;
720 };
721 
722 } // namespace detail
723 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
724 } // namespace sycl
sycl::_V1::detail::EmptyCommand::getRequirement
const Requirement * getRequirement() const final
Definition: commands.hpp:394
sycl::_V1::detail::Command::MEvent
EventImplPtr MEvent
Definition: commands.hpp:242
sycl::_V1::detail::Command::MQueue
QueueImplPtr MQueue
Definition: commands.hpp:241
sycl::_V1::detail::Command
The Command class represents some action that needs to be performed on one or more memory objects.
Definition: commands.hpp:99
sycl::_V1::detail::EnqueueResultT::MResult
ResultT MResult
Indicates the result of enqueueing.
Definition: commands.hpp:65
event_impl.hpp
sycl::_V1::detail::UnMapMemObject::getRequirement
const Requirement * getRequirement() const final
Definition: commands.hpp:540
cg.hpp
sycl::_V1::access::mode
mode
Definition: access.hpp:30
sycl::_V1::detail::Command::isSuccessfullyEnqueued
bool isSuccessfullyEnqueued() const
Definition: commands.hpp:146
sycl::_V1::detail::ContextImplPtr
std::shared_ptr< sycl::detail::context_impl > ContextImplPtr
Definition: event_impl.hpp:30
sycl::_V1::detail::Command::getRequirement
virtual const Requirement * getRequirement() const
Definition: commands.hpp:202
sycl::_V1::detail::Command::MMarks
Marks MMarks
Used for marking the node during graph traversal.
Definition: commands.hpp:320
sycl::_V1::detail::waitForEvents
static void waitForEvents(const std::vector< EventImplPtr > &Events)
Definition: memory_manager.cpp:115
sycl::_V1::detail::Command::MSubmissionFunctionName
std::string MSubmissionFunctionName
Definition: commands.hpp:363
sycl::_V1::detail::AccessorImplHost
Definition: accessor_impl.hpp:42
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:11
sycl::_V1::detail::pi::PiKernelCacheConfig
::pi_kernel_cache_config PiKernelCacheConfig
Definition: pi.hpp:150
sycl::_V1::detail::MemCpyCommandHost::getRequirement
const Requirement * getRequirement() const final
Definition: commands.hpp:585
sycl::_V1::detail::EnqueueResultT
Result of command enqueueing.
Definition: commands.hpp:54
sycl::_V1::detail::DispatchHostTask
Definition: commands.cpp:296
sycl::_V1::detail::Command::ALLOCA
@ ALLOCA
Definition: commands.hpp:104
sycl::_V1::detail::Command::HOST_TASK
@ HOST_TASK
Definition: commands.hpp:111
sycl::_V1::detail::MapMemObject
The map command enqueues mapping of device memory onto host memory.
Definition: commands.hpp:515
sycl::_V1::detail::tie
auto tie(Ts &...Args)
Definition: tuple.hpp:40
sycl::_V1::detail::Command::getQueue
const QueueImplPtr & getQueue() const
Definition: commands.hpp:166
sycl::_V1::detail::kernel_impl
Definition: kernel_impl.hpp:34
sycl::_V1::detail::Command::EMPTY_TASK
@ EMPTY_TASK
Definition: commands.hpp:110
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14
sycl::_V1::detail::EmptyCommand
The empty command does nothing during enqueue.
Definition: commands.hpp:389
sycl::_V1::detail::EnqueueResultT::SyclEnqueueBlocked
@ SyclEnqueueBlocked
Definition: commands.hpp:58
sycl::_V1::detail::KernelBundleImplPtr
std::shared_ptr< detail::kernel_bundle_impl > KernelBundleImplPtr
Definition: kernel_bundle.hpp:138
access.hpp
sycl::_V1::detail::KernelFusionCommand
The KernelFusionCommand is placed in the execution graph together with the individual kernels of the ...
Definition: commands.hpp:687
sycl::_V1::detail::Command::addUser
void addUser(Command *NewUser)
Definition: commands.hpp:129
sycl::_V1::detail::ExecCGCommand::getCG
detail::CG & getCG() const
Definition: commands.hpp:629
sycl::_V1::detail::Command::UPDATE_REQUIREMENT
@ UPDATE_REQUIREMENT
Definition: commands.hpp:109
sycl::_V1::detail::AllocaSubBufCommand
The AllocaSubBuf command enqueues creation of sub-buffer of memory object.
Definition: commands.hpp:496
sycl::_V1::detail::EnqueueResultT::SyclEnqueueReady
@ SyclEnqueueReady
Definition: commands.hpp:56
sycl::_V1::detail::Command::MDeps
std::vector< DepDesc > MDeps
Contains list of dependencies(edges)
Definition: commands.hpp:305
sycl::_V1::detail::NON_BLOCKING
@ NON_BLOCKING
Definition: commands.hpp:51
sycl::_V1::detail::UpdateHostRequirementCommand::getRequirement
const Requirement * getRequirement() const final
Definition: commands.hpp:674
sycl::_V1::detail::AllocaCommandBase::getRequirement
const Requirement * getRequirement() const final
Definition: commands.hpp:442
sycl::_V1::detail::ReleaseCommand
The release command enqueues release of a memory object instance allocated on Host or underlying fram...
Definition: commands.hpp:413
sycl::_V1::detail::BlockingT
BlockingT
Definition: commands.hpp:51
sycl::_V1::detail::DepDesc::DepDesc
DepDesc(Command *DepCommand, const Requirement *Req, AllocaCommandBase *AllocaCmd)
Definition: commands.hpp:74
sycl::_V1::detail::Command::BlockReason
BlockReason
Definition: commands.hpp:322
sycl::_V1::detail::DepDesc::MDepRequirement
const Requirement * MDepRequirement
Requirement for the dependency.
Definition: commands.hpp:86
sycl::_V1::detail::Command::MAP_MEM_OBJ
@ MAP_MEM_OBJ
Definition: commands.hpp:107
sycl::_V1::detail::DepDesc::MDepCommand
Command * MDepCommand
The actual dependency command.
Definition: commands.hpp:84
sycl::_V1::detail::Command::MBlockedUsersMutex
std::mutex MBlockedUsersMutex
Definition: commands.hpp:384
sycl::_V1::detail::EnqueueResultT::MCmd
Command * MCmd
Pointer to the command which failed to enqueue.
Definition: commands.hpp:67
sycl::_V1::detail::Command::isBlocking
bool isBlocking() const
Definition: commands.hpp:157
sycl::_V1::detail::AllocaCommand
The alloca command enqueues allocation of instance of memory object on Host or underlying framework.
Definition: commands.hpp:476
sycl::_V1::detail::Command::getType
CommandType getType() const
Definition: commands.hpp:132
sycl::_V1::detail::enqueueReadWriteHostPipe
pi_int32 enqueueReadWriteHostPipe(const QueueImplPtr &Queue, const std::string &PipeName, bool blocking, void *ptr, size_t size, std::vector< RT::PiEvent > &RawEvents, RT::PiEvent *OutEvent, bool read)
Definition: commands.cpp:2427
sycl::_V1::detail::Command::addBlockedUserUnique
void addBlockedUserUnique(const EventImplPtr &NewUser)
Definition: commands.hpp:159
sycl::_V1::detail::Command::UNMAP_MEM_OBJ
@ UNMAP_MEM_OBJ
Definition: commands.hpp:108
sycl::_V1::detail::Command::MSubmissionCodeLocation
code_location MSubmissionCodeLocation
Represents code location of command submission to SYCL API, assigned with the valid value only if com...
Definition: commands.hpp:359
sycl::_V1::detail::Command::MBlockReason
BlockReason MBlockReason
Definition: commands.hpp:325
sycl::_V1::detail::Command::MCommandNodeType
std::string MCommandNodeType
Buffer to build the command node type.
Definition: commands.hpp:347
sycl::_V1::detail::DepDesc
Dependency between two commands.
Definition: commands.hpp:73
sycl::_V1::detail::Command::MEnqueueMtx
std::mutex MEnqueueMtx
Mutex used to protect enqueueing from race conditions.
Definition: commands.hpp:276
sycl::_V1::detail::Command::getEvent
const EventImplPtr & getEvent() const
Definition: commands.hpp:168
sycl::_V1::detail::HostTask
Definition: cg_types.hpp:228
sycl::_V1::detail::Command::MSubmissionFileName
std::string MSubmissionFileName
Introduces string to handle memory management since code_location struct works with raw char arrays.
Definition: commands.hpp:362
sycl::_V1::detail::MemCpyCommand
The mem copy command enqueues memory copy between two instances of memory object.
Definition: commands.hpp:554
sycl::_V1::detail::EnqueueResultT::ResultT
ResultT
Definition: commands.hpp:55
sycl::_V1::detail::Command::Marks
Definition: commands.hpp:313
sycl::_V1::detail::OSModuleHandle
intptr_t OSModuleHandle
Uniquely identifies an operating system module (executable or a dynamic library)
Definition: os_util.hpp:48
sycl::_V1::detail::EventImplPtr
std::shared_ptr< event_impl > EventImplPtr
Definition: cg.hpp:42
program_manager.hpp
sycl::_V1::detail::Command::clearAllDependencies
void clearAllDependencies()
Clear all dependency events This should only be used if a command is about to be deleted without bein...
Definition: commands.hpp:298
sycl::_V1::detail::Command::getPreparedDepsEvents
const std::vector< EventImplPtr > & getPreparedDepsEvents() const
Definition: commands.hpp:285
sycl::_V1::detail::EnqueueResultT::SyclEnqueueSuccess
@ SyclEnqueueSuccess
Definition: commands.hpp:57
sycl::_V1::detail::Command::MUsers
std::unordered_set< Command * > MUsers
Contains list of commands that depend on the command.
Definition: commands.hpp:307
sycl::_V1::detail::Command::RELEASE
@ RELEASE
Definition: commands.hpp:106
accessor_impl.hpp
sycl::_V1::detail::ExecCGCommand
The exec CG command enqueues execution of kernel or explicit memory operation.
Definition: commands.hpp:618
sycl::_V1::detail::NDRDescT
Definition: cg_types.hpp:41
sycl::_V1::detail::StreamImplPtr
std::shared_ptr< detail::stream_impl > StreamImplPtr
Definition: commands.hpp:42
sycl::_V1::detail::Command::CommandType
CommandType
Definition: commands.hpp:101
sycl::_V1::detail::MemCpyCommand::getRequirement
const Requirement * getRequirement() const final
Definition: commands.hpp:561
sycl::_V1::detail::MapMemObject::getRequirement
const Requirement * getRequirement() const final
Definition: commands.hpp:521
sycl::_V1::detail::AllocaSubBufCommand::getParentAlloca
AllocaCommandBase * getParentAlloca()
Definition: commands.hpp:505
sycl::_V1::detail::EnqueueResultT::MErrCode
pi_int32 MErrCode
Error code which is set when enqueueing fails.
Definition: commands.hpp:69
sycl::_V1::detail::code_location
Definition: common.hpp:66
sycl::_V1::detail::Command::MCommandName
std::string MCommandName
Buffer to build the command end-user understandable name.
Definition: commands.hpp:349
sycl::_V1::detail::AllocaCommand::getMemAllocation
void * getMemAllocation() const final
Definition: commands.hpp:483
std
Definition: accessor.hpp:3922
sycl::_V1::detail::BLOCKING
@ BLOCKING
Definition: commands.hpp:51
sycl::_V1::detail::Command::MWorkerQueue
QueueImplPtr MWorkerQueue
Definition: commands.hpp:243
sycl::_V1::detail::Command::COPY_MEMORY
@ COPY_MEMORY
Definition: commands.hpp:103
sycl::_V1::detail::Command::getPreparedHostDepsEvents
const std::vector< EventImplPtr > & getPreparedHostDepsEvents() const
Definition: commands.hpp:281
sycl::_V1::detail::ArgDesc
Definition: cg_types.hpp:27
sycl::_V1::detail::QueueImplPtr
std::shared_ptr< sycl::detail::queue_impl > QueueImplPtr
Definition: event_impl.hpp:32
sycl::_V1::detail::DepDesc::operator<
friend bool operator<(const DepDesc &Lhs, const DepDesc &Rhs)
Definition: commands.hpp:78
sycl::_V1::detail::SYCLMemObjI
Definition: sycl_mem_obj_i.hpp:28
sycl::_V1::detail::Command::MAddressString
std::string MAddressString
Buffer to build the address string.
Definition: commands.hpp:345
sycl::_V1::detail::emitKernelInstrumentationData
void emitKernelInstrumentationData(const std::shared_ptr< detail::kernel_impl > &SyclKernel, const detail::code_location &CodeLoc, const std::string &SyclKernelName, const QueueImplPtr &Queue, const NDRDescT &NDRDesc, const std::shared_ptr< detail::kernel_bundle_impl > &KernelBundleImplPtr, const detail::OSModuleHandle &OSModHandle, std::vector< ArgDesc > &CGArgs)
Definition: commands.cpp:2005
sycl::_V1::detail::Command::~Command
virtual ~Command()
Definition: commands.hpp:207
sycl::_V1::detail::kernel_bundle_impl
Definition: kernel_bundle_impl.hpp:48
sycl::_V1::detail::AllocaCommandBase::getSYCLMemObj
SYCLMemObjI * getSYCLMemObj() const
Definition: commands.hpp:438
sycl::_V1::detail::Command::MPreparedHostDepsEvents
std::vector< EventImplPtr > & MPreparedHostDepsEvents
Definition: commands.hpp:248
sycl::_V1::detail::Command::MPreparedDepsEvents
std::vector< EventImplPtr > & MPreparedDepsEvents
Dependency events prepared for waiting by backend.
Definition: commands.hpp:247
sycl::_V1::detail::CG
Base class for all types of command groups.
Definition: cg.hpp:52
sycl::_V1::detail::UpdateHostRequirementCommand
Definition: commands.hpp:668
sycl::_V1::detail::KernelFusionCommand::readyForDeletion
bool readyForDeletion() const
Definition: commands.hpp:710
sycl::_V1::detail::AllocaCommandBase
Base class for memory allocation commands.
Definition: commands.hpp:431
sycl::_V1::detail::Command::RUN_CG
@ RUN_CG
Definition: commands.hpp:102
sycl::_V1::detail::UnMapMemObject
The unmap command removes mapping of host memory onto device memory.
Definition: commands.hpp:534
sycl::_V1::detail::Command::MBlockedUsers
std::vector< EventImplPtr > MBlockedUsers
Contains list of commands that depends on the host command explicitly (by depends_on).
Definition: commands.hpp:383
sycl::_V1::detail::AllocaCommandBase::getReleaseCmd
ReleaseCommand * getReleaseCmd()
Definition: commands.hpp:436
sycl::_V1::detail::KernelFusionCommand::FusionStatus
FusionStatus
Definition: commands.hpp:689
sycl::_V1::detail::Command::MType
CommandType MType
The type of the command.
Definition: commands.hpp:274
sycl::_V1::detail::enqueueImpKernel
pi_int32 enqueueImpKernel(const QueueImplPtr &Queue, NDRDescT &NDRDesc, std::vector< ArgDesc > &Args, const std::shared_ptr< detail::kernel_bundle_impl > &KernelBundleImplPtr, const std::shared_ptr< detail::kernel_impl > &MSyclKernel, const std::string &KernelName, const detail::OSModuleHandle &OSModuleHandle, std::vector< RT::PiEvent > &RawEvents, RT::PiEvent *OutEvent, const std::function< void *(Requirement *Req)> &getMemAllocationFunc, RT::PiKernelCacheConfig KernelCacheConfig)
Definition: commands.cpp:2308
sycl::_V1::detail::MemCpyCommandHost
The mem copy host command enqueues memory copy between two instances of memory object.
Definition: commands.hpp:578
sycl::_V1::detail::pi::PiEvent
::pi_event PiEvent
Definition: pi.hpp:138
sycl::_V1::detail::EnqueueResultT::EnqueueResultT
EnqueueResultT(ResultT Result=SyclEnqueueSuccess, Command *Cmd=nullptr, pi_int32 ErrCode=PI_SUCCESS)
Definition: commands.hpp:61
sycl::_V1::detail::Command::isEnqueueBlocked
bool isEnqueueBlocked() const
Definition: commands.hpp:152
sycl::_V1::detail::Command::MEnqueueStatus
std::atomic< EnqueueResultT::ResultT > MEnqueueStatus
Describes the status of the command.
Definition: commands.hpp:328
pi_int32
int32_t pi_int32
Definition: pi.h:141
sycl::_V1::detail::Command::ALLOCA_SUB_BUF
@ ALLOCA_SUB_BUF
Definition: commands.hpp:105