17 inline namespace _V1 {
21 return (
Command *)Event->getCommand();
26 std::vector<Command *> &ToCleanUp,
27 bool LockTheLock,
bool *Success) {
39 throw runtime_error(
"Enqueue process failed.", PI_ERROR_INVALID_OPERATION);
43 GraphReadLock.unlock();
44 Event->waitInternal(Success);
54 if (Cmd == RootCommand || Blocking)
74 std::vector<Command *> &ToCleanUp,
Command *RootCommand,
79 return handleBlockingCmd(Cmd, EnqueueResult, RootCommand, Blocking);
87 printFusionWarning(
"Aborting fusion because synchronization with one of "
88 "the kernels in the fusion list was requested");
91 GraphReadLock.unlock();
98 if (FusionCmd->isSuccessfullyEnqueued()) {
112 if (
Command *DepCmd =
static_cast<Command *
>(Event->getCommand()))
113 if (!enqueueCommand(DepCmd, GraphReadLock, EnqueueResult, ToCleanUp,
114 RootCommand, Blocking))
125 if (
Command *DepCmd =
static_cast<Command *
>(Event->getCommand()))
126 if (!enqueueCommand(DepCmd, GraphReadLock, EnqueueResult, ToCleanUp,
127 RootCommand, Blocking))
144 bool Result = Cmd->
enqueue(EnqueueResult, Blocking, ToCleanUp);
146 Result = handleBlockingCmd(Cmd, EnqueueResult, RootCommand, Blocking);
The Command class represents some action that needs to be performed on one or more memory objects.
void copySubmissionCodeLocation()
bool isSuccessfullyEnqueued() const
const std::vector< EventImplPtr > & getPreparedDepsEvents() const
const std::vector< EventImplPtr > & getPreparedHostDepsEvents() const
std::mutex MBlockedUsersMutex
virtual bool enqueue(EnqueueResultT &EnqueueResult, BlockingT Blocking, std::vector< Command * > &ToCleanUp)
Checks if the command is enqueued, and calls enqueueImp.
const EventImplPtr & getEvent() const
bool isEnqueueBlocked() const
void addBlockedUserUnique(const EventImplPtr &NewUser)
The KernelFusionCommand is placed in the execution graph together with the individual kernels of the ...
static void waitForEvent(const EventImplPtr &Event, ReadLockT &GraphReadLock, std::vector< Command * > &ToCleanUp, bool LockTheLock=true, bool *Success=nullptr)
Waits for the command, associated with Event passed, is completed.
static bool enqueueCommand(Command *Cmd, ReadLockT &GraphReadLock, EnqueueResultT &EnqueueResult, std::vector< Command * > &ToCleanUp, Command *RootCommand, BlockingT Blocking=NON_BLOCKING)
Enqueues the command and all its dependencies.
static bool handleBlockingCmd(Command *Cmd, EnqueueResultT &EnqueueResult, Command *RootCommand, BlockingT Blocking)
Check if successfully enqueued command is expected to be blocking for the dependent commands before i...
void cancelFusion(QueueImplPtr Queue)
std::shared_lock< RWLockT > ReadLockT
static Scheduler & getInstance()
static Command * getCommand(const EventImplPtr &Event)
std::shared_ptr< event_impl > EventImplPtr
Result of command enqueueing.
ResultT MResult
Indicates the result of enqueueing.