17 #include <unordered_set>
33 class DispatchHostTask;
35 using QueueImplPtr = std::shared_ptr<detail::queue_impl>;
36 using EventImplPtr = std::shared_ptr<detail::event_impl>;
59 : MResult(Result), MCmd(Cmd), MErrCode(ErrCode) {}
72 : MDepCommand(DepCommand), MDepRequirement(Req), MAllocaCmd(AllocaCmd) {}
116 std::vector<Command *> &ToCleanUp);
122 std::vector<Command *> &ToCleanUp);
137 std::vector<Command *> &ToCleanUp);
142 return MEnqueueStatus == EnqueueResultT::SyclEnqueueSuccess;
146 return MEnqueueStatus == EnqueueResultT::SyclEnqueueBlocked;
158 void emitInstrumentationDataProxy();
160 virtual void emitInstrumentationData() = 0;
163 void resolveReleaseDependencies(std::set<Command *> &list);
165 void emitEdgeEventForCommandDependence(
166 Command *Cmd,
void *ObjAddr,
bool IsCommand,
167 std::optional<access::mode> AccMode = std::nullopt);
171 void emitEnqueuedEventSignal(
RT::PiEvent &PiEventAddr);
176 uint64_t makeTraceEventProlog(
void *MAddress);
179 void makeTraceEventEpilog();
181 void emitInstrumentation(uint16_t Type,
const char *Txt =
nullptr);
185 virtual void printDot(std::ostream &Stream)
const = 0;
188 assert(
false &&
"Internal Error. The command has no stored requirement");
192 virtual ~Command() { MEvent->cleanDepEventsThroughOneLevel(); }
194 const char *getBlockReason()
const;
205 virtual bool producesPiEvent()
const;
208 virtual bool supportsPostEnqueueCleanup()
const;
223 void waitForPreparedHostEvents()
const;
238 std::vector<Command *> &ToCleanUp);
252 return MPreparedHostDepsEvents;
260 bool MIsBlockable =
false;
262 unsigned MLeafCounter = 0;
266 bool MVisited =
false;
268 bool MToBeDeleted =
false;
287 void *MTraceEvent =
nullptr;
291 int32_t MStreamID = -1;
294 void *MAddress =
nullptr;
302 bool MTraceEventPrologComplete =
false;
304 bool MFirstInstance =
false;
306 uint64_t MInstanceID = 0;
314 bool MShouldCompleteEventIfPossible =
true;
318 bool MPostEnqueueCleanup =
false;
327 void printDot(std::ostream &Stream)
const final;
332 void emitInstrumentationData()
override;
334 bool producesPiEvent() const final;
351 void printDot(std::ostream &Stream)
const final;
352 void emitInstrumentationData()
override;
353 bool producesPiEvent()
const final;
354 bool supportsPostEnqueueCleanup()
const final;
373 virtual void *getMemAllocation()
const = 0;
377 void emitInstrumentationData()
override;
379 bool producesPiEvent() const final;
381 bool supportsPostEnqueueCleanup() const final;
383 void *MMemAllocation =
nullptr;
392 bool MIsActive = true;
396 bool MIsLeaderAlloca = true;
408 bool InitFromUserData =
true,
412 void printDot(std::ostream &Stream)
const final;
413 void emitInstrumentationData()
override;
420 bool MInitFromUserData = false;
428 std::vector<Command *> &ToEnqueue,
429 std::vector<Command *> &ToCleanUp);
431 void *getMemAllocation()
const final;
432 void printDot(std::ostream &Stream)
const final;
434 void emitInstrumentationData()
override;
448 void printDot(std::ostream &Stream)
const final;
450 void emitInstrumentationData()
override;
457 void **MDstPtr =
nullptr;
458 access::
mode MMapMode;
467 void printDot(std::ostream &Stream)
const final;
469 void emitInstrumentationData()
override;
470 bool producesPiEvent() const final;
477 void **MSrcPtr =
nullptr;
488 void printDot(std::ostream &Stream)
const final;
490 void emitInstrumentationData() final;
493 bool producesPiEvent() const final;
513 void printDot(std::ostream &Stream)
const final;
515 void emitInstrumentationData() final;
526 void **MDstPtr =
nullptr;
535 const
std::function<
void *(
Requirement *Req)> &getMemAllocationFunc);
543 std::vector<StreamImplPtr> getStreams()
const;
544 std::vector<std::shared_ptr<const void>> getAuxiliaryResources()
const;
547 void clearAuxiliaryResources();
549 void printDot(std::ostream &Stream)
const final;
550 void emitInstrumentationData()
final;
560 bool producesPiEvent() const final;
562 bool supportsPostEnqueueCleanup() const final;
569 std::unique_ptr<detail::
CG> MCommandGroup;
579 void printDot(std::ostream &Stream)
const final;
581 void emitInstrumentationData() final;
588 void **MDstPtr =
nullptr;