Base class for memory allocation commands. More...
#include <detail/scheduler/commands.hpp>
Public Member Functions | |
AllocaCommandBase (CommandType Type, QueueImplPtr Queue, Requirement Req, AllocaCommandBase *LinkedAllocaCmd, bool IsConst) | |
ReleaseCommand * | getReleaseCmd () |
SYCLMemObjI * | getSYCLMemObj () const |
virtual void * | getMemAllocation () const =0 |
const Requirement * | getRequirement () const final |
void | emitInstrumentationData () override |
Instrumentation method which emits telemetry data. More... | |
bool | producesPiEvent () const final |
Returns true iff the command produces a UR event on non-host devices. More... | |
bool | supportsPostEnqueueCleanup () const final |
Returns true iff this command can be freed by post enqueue cleanup. More... | |
bool | readyForCleanup () const final |
Returns true iff this command is ready to be submitted for cleanup. More... | |
Public Member Functions inherited from sycl::_V1::detail::Command | |
Command (CommandType Type, QueueImplPtr Queue, ur_exp_command_buffer_handle_t CommandBuffer=nullptr, const std::vector< ur_exp_command_buffer_sync_point_t > &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... | |
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, ur_event_handle_t &EventAddr) |
Creates an edge event when the dependency is an event. More... | |
void | emitEnqueuedEventSignal (const ur_event_handle_t UrEventAddr) |
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 | ~Command () |
const char * | getBlockReason () const |
virtual ContextImplPtr | getWorkerContext () const |
Get the context of the queue this command will be submitted to. More... | |
std::vector< ur_event_handle_t > | getUrEvents (const std::vector< EventImplPtr > &EventImpls) const |
Collect UR events from EventImpls and filter out some of them in case of in order queue. More... | |
std::vector< ur_event_handle_t > | getUrEventsBlocking (const std::vector< EventImplPtr > &EventImpls) const |
Collect UR events from EventImpls and filter out some of them in case of in order queue. More... | |
bool | isHostTask () const |
bool | isFusable () const |
const std::vector< EventImplPtr > & | getPreparedHostDepsEvents () const |
const std::vector< EventImplPtr > & | getPreparedDepsEvents () const |
void | copySubmissionCodeLocation () |
Public Attributes | |
void * | MMemAllocation = nullptr |
AllocaCommandBase * | MLinkedAllocaCmd = nullptr |
Alloca command linked with current command. More... | |
bool | MIsActive = true |
Indicates that current alloca is active one. More... | |
bool | MIsLeaderAlloca = true |
Indicates that the command owns memory allocation in case of connected alloca command. More... | |
bool | MIsConst = false |
Public Attributes inherited from sycl::_V1::detail::Command | |
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 = BlockReason::Unset |
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... | |
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 Attributes | |
Requirement | MRequirement |
ReleaseCommand | MReleaseCmd |
Protected Attributes inherited from sycl::_V1::detail::Command | |
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... | |
ur_exp_command_buffer_handle_t | MCommandBuffer |
CommandBuffer which will be used to submit to instead of the queue, if set. More... | |
std::vector< ur_exp_command_buffer_sync_point_t > | MSyncPointDeps |
List of sync points for submissions to a command buffer. More... | |
Additional Inherited Members | |
Public Types inherited from sycl::_V1::detail::Command | |
enum | CommandType { RUN_CG , COPY_MEMORY , ALLOCA , ALLOCA_SUB_BUF , RELEASE , MAP_MEM_OBJ , UNMAP_MEM_OBJ , UPDATE_REQUIREMENT , EMPTY_TASK , HOST_TASK , EXEC_CMD_BUFFER , UPDATE_CMD_BUFFER } |
enum class | BlockReason : int { Unset = -1 , HostAccessor = 0 , HostTask } |
Protected Member Functions inherited from sycl::_V1::detail::Command | |
void | waitForEvents (QueueImplPtr Queue, std::vector< EventImplPtr > &RawEvents, ur_event_handle_t &Event) |
void | waitForPreparedHostEvents () const |
Command * | processDepEvent (EventImplPtr DepEvent, const DepDesc &Dep, std::vector< Command * > &ToCleanUp) |
Perform glueing of events from different contexts. More... | |
virtual ur_result_t | enqueueImp ()=0 |
Private interface. Derived classes should implement this method. More... | |
ur_exp_command_buffer_handle_t | getCommandBuffer () const |
Gets the command buffer (if any) associated with this command. More... | |
Base class for memory allocation commands.
Definition at line 443 of file commands.hpp.
sycl::_V1::detail::AllocaCommandBase::AllocaCommandBase | ( | CommandType | Type, |
QueueImplPtr | Queue, | ||
Requirement | Req, | ||
AllocaCommandBase * | LinkedAllocaCmd, | ||
bool | IsConst | ||
) |
Definition at line 1023 of file commands.cpp.
References sycl::_V1::detail::Command::emitInstrumentationDataProxy(), sycl::_V1::detail::AccessorImplHost::MAccessMode, MRequirement, and sycl::_V1::access::read_write.
|
overridevirtual |
Instrumentation method which emits telemetry data.
Implements sycl::_V1::detail::Command.
Reimplemented in sycl::_V1::detail::AllocaSubBufCommand, and sycl::_V1::detail::AllocaCommand.
Definition at line 1034 of file commands.cpp.
References sycl::_V1::detail::Command::MAddress, sycl::_V1::detail::Command::makeTraceEventProlog(), sycl::_V1::detail::Command::MQueue, MRequirement, sycl::_V1::detail::Command::MStreamID, sycl::_V1::detail::AccessorImplHost::MSYCLMemObj, and sycl::_V1::detail::Command::MTraceEvent.
|
pure virtual |
Implemented in sycl::_V1::detail::AllocaSubBufCommand, and sycl::_V1::detail::AllocaCommand.
Referenced by sycl::_V1::detail::AllocaSubBufCommand::getMemAllocation().
|
inline |
Definition at line 448 of file commands.hpp.
Referenced by sycl::_V1::detail::Scheduler::waitForRecordToFinish().
|
inlinefinalvirtual |
Reimplemented from sycl::_V1::detail::Command.
Definition at line 454 of file commands.hpp.
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::addCopyBack(), sycl::_V1::detail::AllocaCommand::AllocaCommand(), sycl::_V1::detail::AllocaSubBufCommand::AllocaSubBufCommand(), sycl::_V1::detail::Scheduler::GraphBuilder::findAllocaForReq(), and sycl::_V1::detail::insertMapUnmapForLinkedCmds().
|
inline |
Definition at line 450 of file commands.hpp.
Referenced by sycl::_V1::detail::MemCpyCommand::emitInstrumentationData(), sycl::_V1::detail::MemCpyCommandHost::emitInstrumentationData(), sycl::_V1::detail::UpdateHostRequirementCommand::emitInstrumentationData(), sycl::_V1::detail::ReleaseCommand::emitInstrumentationData(), sycl::_V1::detail::MapMemObject::emitInstrumentationData(), sycl::_V1::detail::UnMapMemObject::emitInstrumentationData(), and sycl::_V1::detail::ReleaseCommand::printDot().
|
finalvirtual |
Returns true iff the command produces a UR event on non-host devices.
Reimplemented from sycl::_V1::detail::Command.
Definition at line 1060 of file commands.cpp.
|
finalvirtual |
Returns true iff this command is ready to be submitted for cleanup.
Reimplemented from sycl::_V1::detail::Command.
Definition at line 1064 of file commands.cpp.
|
finalvirtual |
Returns true iff this command can be freed by post enqueue cleanup.
Reimplemented from sycl::_V1::detail::Command.
Definition at line 1062 of file commands.cpp.
bool sycl::_V1::detail::AllocaCommandBase::MIsActive = true |
Indicates that current alloca is active one.
Definition at line 473 of file commands.hpp.
Referenced by sycl::_V1::detail::insertMapUnmapForLinkedCmds().
bool sycl::_V1::detail::AllocaCommandBase::MIsConst = false |
Definition at line 479 of file commands.hpp.
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::findAllocaForReq().
bool sycl::_V1::detail::AllocaCommandBase::MIsLeaderAlloca = true |
Indicates that the command owns memory allocation in case of connected alloca command.
Definition at line 477 of file commands.hpp.
AllocaCommandBase* sycl::_V1::detail::AllocaCommandBase::MLinkedAllocaCmd = nullptr |
Alloca command linked with current command.
Device and host alloca commands can be linked, so they may share the same memory. Only one allocation from a pair can be accessed at a time. Alloca commands associated with such allocation is "active". In order to switch "active" status between alloca commands map/unmap operations are used.
Definition at line 471 of file commands.hpp.
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::cleanupCommandsForRecord(), sycl::_V1::detail::insertMapUnmapForLinkedCmds(), and sycl::_V1::detail::AllocaCommand::printDot().
void* sycl::_V1::detail::AllocaCommandBase::MMemAllocation = nullptr |
Definition at line 464 of file commands.hpp.
Referenced by sycl::_V1::detail::AllocaSubBufCommand::getMemAllocation(), and sycl::_V1::detail::insertMapUnmapForLinkedCmds().
|
protected |
Definition at line 483 of file commands.hpp.
|
protected |
Definition at line 482 of file commands.hpp.
Referenced by AllocaCommandBase(), emitInstrumentationData(), sycl::_V1::detail::AllocaSubBufCommand::emitInstrumentationData(), sycl::_V1::detail::AllocaSubBufCommand::getMemAllocation(), sycl::_V1::detail::AllocaCommand::printDot(), and sycl::_V1::detail::AllocaSubBufCommand::printDot().