DPC++ Runtime
Runtime libraries for oneAPI DPC++
sycl::_V1::detail::KernelFusionCommand Class Reference

The KernelFusionCommand is placed in the execution graph together with the individual kernels of the fusion list to control kernel fusion. More...

#include <detail/scheduler/commands.hpp>

Inheritance diagram for sycl::_V1::detail::KernelFusionCommand:
Collaboration diagram for sycl::_V1::detail::KernelFusionCommand:

Public Types

enum class  FusionStatus { ACTIVE , CANCELLED , COMPLETE , DELETED }
 
- 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 , FUSION , EXEC_CMD_BUFFER ,
  UPDATE_CMD_BUFFER
}
 
enum class  BlockReason : int { HostAccessor = 0 , HostTask }
 

Public Member Functions

 KernelFusionCommand (QueueImplPtr Queue)
 
void printDot (std::ostream &Stream) const final
 
void emitInstrumentationData () final
 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...
 
std::vector< Command * > & auxiliaryCommands ()
 
void addToFusionList (ExecCGCommand *Kernel)
 
std::vector< ExecCGCommand * > & getFusionList ()
 
void setFusionStatus (FusionStatus Status)
 Set the status of this fusion command to Status. More...
 
void resetQueue ()
 Reset the queue. More...
 
bool isActive () const
 
bool readyForDeletion () const
 
- Public Member Functions inherited from 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. 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
 
bool isBlocking () const
 
void addBlockedUserUnique (const EventImplPtr &NewUser)
 
const QueueImplPtrgetQueue () 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, 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 const RequirementgetRequirement () const
 
virtual ~Command ()
 
const char * getBlockReason () const
 
virtual const ContextImplPtrgetWorkerContext () const
 Get the context of the queue this command will be submitted to. More...
 
const QueueImplPtrgetWorkerQueue () const
 Get the queue this command will be submitted to. 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::PiEventgetPiEvents (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::PiEventgetPiEventsBlocking (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
 
bool isFusable () 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...
 

Additional Inherited Members

- Public Attributes inherited from sycl::_V1::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...
 
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< EventImplPtrMBlockedUsers
 Contains list of commands that depends on the host command explicitly (by depends_on). More...
 
std::mutex MBlockedUsersMutex
 
- Protected Member Functions inherited from sycl::_V1::detail::Command
void waitForEvents (QueueImplPtr Queue, std::vector< EventImplPtr > &RawEvents, sycl::detail::pi::PiEvent &Event)
 
void waitForPreparedHostEvents () const
 
CommandprocessDepEvent (EventImplPtr DepEvent, const DepDesc &Dep, std::vector< Command * > &ToCleanUp)
 Perform glueing of events from different contexts. More...
 
sycl::detail::pi::PiExtCommandBuffer getCommandBuffer () const
 Gets the command buffer (if any) associated with this command. More...
 
- 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...
 
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::PiExtSyncPointMSyncPointDeps
 List of sync points for submissions to a command buffer. More...
 

Detailed Description

The KernelFusionCommand is placed in the execution graph together with the individual kernels of the fusion list to control kernel fusion.

Definition at line 724 of file commands.hpp.

Member Enumeration Documentation

◆ FusionStatus

Enumerator
ACTIVE 
CANCELLED 
COMPLETE 
DELETED 

Definition at line 726 of file commands.hpp.

Constructor & Destructor Documentation

◆ KernelFusionCommand()

sycl::_V1::detail::KernelFusionCommand::KernelFusionCommand ( QueueImplPtr  Queue)
explicit

Member Function Documentation

◆ addToFusionList()

void sycl::_V1::detail::KernelFusionCommand::addToFusionList ( ExecCGCommand Kernel)

Definition at line 3308 of file commands.cpp.

◆ auxiliaryCommands()

std::vector< Command * > & sycl::_V1::detail::KernelFusionCommand::auxiliaryCommands ( )

Definition at line 3304 of file commands.cpp.

◆ emitInstrumentationData()

◆ getFusionList()

std::vector< ExecCGCommand * > & sycl::_V1::detail::KernelFusionCommand::getFusionList ( )

Definition at line 3312 of file commands.cpp.

◆ isActive()

bool sycl::_V1::detail::KernelFusionCommand::isActive ( ) const
inline

Definition at line 750 of file commands.hpp.

◆ printDot()

void sycl::_V1::detail::KernelFusionCommand::printDot ( std::ostream &  Stream) const
finalvirtual

◆ producesPiEvent()

bool sycl::_V1::detail::KernelFusionCommand::producesPiEvent ( ) const
finalvirtual

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

Reimplemented from sycl::_V1::detail::Command.

Definition at line 3316 of file commands.cpp.

◆ readyForDeletion()

bool sycl::_V1::detail::KernelFusionCommand::readyForDeletion ( ) const
inline

Definition at line 752 of file commands.hpp.

Referenced by sycl::_V1::detail::handleVisitedNodes().

◆ resetQueue()

void sycl::_V1::detail::KernelFusionCommand::resetQueue ( )

Reset the queue.

This can be required as the command is held in order to maintain events alive, however this prevent the normal destruction of the queue.

Definition at line 3332 of file commands.cpp.

References ACTIVE, sycl::_V1::detail::Command::MQueue, and sycl::_V1::detail::Command::MWorkerQueue.

◆ setFusionStatus()

void sycl::_V1::detail::KernelFusionCommand::setFusionStatus ( FusionStatus  Status)

Set the status of this fusion command to Status.

This function should only be called under the protection of the scheduler write-lock.

Definition at line 3328 of file commands.cpp.


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