DPC++ Runtime
Runtime libraries for oneAPI DPC++
cl::sycl::detail::AllocaCommandBase Class Referenceabstract

Base class for memory allocation commands. More...

#include <detail/scheduler/commands.hpp>

Inheritance diagram for cl::sycl::detail::AllocaCommandBase:
Collaboration diagram for cl::sycl::detail::AllocaCommandBase:

Public Member Functions

 AllocaCommandBase (CommandType Type, QueueImplPtr Queue, Requirement Req, AllocaCommandBase *LinkedAllocaCmd)
 
ReleaseCommandgetReleaseCmd ()
 
SYCLMemObjIgetSYCLMemObj () const
 
virtual void * getMemAllocation () const =0
 
const RequirementgetRequirement () const final
 
void emitInstrumentationData () override
 Instrumentation method which emits telemetry data. More...
 
bool producesPiEvent () const final
 Returns true iff the command produces a PI event on non-host devices. More...
 
bool supportsPostEnqueueCleanup () const final
 Returns true iff this command can be freed by post enqueue cleanup. More...
 
- Public Member Functions inherited from cl::sycl::detail::Command
 Command (CommandType Type, QueueImplPtr Queue)
 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...
 
CommandaddDep (DepDesc NewDep, std::vector< Command * > &ToCleanUp)
 
CommandaddDep (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
 
const QueueImplPtrgetQueue () const
 
const QueueImplPtrgetSubmittedQueue () const
 
const EventImplPtrgetEvent () 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, RT::PiEvent &EventAddr)
 Creates an edge event when the dependency is an event. More...
 
void emitEnqueuedEventSignal (RT::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 ~Command ()
 
const chargetBlockReason () const
 
virtual const ContextImplPtrgetWorkerContext () const
 Get the context of the queue this command will be submitted to. More...
 
virtual const QueueImplPtrgetWorkerQueue () const
 Get the queue this command will be submitted to. More...
 
const std::vector< EventImplPtr > & getPreparedHostDepsEvents () const
 

Public Attributes

void * MMemAllocation = nullptr
 
AllocaCommandBaseMLinkedAllocaCmd = 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...
 
- Public Attributes inherited from cl::sycl::detail::Command
std::vector< DepDescMDeps
 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::ResultTMEnqueueStatus
 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...
 
bool MShouldCompleteEventIfPossible = true
 
bool MPostEnqueueCleanup = false
 Indicates that the node will be freed by cleanup after enqueue. More...
 

Protected Attributes

Requirement MRequirement
 
ReleaseCommand MReleaseCmd
 
- Protected Attributes inherited from cl::sycl::detail::Command
QueueImplPtr MQueue
 
QueueImplPtr MSubmittedQueue
 
EventImplPtr MEvent
 
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...
 

Additional Inherited Members

- Public Types inherited from cl::sycl::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
}
 
enum  BlockReason : int { BlockReason::HostAccessor = 0, BlockReason::HostTask }
 
- Protected Member Functions inherited from cl::sycl::detail::Command
void waitForEvents (QueueImplPtr Queue, std::vector< EventImplPtr > &RawEvents, RT::PiEvent &Event)
 
void waitForPreparedHostEvents () const
 
CommandprocessDepEvent (EventImplPtr DepEvent, const DepDesc &Dep, std::vector< Command * > &ToCleanUp)
 Perform glueing of events from different contexts. More...
 
virtual cl_int enqueueImp ()=0
 Private interface. Derived classes should implement this method. More...
 

Detailed Description

Base class for memory allocation commands.

Definition at line 364 of file commands.hpp.

Constructor & Destructor Documentation

◆ AllocaCommandBase()

cl::sycl::detail::AllocaCommandBase::AllocaCommandBase ( CommandType  Type,
QueueImplPtr  Queue,
Requirement  Req,
AllocaCommandBase LinkedAllocaCmd 
)

Member Function Documentation

◆ emitInstrumentationData()

◆ getMemAllocation()

virtual void* cl::sycl::detail::AllocaCommandBase::getMemAllocation ( ) const
pure virtual

◆ getReleaseCmd()

ReleaseCommand* cl::sycl::detail::AllocaCommandBase::getReleaseCmd ( )
inline

Definition at line 369 of file commands.hpp.

Referenced by cl::sycl::detail::Scheduler::waitForRecordToFinish().

◆ getRequirement()

◆ getSYCLMemObj()

◆ producesPiEvent()

bool cl::sycl::detail::AllocaCommandBase::producesPiEvent ( ) const
finalvirtual

Returns true iff the command produces a PI event on non-host devices.

Reimplemented from cl::sycl::detail::Command.

Definition at line 865 of file commands.cpp.

◆ supportsPostEnqueueCleanup()

bool cl::sycl::detail::AllocaCommandBase::supportsPostEnqueueCleanup ( ) const
finalvirtual

Returns true iff this command can be freed by post enqueue cleanup.

Reimplemented from cl::sycl::detail::Command.

Definition at line 867 of file commands.cpp.

Member Data Documentation

◆ MIsActive

bool cl::sycl::detail::AllocaCommandBase::MIsActive = true

Indicates that current alloca is active one.

Definition at line 392 of file commands.hpp.

Referenced by cl::sycl::detail::insertMapUnmapForLinkedCmds().

◆ MIsLeaderAlloca

bool cl::sycl::detail::AllocaCommandBase::MIsLeaderAlloca = true

Indicates that the command owns memory allocation in case of connected alloca command.

Definition at line 396 of file commands.hpp.

◆ MLinkedAllocaCmd

AllocaCommandBase* cl::sycl::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 390 of file commands.hpp.

Referenced by cl::sycl::detail::Scheduler::GraphBuilder::cleanupCommandsForRecord(), cl::sycl::detail::insertMapUnmapForLinkedCmds(), and cl::sycl::detail::AllocaCommand::printDot().

◆ MMemAllocation

void* cl::sycl::detail::AllocaCommandBase::MMemAllocation = nullptr

◆ MReleaseCmd

ReleaseCommand cl::sycl::detail::AllocaCommandBase::MReleaseCmd
protected

Definition at line 400 of file commands.hpp.

◆ MRequirement


The documentation for this class was generated from the following files: