The Command class represents some action that needs to be performed on one or more memory objects. More...
#include <detail/scheduler/commands.hpp>
Classes | |
struct | Marks |
Public Types | |
enum | CommandType { RUN_CG, COPY_MEMORY, ALLOCA, ALLOCA_SUB_BUF, RELEASE, MAP_MEM_OBJ, UNMAP_MEM_OBJ, UPDATE_REQUIREMENT, EMPTY_TASK, HOST_TASK, FUSION, EXEC_CMD_BUFFER } |
enum | BlockReason : int { BlockReason::HostAccessor = 0, BlockReason::HostTask } |
Public Member Functions | |
Command (CommandType Type, QueueImplPtr Queue, sycl::detail::pi::PiExtCommandBuffer CommandBuffer=nullptr, const std::vector< sycl::detail::pi::PiExtSyncPoint > &SyncPoints={}) | |
It is safe to bind MPreparedDepsEvents and MPreparedHostDepsEvents references to event_impl class members because Command should not outlive the event connected to it. More... | |
Command * | addDep (DepDesc NewDep, std::vector< Command * > &ToCleanUp) |
Command * | addDep (EventImplPtr Event, std::vector< Command * > &ToCleanUp) |
void | addUser (Command *NewUser) |
CommandType | getType () const |
virtual bool | enqueue (EnqueueResultT &EnqueueResult, BlockingT Blocking, std::vector< Command * > &ToCleanUp) |
Checks if the command is enqueued, and calls enqueueImp. More... | |
bool | isFinished () |
bool | isSuccessfullyEnqueued () const |
bool | isEnqueueBlocked () const |
bool | isBlocking () const |
void | addBlockedUserUnique (const EventImplPtr &NewUser) |
const QueueImplPtr & | getQueue () const |
const EventImplPtr & | getEvent () const |
void | emitInstrumentationDataProxy () |
Proxy method which calls emitInstrumentationData. More... | |
virtual void | emitInstrumentationData ()=0 |
Instrumentation method which emits telemetry data. More... | |
void | resolveReleaseDependencies (std::set< Command * > &list) |
Looks at all the dependencies for the release command and enables instrumentation to report these dependencies as edges. More... | |
void | emitEdgeEventForCommandDependence (Command *Cmd, void *ObjAddr, bool IsCommand, std::optional< access::mode > AccMode=std::nullopt) |
Creates an edge event when the dependency is a command. More... | |
void | emitEdgeEventForEventDependence (Command *Cmd, sycl::detail::pi::PiEvent &EventAddr) |
Creates an edge event when the dependency is an event. More... | |
void | emitEnqueuedEventSignal (sycl::detail::pi::PiEvent &PiEventAddr) |
Creates a signal event with the enqueued kernel event handle. More... | |
uint64_t | makeTraceEventProlog (void *MAddress) |
Create a trace event of node_create type; this must be guarded by a check for xptiTraceEnabled(). More... | |
void | makeTraceEventEpilog () |
If prolog has been run, run epilog; this must be guarded by a check for xptiTraceEnabled(). More... | |
void | emitInstrumentation (uint16_t Type, const char *Txt=nullptr) |
Emits an event of Type. More... | |
virtual void | printDot (std::ostream &Stream) const =0 |
virtual const Requirement * | getRequirement () const |
virtual | ~Command () |
const char * | getBlockReason () const |
virtual const ContextImplPtr & | getWorkerContext () const |
Get the context of the queue this command will be submitted to. More... | |
const QueueImplPtr & | getWorkerQueue () const |
Get the queue this command will be submitted to. More... | |
virtual bool | producesPiEvent () const |
Returns true iff the command produces a PI event on non-host devices. More... | |
virtual bool | supportsPostEnqueueCleanup () const |
Returns true iff this command can be freed by post enqueue cleanup. More... | |
virtual bool | readyForCleanup () const |
Returns true iff this command is ready to be submitted for cleanup. More... | |
std::vector< sycl::detail::pi::PiEvent > | getPiEvents (const std::vector< EventImplPtr > &EventImpls) const |
Collect PI events from EventImpls and filter out some of them in case of in order queue. More... | |
std::vector< sycl::detail::pi::PiEvent > | getPiEventsBlocking (const std::vector< EventImplPtr > &EventImpls) const |
Collect PI events from EventImpls and filter out some of them in case of in order queue. More... | |
bool | isHostTask () const |
const std::vector< EventImplPtr > & | getPreparedHostDepsEvents () const |
const std::vector< EventImplPtr > & | getPreparedDepsEvents () const |
void | copySubmissionCodeLocation () |
void | clearAllDependencies () |
Clear all dependency events This should only be used if a command is about to be deleted without being executed before that. More... | |
Public Attributes | |
std::vector< DepDesc > | MDeps |
Contains list of dependencies(edges) More... | |
std::unordered_set< Command * > | MUsers |
Contains list of commands that depend on the command. More... | |
bool | MIsBlockable = false |
Indicates whether the command can be blocked from enqueueing. More... | |
unsigned | MLeafCounter = 0 |
Counts the number of memory objects this command is a leaf for. More... | |
Marks | MMarks |
Used for marking the node during graph traversal. More... | |
BlockReason | MBlockReason |
std::atomic< EnqueueResultT::ResultT > | MEnqueueStatus |
Describes the status of the command. More... | |
void * | MTraceEvent = nullptr |
The event for node_create and task_begin. More... | |
int32_t | MStreamID = -1 |
The stream under which the traces are emitted. More... | |
void * | MAddress = nullptr |
Reserved for storing the object address such as SPIR-V or memory object address. More... | |
std::string | MAddressString |
Buffer to build the address string. More... | |
std::string | MCommandNodeType |
Buffer to build the command node type. More... | |
std::string | MCommandName |
Buffer to build the command end-user understandable name. More... | |
bool | MTraceEventPrologComplete = false |
Flag to indicate if makeTraceEventProlog() has been run. More... | |
bool | MFirstInstance = false |
Flag to indicate if this is the first time we are seeing this payload. More... | |
uint64_t | MInstanceID = 0 |
Instance ID tracked for the command. More... | |
code_location | MSubmissionCodeLocation |
Represents code location of command submission to SYCL API, assigned with the valid value only if command execution is async (host task) or delayed (blocked by host task). More... | |
std::string | MSubmissionFileName |
Introduces string to handle memory management since code_location struct works with raw char arrays. More... | |
std::string | MSubmissionFunctionName |
bool | MShouldCompleteEventIfPossible = true |
bool | MMarkedForCleanup = false |
Indicates that the node will be freed by graph cleanup. More... | |
std::vector< EventImplPtr > | MBlockedUsers |
Contains list of commands that depends on the host command explicitly (by depends_on). More... | |
std::mutex | MBlockedUsersMutex |
Protected Member Functions | |
void | waitForEvents (QueueImplPtr Queue, std::vector< EventImplPtr > &RawEvents, sycl::detail::pi::PiEvent &Event) |
void | waitForPreparedHostEvents () const |
Command * | processDepEvent (EventImplPtr DepEvent, const DepDesc &Dep, std::vector< Command * > &ToCleanUp) |
Perform glueing of events from different contexts. More... | |
virtual pi_int32 | enqueueImp ()=0 |
Private interface. Derived classes should implement this method. More... | |
sycl::detail::pi::PiExtCommandBuffer | getCommandBuffer () const |
Gets the command buffer (if any) associated with this command. More... | |
Protected Attributes | |
QueueImplPtr | MQueue |
EventImplPtr | MEvent |
QueueImplPtr | MWorkerQueue |
std::vector< EventImplPtr > & | MPreparedDepsEvents |
Dependency events prepared for waiting by backend. More... | |
std::vector< EventImplPtr > & | MPreparedHostDepsEvents |
CommandType | MType |
The type of the command. More... | |
std::mutex | MEnqueueMtx |
Mutex used to protect enqueueing from race conditions. More... | |
sycl::detail::pi::PiExtCommandBuffer | MCommandBuffer |
CommandBuffer which will be used to submit to instead of the queue, if set. More... | |
std::vector< sycl::detail::pi::PiExtSyncPoint > | MSyncPointDeps |
List of sync points for submissions to a command buffer. More... | |
Friends | |
class | DispatchHostTask |
The Command class represents some action that needs to be performed on one or more memory objects.
The Command has a vector of DepDesc objects that represent dependencies of the command. It has a vector of pointers to commands that depend on the command. It has a pointer to a queue object and an event that is associated with the command.
Definition at line 99 of file commands.hpp.
|
strong |
Enumerator | |
---|---|
HostAccessor | |
HostTask |
Definition at line 326 of file commands.hpp.
Enumerator | |
---|---|
RUN_CG | |
COPY_MEMORY | |
ALLOCA | |
ALLOCA_SUB_BUF | |
RELEASE | |
MAP_MEM_OBJ | |
UNMAP_MEM_OBJ | |
UPDATE_REQUIREMENT | |
EMPTY_TASK | |
HOST_TASK | |
FUSION | |
EXEC_CMD_BUFFER |
Definition at line 101 of file commands.hpp.
sycl::_V1::detail::Command::Command | ( | CommandType | Type, |
QueueImplPtr | Queue, | ||
sycl::detail::pi::PiExtCommandBuffer | CommandBuffer = nullptr , |
||
const std::vector< sycl::detail::pi::PiExtSyncPoint > & | SyncPoints = {} |
||
) |
It is safe to bind MPreparedDepsEvents and MPreparedHostDepsEvents references to event_impl class members because Command should not outlive the event connected to it.
Definition at line 490 of file commands.cpp.
References MEnqueueStatus, MEvent, MQueue, MStreamID, MWorkerQueue, sycl::_V1::detail::SYCL_STREAM_NAME, and sycl::_V1::detail::EnqueueResultT::SyclEnqueueReady.
|
inlinevirtual |
Definition at line 211 of file commands.hpp.
References MEvent.
|
inline |
Definition at line 162 of file commands.hpp.
References MBlockedUsers.
Referenced by sycl::_V1::detail::Scheduler::GraphProcessor::handleBlockingCmd().
Command * sycl::_V1::detail::Command::addDep | ( | DepDesc | NewDep, |
std::vector< Command * > & | ToCleanUp | ||
) |
NewDep | dependency to be added |
ToCleanUp | container for commands that can be cleaned up. |
Definition at line 738 of file commands.cpp.
References addUser(), emitEdgeEventForCommandDependence(), getEvent(), sycl::_V1::detail::AccessorImplHost::MAccessMode, sycl::_V1::detail::DepDesc::MDepCommand, sycl::_V1::detail::DepDesc::MDepRequirement, MDeps, sycl::_V1::detail::AccessorImplHost::MSYCLMemObj, and processDepEvent().
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::addCopyBack(), sycl::_V1::detail::EmptyCommand::addRequirement(), sycl::_V1::detail::AllocaCommand::AllocaCommand(), sycl::_V1::detail::AllocaSubBufCommand::AllocaSubBufCommand(), sycl::_V1::detail::Scheduler::GraphBuilder::connectDepEvent(), and sycl::_V1::detail::Scheduler::GraphBuilder::getOrInsertMemObjRecord().
Command * sycl::_V1::detail::Command::addDep | ( | EventImplPtr | Event, |
std::vector< Command * > & | ToCleanUp | ||
) |
NewDep | dependency to be added |
ToCleanUp | container for commands that can be cleaned up. |
Definition at line 763 of file commands.cpp.
References emitEdgeEventForEventDependence(), and processDepEvent().
|
inline |
Definition at line 132 of file commands.hpp.
References MUsers.
Referenced by addDep(), and sycl::_V1::detail::Scheduler::GraphBuilder::connectDepEvent().
|
inline |
Clear all dependency events This should only be used if a command is about to be deleted without being executed before that.
As of now, the only valid use case for this function is in kernel fusion, where the fused kernel commands are replaced by the fused command without ever being executed.
Definition at line 302 of file commands.hpp.
References MDeps, MPreparedDepsEvents, and MPreparedHostDepsEvents.
void sycl::_V1::detail::Command::copySubmissionCodeLocation | ( | ) |
Definition at line 947 of file commands.cpp.
References MSubmissionCodeLocation, MSubmissionFileName, MSubmissionFunctionName, and sycl::_V1::detail::tls_code_loc_t::query().
Referenced by sycl::_V1::detail::Scheduler::GraphProcessor::handleBlockingCmd().
void sycl::_V1::detail::Command::emitEdgeEventForCommandDependence | ( | Command * | Cmd, |
void * | ObjAddr, | ||
bool | IsCommand, | ||
std::optional< access::mode > | AccMode = std::nullopt |
||
) |
Creates an edge event when the dependency is a command.
Method takes in void * for the address as adding a template function to the command group object maybe undesirable.
Cmd | The command object of the source of the edge |
ObjAddr | The address that defines the edge dependency; it is the event address when the edge is for an event and a memory object address if it is due to an accessor |
Prefix | Contains "event" if the dependency is an edge and contains the access mode to the buffer if it is due to an accessor |
IsCommand | True if the dependency has a command object as the source, false otherwise |
Definition at line 531 of file commands.cpp.
References sycl::_V1::detail::accessModeToString(), MAddress, MStreamID, and MTraceEvent.
Referenced by addDep(), and emitEdgeEventForEventDependence().
void sycl::_V1::detail::Command::emitEdgeEventForEventDependence | ( | Command * | Cmd, |
sycl::detail::pi::PiEvent & | PiEventAddr | ||
) |
Creates an edge event when the dependency is an event.
Creates an edge when the dependency is due to an event.
Cmd | The command object of the source of the edge |
PiEventAddr | The address that defines the edge dependency, which in this case is an event |
Definition at line 582 of file commands.cpp.
References emitEdgeEventForCommandDependence(), MAddress, MStreamID, and MTraceEvent.
Referenced by addDep().
void sycl::_V1::detail::Command::emitEnqueuedEventSignal | ( | sycl::detail::pi::PiEvent & | PiEventAddr | ) |
Creates a signal event with the enqueued kernel event handle.
Definition at line 778 of file commands.cpp.
References MInstanceID, MStreamID, and MTraceEvent.
Referenced by enqueue().
void sycl::_V1::detail::Command::emitInstrumentation | ( | uint16_t | Type, |
const char * | Txt = nullptr |
||
) |
Emits an event of Type.
Definition at line 792 of file commands.cpp.
References MInstanceID, MStreamID, and MTraceEvent.
Referenced by enqueue().
|
pure virtual |
Instrumentation method which emits telemetry data.
Implemented in sycl::_V1::detail::UnMapMemObject, sycl::_V1::detail::MapMemObject, sycl::_V1::detail::AllocaSubBufCommand, sycl::_V1::detail::AllocaCommand, sycl::_V1::detail::AllocaCommandBase, sycl::_V1::detail::ReleaseCommand, sycl::_V1::detail::EmptyCommand, sycl::_V1::detail::KernelFusionCommand, sycl::_V1::detail::UpdateHostRequirementCommand, sycl::_V1::detail::ExecCGCommand, sycl::_V1::detail::MemCpyCommandHost, and sycl::_V1::detail::MemCpyCommand.
Referenced by emitInstrumentationDataProxy().
void sycl::_V1::detail::Command::emitInstrumentationDataProxy | ( | ) |
Proxy method which calls emitInstrumentationData.
Definition at line 515 of file commands.cpp.
References emitInstrumentationData().
Referenced by sycl::_V1::detail::AllocaCommand::AllocaCommand(), sycl::_V1::detail::AllocaCommandBase::AllocaCommandBase(), sycl::_V1::detail::AllocaSubBufCommand::AllocaSubBufCommand(), sycl::_V1::detail::EmptyCommand::EmptyCommand(), sycl::_V1::detail::ExecCGCommand::ExecCGCommand(), sycl::_V1::detail::KernelFusionCommand::KernelFusionCommand(), sycl::_V1::detail::MapMemObject::MapMemObject(), sycl::_V1::detail::MemCpyCommand::MemCpyCommand(), sycl::_V1::detail::MemCpyCommandHost::MemCpyCommandHost(), sycl::_V1::detail::ReleaseCommand::ReleaseCommand(), sycl::_V1::detail::UnMapMemObject::UnMapMemObject(), and sycl::_V1::detail::UpdateHostRequirementCommand::UpdateHostRequirementCommand().
|
virtual |
Checks if the command is enqueued, and calls enqueueImp.
EnqueueResult | is set to the specific status if enqueue failed. |
Blocking | if this argument is true, function will wait for the command to be unblocked before calling enqueueImp. |
ToCleanUp | container for commands that can be cleaned up. |
Definition at line 803 of file commands.cpp.
References emitEnqueuedEventSignal(), emitInstrumentation(), enqueueImp(), getBlockReason(), MEnqueueMtx, MEnqueueStatus, MEvent, MIsBlockable, MLeafCounter, MMarkedForCleanup, MShouldCompleteEventIfPossible, MSubmissionCodeLocation, supportsPostEnqueueCleanup(), sycl::_V1::detail::EnqueueResultT::SyclEnqueueBlocked, sycl::_V1::detail::EnqueueResultT::SyclEnqueueFailed, and sycl::_V1::detail::EnqueueResultT::SyclEnqueueSuccess.
Referenced by sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand().
|
protectedpure virtual |
Private interface. Derived classes should implement this method.
Referenced by enqueue().
const char * sycl::_V1::detail::Command::getBlockReason | ( | ) | const |
Definition at line 936 of file commands.cpp.
References HostAccessor, HostTask, and MBlockReason.
Referenced by enqueue().
|
inlineprotected |
Gets the command buffer (if any) associated with this command.
Definition at line 392 of file commands.hpp.
References MCommandBuffer.
|
inline |
Definition at line 171 of file commands.hpp.
References MEvent.
Referenced by sycl::_V1::detail::Scheduler::addCG(), sycl::_V1::detail::Scheduler::addCopyBack(), addDep(), sycl::_V1::detail::Scheduler::addHostAccessor(), sycl::_V1::detail::Scheduler::checkLeavesCompletion(), sycl::_V1::detail::Scheduler::GraphBuilder::cleanupCommand(), sycl::_V1::detail::Scheduler::GraphBuilder::connectDepEvent(), sycl::_V1::detail::Scheduler::GraphProcessor::handleBlockingCmd(), sycl::_V1::detail::Scheduler::NotifyHostTaskCompletion(), sycl::_V1::detail::Scheduler::GraphProcessor::waitForEvent(), and sycl::_V1::detail::Scheduler::waitForRecordToFinish().
std::vector< sycl::detail::pi::PiEvent > sycl::_V1::detail::Command::getPiEvents | ( | const std::vector< EventImplPtr > & | EventImpls | ) | const |
Collect PI events from EventImpls and filter out some of them in case of in order queue.
Definition at line 222 of file commands.cpp.
References getWorkerQueue(), and isHostTask().
Referenced by waitForEvents().
std::vector< sycl::detail::pi::PiEvent > sycl::_V1::detail::Command::getPiEventsBlocking | ( | const std::vector< EventImplPtr > & | EventImpls | ) | const |
Collect PI events from EventImpls and filter out some of them in case of in order queue.
Does blocking enqueue if event is expected to produce pi event but has empty native handle.
Definition at line 249 of file commands.cpp.
References sycl::_V1::detail::BLOCKING, sycl::_V1::detail::Scheduler::enqueueCommandForCG(), sycl::_V1::detail::Scheduler::getInstance(), getWorkerQueue(), isHostTask(), and producesPiEvent().
|
inline |
Definition at line 289 of file commands.hpp.
References MPreparedDepsEvents.
Referenced by sycl::_V1::detail::checkForCircularDependency(), sycl::_V1::detail::Scheduler::GraphBuilder::completeFusion(), and sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand().
|
inline |
Definition at line 285 of file commands.hpp.
References MPreparedHostDepsEvents.
Referenced by sycl::_V1::detail::checkForCircularDependency(), sycl::_V1::detail::Scheduler::GraphBuilder::completeFusion(), and sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand().
|
inline |
Definition at line 169 of file commands.hpp.
References MQueue.
Referenced by sycl::_V1::detail::Scheduler::addCopyBack(), sycl::_V1::detail::Scheduler::GraphBuilder::addCopyBack(), sycl::_V1::detail::Scheduler::GraphBuilder::addHostAccessor(), sycl::_V1::detail::Scheduler::GraphBuilder::findAllocaForReq(), and sycl::_V1::detail::insertMapUnmapForLinkedCmds().
|
inlinevirtual |
Reimplemented in sycl::_V1::detail::UpdateHostRequirementCommand, sycl::_V1::detail::MemCpyCommandHost, sycl::_V1::detail::MemCpyCommand, sycl::_V1::detail::UnMapMemObject, sycl::_V1::detail::MapMemObject, sycl::_V1::detail::AllocaCommandBase, and sycl::_V1::detail::EmptyCommand.
Definition at line 206 of file commands.hpp.
|
inline |
Definition at line 135 of file commands.hpp.
References MType.
Referenced by sycl::_V1::detail::Scheduler::checkLeavesCompletion(), sycl::_V1::detail::Scheduler::GraphBuilder::cleanupCommand(), sycl::_V1::detail::Scheduler::GraphBuilder::cleanupCommandsForRecord(), sycl::_V1::detail::Scheduler::GraphBuilder::completeFusion(), sycl::_V1::detail::ReleaseCommand::emitInstrumentationData(), sycl::_V1::detail::Scheduler::GraphBuilder::findAllocaForReq(), sycl::_V1::detail::isHostAccessorCmd(), and sycl::_V1::detail::isPartOfFusion().
|
virtual |
Get the context of the queue this command will be submitted to.
Could differ from the context of MQueue for memory copy commands.
Reimplemented in sycl::_V1::detail::MemCpyCommandHost, and sycl::_V1::detail::MemCpyCommand.
Definition at line 720 of file commands.cpp.
References MQueue.
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::connectDepEvent().
const QueueImplPtr & sycl::_V1::detail::Command::getWorkerQueue | ( | ) | const |
Get the queue this command will be submitted to.
Could differ from MQueue for memory copy commands.
Definition at line 724 of file commands.cpp.
References MWorkerQueue.
Referenced by getPiEvents(), getPiEventsBlocking(), sycl::_V1::detail::MemCpyCommand::getWorkerContext(), sycl::_V1::detail::MemCpyCommandHost::getWorkerContext(), processDepEvent(), and waitForEvents().
|
inline |
Definition at line 160 of file commands.hpp.
References isHostTask(), and MEvent.
Referenced by sycl::_V1::detail::Scheduler::GraphProcessor::handleBlockingCmd().
|
inline |
Definition at line 155 of file commands.hpp.
References MEnqueueStatus, MIsBlockable, and sycl::_V1::detail::EnqueueResultT::SyclEnqueueBlocked.
Referenced by sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand().
bool sycl::_V1::detail::Command::isFinished | ( | ) |
bool sycl::_V1::detail::Command::isHostTask | ( | ) | const |
Definition at line 286 of file commands.cpp.
References MType.
Referenced by getPiEvents(), getPiEventsBlocking(), and isBlocking().
|
inline |
Definition at line 149 of file commands.hpp.
References MEnqueueStatus, and sycl::_V1::detail::EnqueueResultT::SyclEnqueueSuccess.
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::cleanupCommand(), and sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand().
void sycl::_V1::detail::Command::makeTraceEventEpilog | ( | ) |
If prolog has been run, run epilog; this must be guarded by a check for xptiTraceEnabled().
Definition at line 672 of file commands.cpp.
References MCommandNodeType, MInstanceID, MStreamID, MTraceEvent, and MTraceEventPrologComplete.
Referenced by sycl::_V1::detail::EmptyCommand::emitInstrumentationData(), sycl::_V1::detail::ReleaseCommand::emitInstrumentationData(), sycl::_V1::detail::AllocaCommand::emitInstrumentationData(), sycl::_V1::detail::AllocaSubBufCommand::emitInstrumentationData(), sycl::_V1::detail::MapMemObject::emitInstrumentationData(), sycl::_V1::detail::UnMapMemObject::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommand::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommandHost::emitInstrumentationData(), and sycl::_V1::detail::UpdateHostRequirementCommand::emitInstrumentationData().
uint64_t sycl::_V1::detail::Command::makeTraceEventProlog | ( | void * | MAddress | ) |
Create a trace event of node_create type; this must be guarded by a check for xptiTraceEnabled().
Post Condition: MTraceEvent will be set to the event created.
MAddress | The address to use to create the payload. |
Definition at line 640 of file commands.cpp.
References MAddress, MAddressString, MCommandName, MCommandNodeType, MFirstInstance, MInstanceID, MStreamID, MTraceEvent, MTraceEventPrologComplete, and MType.
Referenced by sycl::_V1::detail::EmptyCommand::emitInstrumentationData(), sycl::_V1::detail::ReleaseCommand::emitInstrumentationData(), sycl::_V1::detail::AllocaCommandBase::emitInstrumentationData(), sycl::_V1::detail::MapMemObject::emitInstrumentationData(), sycl::_V1::detail::UnMapMemObject::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommand::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommandHost::emitInstrumentationData(), and sycl::_V1::detail::UpdateHostRequirementCommand::emitInstrumentationData().
|
pure virtual |
Implemented in sycl::_V1::detail::KernelFusionCommand, sycl::_V1::detail::UpdateHostRequirementCommand, sycl::_V1::detail::ExecCGCommand, sycl::_V1::detail::MemCpyCommandHost, sycl::_V1::detail::MemCpyCommand, sycl::_V1::detail::UnMapMemObject, sycl::_V1::detail::MapMemObject, sycl::_V1::detail::AllocaSubBufCommand, sycl::_V1::detail::AllocaCommand, sycl::_V1::detail::ReleaseCommand, and sycl::_V1::detail::EmptyCommand.
Referenced by sycl::_V1::detail::printDotRecursive().
|
protected |
Perform glueing of events from different contexts.
DepEvent | event this commands should depend on |
Dep | optional DepDesc to perform connection of events properly |
ToCleanUp | container for commands that can be cleaned up. |
Glueing (i.e. connecting) will be performed if and only if DepEvent is not from host context and its context doesn't match to context of this command. Context of this command is fetched via getWorkerContext().
Optionality of Dep is set by Dep.MDepCommand not equal to nullptr.
Definition at line 685 of file commands.cpp.
References sycl::_V1::detail::Scheduler::GraphBuilder::connectDepEvent(), sycl::_V1::detail::Scheduler::getInstance(), getWorkerQueue(), sycl::_V1::detail::Scheduler::MGraphBuilder, MPreparedDepsEvents, and MPreparedHostDepsEvents.
Referenced by addDep().
|
virtual |
Returns true iff the command produces a PI event on non-host devices.
Reimplemented in sycl::_V1::detail::KernelFusionCommand, sycl::_V1::detail::ExecCGCommand, sycl::_V1::detail::MemCpyCommand, sycl::_V1::detail::UnMapMemObject, sycl::_V1::detail::AllocaCommandBase, sycl::_V1::detail::ReleaseCommand, and sycl::_V1::detail::EmptyCommand.
Definition at line 729 of file commands.cpp.
Referenced by getPiEventsBlocking().
|
virtual |
Returns true iff this command is ready to be submitted for cleanup.
Reimplemented in sycl::_V1::detail::ExecCGCommand, sycl::_V1::detail::AllocaCommandBase, and sycl::_V1::detail::ReleaseCommand.
Definition at line 733 of file commands.cpp.
References MEnqueueStatus, MLeafCounter, and sycl::_V1::detail::EnqueueResultT::SyclEnqueueSuccess.
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::decrementLeafCountersForRecord(), and sycl::_V1::detail::ExecCGCommand::readyForCleanup().
void sycl::_V1::detail::Command::resolveReleaseDependencies | ( | std::set< Command * > & | list | ) |
Looks at all the dependencies for the release command and enables instrumentation to report these dependencies as edges.
Definition at line 894 of file commands.cpp.
References MAddress, MStreamID, MTraceEvent, and MType.
Referenced by sycl::_V1::detail::Scheduler::waitForRecordToFinish().
|
virtual |
Returns true iff this command can be freed by post enqueue cleanup.
Reimplemented in sycl::_V1::detail::ExecCGCommand, sycl::_V1::detail::AllocaCommandBase, and sycl::_V1::detail::ReleaseCommand.
Definition at line 731 of file commands.cpp.
Referenced by enqueue(), and sycl::_V1::detail::ExecCGCommand::supportsPostEnqueueCleanup().
|
protected |
Definition at line 433 of file commands.cpp.
References sycl::_V1::detail::flushCrossQueueDeps(), ur_event_handle_t_::get(), getPiEvents(), getWorkerQueue(), MEvent, piEnqueueEventsWait(), and piEventsWait().
|
protected |
Definition at line 428 of file commands.cpp.
References MPreparedHostDepsEvents.
|
friend |
Definition at line 282 of file commands.hpp.
void* sycl::_V1::detail::Command::MAddress = nullptr |
Reserved for storing the object address such as SPIR-V or memory object address.
Definition at line 347 of file commands.hpp.
Referenced by emitEdgeEventForCommandDependence(), emitEdgeEventForEventDependence(), sycl::_V1::detail::EmptyCommand::emitInstrumentationData(), sycl::_V1::detail::ReleaseCommand::emitInstrumentationData(), sycl::_V1::detail::AllocaCommandBase::emitInstrumentationData(), sycl::_V1::detail::MapMemObject::emitInstrumentationData(), sycl::_V1::detail::UnMapMemObject::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommand::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommandHost::emitInstrumentationData(), sycl::_V1::detail::ExecCGCommand::emitInstrumentationData(), sycl::_V1::detail::UpdateHostRequirementCommand::emitInstrumentationData(), makeTraceEventProlog(), and resolveReleaseDependencies().
std::string sycl::_V1::detail::Command::MAddressString |
Buffer to build the address string.
Definition at line 349 of file commands.hpp.
Referenced by makeTraceEventProlog().
std::vector<EventImplPtr> sycl::_V1::detail::Command::MBlockedUsers |
Contains list of commands that depends on the host command explicitly (by depends_on).
Not involved in the cleanup process since it is one-way link and does not hold resources. Using EventImplPtr since enqueueUnblockedCommands and event.wait may intersect with command enqueue.
Definition at line 387 of file commands.hpp.
Referenced by addBlockedUserUnique(), and sycl::_V1::detail::Scheduler::NotifyHostTaskCompletion().
std::mutex sycl::_V1::detail::Command::MBlockedUsersMutex |
Definition at line 388 of file commands.hpp.
Referenced by sycl::_V1::detail::Scheduler::GraphProcessor::handleBlockingCmd(), and sycl::_V1::detail::Scheduler::NotifyHostTaskCompletion().
BlockReason sycl::_V1::detail::Command::MBlockReason |
Definition at line 329 of file commands.hpp.
Referenced by getBlockReason(), and sycl::_V1::detail::isHostAccessorCmd().
|
protected |
CommandBuffer which will be used to submit to instead of the queue, if set.
Definition at line 398 of file commands.hpp.
Referenced by getCommandBuffer(), and sycl::_V1::detail::ExecCGCommand::producesPiEvent().
std::string sycl::_V1::detail::Command::MCommandName |
Buffer to build the command end-user understandable name.
Definition at line 353 of file commands.hpp.
Referenced by sycl::_V1::detail::KernelFusionCommand::emitInstrumentationData(), and makeTraceEventProlog().
std::string sycl::_V1::detail::Command::MCommandNodeType |
Buffer to build the command node type.
Definition at line 351 of file commands.hpp.
Referenced by sycl::_V1::detail::KernelFusionCommand::emitInstrumentationData(), makeTraceEventEpilog(), and makeTraceEventProlog().
std::vector<DepDesc> sycl::_V1::detail::Command::MDeps |
Contains list of dependencies(edges)
Definition at line 309 of file commands.hpp.
Referenced by addDep(), sycl::_V1::detail::checkForCircularDependency(), sycl::_V1::detail::Scheduler::GraphBuilder::cleanupCommand(), sycl::_V1::detail::Scheduler::GraphBuilder::cleanupCommandsForRecord(), clearAllDependencies(), sycl::_V1::detail::Scheduler::enqueueCommandForCG(), sycl::_V1::detail::Scheduler::GraphBuilder::findDepForRecord(), sycl::_V1::detail::Scheduler::NotifyHostTaskCompletion(), sycl::_V1::detail::EmptyCommand::printDot(), sycl::_V1::detail::ReleaseCommand::printDot(), sycl::_V1::detail::AllocaCommand::printDot(), sycl::_V1::detail::AllocaSubBufCommand::printDot(), sycl::_V1::detail::MapMemObject::printDot(), sycl::_V1::detail::UnMapMemObject::printDot(), sycl::_V1::detail::MemCpyCommand::printDot(), sycl::_V1::detail::MemCpyCommandHost::printDot(), sycl::_V1::detail::ExecCGCommand::printDot(), sycl::_V1::detail::UpdateHostRequirementCommand::printDot(), and sycl::_V1::detail::KernelFusionCommand::printDot().
|
protected |
Mutex used to protect enqueueing from race conditions.
Definition at line 280 of file commands.hpp.
Referenced by enqueue().
std::atomic<EnqueueResultT::ResultT> sycl::_V1::detail::Command::MEnqueueStatus |
Describes the status of the command.
Definition at line 332 of file commands.hpp.
Referenced by Command(), enqueue(), isEnqueueBlocked(), isSuccessfullyEnqueued(), readyForCleanup(), and sycl::_V1::detail::Scheduler::releaseHostAccessor().
|
protected |
Definition at line 246 of file commands.hpp.
Referenced by Command(), enqueue(), sycl::_V1::detail::ExecCGCommand::ExecCGCommand(), getEvent(), isBlocking(), sycl::_V1::detail::MemCpyCommand::MemCpyCommand(), sycl::_V1::detail::MemCpyCommandHost::MemCpyCommandHost(), sycl::_V1::detail::UnMapMemObject::producesPiEvent(), sycl::_V1::detail::MemCpyCommand::producesPiEvent(), sycl::_V1::detail::ExecCGCommand::readyForCleanup(), waitForEvents(), and ~Command().
bool sycl::_V1::detail::Command::MFirstInstance = false |
Flag to indicate if this is the first time we are seeing this payload.
Definition at line 357 of file commands.hpp.
Referenced by sycl::_V1::detail::EmptyCommand::emitInstrumentationData(), sycl::_V1::detail::ReleaseCommand::emitInstrumentationData(), sycl::_V1::detail::AllocaCommandBase::emitInstrumentationData(), sycl::_V1::detail::AllocaCommand::emitInstrumentationData(), sycl::_V1::detail::AllocaSubBufCommand::emitInstrumentationData(), sycl::_V1::detail::MapMemObject::emitInstrumentationData(), sycl::_V1::detail::UnMapMemObject::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommand::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommandHost::emitInstrumentationData(), sycl::_V1::detail::UpdateHostRequirementCommand::emitInstrumentationData(), sycl::_V1::detail::KernelFusionCommand::emitInstrumentationData(), and makeTraceEventProlog().
uint64_t sycl::_V1::detail::Command::MInstanceID = 0 |
Instance ID tracked for the command.
Definition at line 359 of file commands.hpp.
Referenced by emitEnqueuedEventSignal(), emitInstrumentation(), sycl::_V1::detail::ExecCGCommand::emitInstrumentationData(), sycl::_V1::detail::KernelFusionCommand::emitInstrumentationData(), makeTraceEventEpilog(), and makeTraceEventProlog().
bool sycl::_V1::detail::Command::MIsBlockable = false |
Indicates whether the command can be blocked from enqueueing.
Definition at line 313 of file commands.hpp.
Referenced by enqueue(), and isEnqueueBlocked().
unsigned sycl::_V1::detail::Command::MLeafCounter = 0 |
Counts the number of memory objects this command is a leaf for.
Definition at line 315 of file commands.hpp.
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::addNodeToLeaves(), sycl::_V1::detail::Scheduler::GraphBuilder::cleanupCommand(), sycl::_V1::detail::Scheduler::GraphBuilder::decrementLeafCountersForRecord(), enqueue(), sycl::_V1::detail::Scheduler::NotifyHostTaskCompletion(), readyForCleanup(), and sycl::_V1::detail::ExecCGCommand::readyForCleanup().
bool sycl::_V1::detail::Command::MMarkedForCleanup = false |
Indicates that the node will be freed by graph cleanup.
Such nodes should be ignored by other cleanup mechanisms (e.g. during memory object removal).
Definition at line 380 of file commands.hpp.
Referenced by enqueue(), and sycl::_V1::detail::Scheduler::NotifyHostTaskCompletion().
Marks sycl::_V1::detail::Command::MMarks |
Used for marking the node during graph traversal.
Definition at line 324 of file commands.hpp.
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::cleanupCommandsForRecord(), and sycl::_V1::detail::markNodeAsVisited().
|
protected |
Dependency events prepared for waiting by backend.
See processDepEvent for details.
Definition at line 251 of file commands.hpp.
Referenced by clearAllDependencies(), getPreparedDepsEvents(), and processDepEvent().
|
protected |
Definition at line 252 of file commands.hpp.
Referenced by clearAllDependencies(), getPreparedHostDepsEvents(), processDepEvent(), and waitForPreparedHostEvents().
|
protected |
Definition at line 245 of file commands.hpp.
Referenced by Command(), sycl::_V1::detail::EmptyCommand::emitInstrumentationData(), sycl::_V1::detail::ReleaseCommand::emitInstrumentationData(), sycl::_V1::detail::AllocaCommandBase::emitInstrumentationData(), sycl::_V1::detail::MapMemObject::emitInstrumentationData(), sycl::_V1::detail::UnMapMemObject::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommand::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommandHost::emitInstrumentationData(), sycl::_V1::detail::ExecCGCommand::emitInstrumentationData(), sycl::_V1::detail::UpdateHostRequirementCommand::emitInstrumentationData(), sycl::_V1::detail::KernelFusionCommand::emitInstrumentationData(), sycl::_V1::detail::AllocaSubBufCommand::getMemAllocation(), getQueue(), getWorkerContext(), sycl::_V1::detail::MemCpyCommand::MemCpyCommand(), sycl::_V1::detail::MemCpyCommandHost::MemCpyCommandHost(), sycl::_V1::detail::ReleaseCommand::printDot(), sycl::_V1::detail::AllocaCommand::printDot(), sycl::_V1::detail::AllocaSubBufCommand::printDot(), sycl::_V1::detail::MapMemObject::printDot(), sycl::_V1::detail::UnMapMemObject::printDot(), sycl::_V1::detail::MemCpyCommand::printDot(), sycl::_V1::detail::MemCpyCommandHost::printDot(), sycl::_V1::detail::ExecCGCommand::printDot(), sycl::_V1::detail::UpdateHostRequirementCommand::printDot(), sycl::_V1::detail::KernelFusionCommand::printDot(), sycl::_V1::detail::UnMapMemObject::producesPiEvent(), sycl::_V1::detail::MemCpyCommand::producesPiEvent(), and sycl::_V1::detail::KernelFusionCommand::resetQueue().
bool sycl::_V1::detail::Command::MShouldCompleteEventIfPossible = true |
Definition at line 375 of file commands.hpp.
Referenced by enqueue().
int32_t sycl::_V1::detail::Command::MStreamID = -1 |
The stream under which the traces are emitted.
Stream ids are positive integers and we set it to an invalid value.
Definition at line 344 of file commands.hpp.
Referenced by Command(), emitEdgeEventForCommandDependence(), emitEdgeEventForEventDependence(), emitEnqueuedEventSignal(), emitInstrumentation(), sycl::_V1::detail::EmptyCommand::emitInstrumentationData(), sycl::_V1::detail::ReleaseCommand::emitInstrumentationData(), sycl::_V1::detail::AllocaCommandBase::emitInstrumentationData(), sycl::_V1::detail::AllocaCommand::emitInstrumentationData(), sycl::_V1::detail::AllocaSubBufCommand::emitInstrumentationData(), sycl::_V1::detail::MapMemObject::emitInstrumentationData(), sycl::_V1::detail::UnMapMemObject::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommand::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommandHost::emitInstrumentationData(), sycl::_V1::detail::ExecCGCommand::emitInstrumentationData(), sycl::_V1::detail::UpdateHostRequirementCommand::emitInstrumentationData(), sycl::_V1::detail::KernelFusionCommand::emitInstrumentationData(), makeTraceEventEpilog(), makeTraceEventProlog(), and resolveReleaseDependencies().
code_location sycl::_V1::detail::Command::MSubmissionCodeLocation |
Represents code location of command submission to SYCL API, assigned with the valid value only if command execution is async (host task) or delayed (blocked by host task).
Definition at line 363 of file commands.hpp.
Referenced by copySubmissionCodeLocation(), enqueue(), and sycl::_V1::detail::DispatchHostTask::operator()().
std::string sycl::_V1::detail::Command::MSubmissionFileName |
Introduces string to handle memory management since code_location struct works with raw char arrays.
Definition at line 366 of file commands.hpp.
Referenced by copySubmissionCodeLocation().
std::string sycl::_V1::detail::Command::MSubmissionFunctionName |
Definition at line 367 of file commands.hpp.
Referenced by copySubmissionCodeLocation().
|
protected |
List of sync points for submissions to a command buffer.
Definition at line 400 of file commands.hpp.
void* sycl::_V1::detail::Command::MTraceEvent = nullptr |
The event for node_create and task_begin.
Definition at line 340 of file commands.hpp.
Referenced by emitEdgeEventForCommandDependence(), emitEdgeEventForEventDependence(), emitEnqueuedEventSignal(), emitInstrumentation(), sycl::_V1::detail::EmptyCommand::emitInstrumentationData(), sycl::_V1::detail::ReleaseCommand::emitInstrumentationData(), sycl::_V1::detail::AllocaCommandBase::emitInstrumentationData(), sycl::_V1::detail::AllocaSubBufCommand::emitInstrumentationData(), sycl::_V1::detail::MapMemObject::emitInstrumentationData(), sycl::_V1::detail::UnMapMemObject::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommand::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommandHost::emitInstrumentationData(), sycl::_V1::detail::ExecCGCommand::emitInstrumentationData(), sycl::_V1::detail::UpdateHostRequirementCommand::emitInstrumentationData(), sycl::_V1::detail::KernelFusionCommand::emitInstrumentationData(), sycl::_V1::detail::event_impl::instrumentationProlog(), makeTraceEventEpilog(), makeTraceEventProlog(), and resolveReleaseDependencies().
bool sycl::_V1::detail::Command::MTraceEventPrologComplete = false |
Flag to indicate if makeTraceEventProlog() has been run.
Definition at line 355 of file commands.hpp.
Referenced by makeTraceEventEpilog(), and makeTraceEventProlog().
|
protected |
The type of the command.
Definition at line 278 of file commands.hpp.
Referenced by sycl::_V1::detail::ExecCGCommand::emitInstrumentationData(), sycl::_V1::detail::KernelFusionCommand::emitInstrumentationData(), getType(), isHostTask(), makeTraceEventProlog(), and resolveReleaseDependencies().
std::unordered_set<Command *> sycl::_V1::detail::Command::MUsers |
Contains list of commands that depend on the command.
Definition at line 311 of file commands.hpp.
Referenced by addUser(), sycl::_V1::detail::Scheduler::GraphBuilder::cleanupCommand(), sycl::_V1::detail::Scheduler::GraphBuilder::cleanupCommandsForRecord(), sycl::_V1::detail::Scheduler::enqueueCommandForCG(), and sycl::_V1::detail::printDotRecursive().
|
protected |
Definition at line 247 of file commands.hpp.
Referenced by Command(), getWorkerQueue(), sycl::_V1::detail::MemCpyCommand::MemCpyCommand(), sycl::_V1::detail::MemCpyCommandHost::MemCpyCommandHost(), and sycl::_V1::detail::KernelFusionCommand::resetQueue().