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

Graph builder class. More...

#include <detail/scheduler/scheduler.hpp>

Collaboration diagram for sycl::_V1::detail::Scheduler::GraphBuilder:

Public Member Functions

 GraphBuilder ()
 
GraphBuildResult addCG (std::unique_ptr< detail::CG > CommandGroup, const QueueImplPtr &Queue, std::vector< Command * > &ToEnqueue)
 Registers command group and adds it to the dependency graph. More...
 
CommandaddCGUpdateHost (std::unique_ptr< detail::CG > CommandGroup, const QueueImplPtr &HostQueue, std::vector< Command * > &ToEnqueue)
 Registers a command group that updates host memory to the latest state. More...
 
CommandaddCopyBack (Requirement *Req, std::vector< Command * > &ToEnqueue)
 Enqueues a command to update memory to the latest state. More...
 
CommandaddHostAccessor (Requirement *Req, std::vector< Command * > &ToEnqueue)
 Enqueues a command to create a host accessor. More...
 
void optimize ()
 [Provisional] Optimizes the whole graph. More...
 
void optimize (const EventImplPtr &Event)
 [Provisional] Optimizes subgraph that consists of command associated with Event passed and its dependencies. More...
 
void cleanupCommand (Command *Cmd, bool AllowUnsubmitted=false)
 
void rescheduleCommand (Command *Cmd, const QueueImplPtr &Queue)
 Reschedules the command passed using Queue provided. More...
 
MemObjRecordgetMemObjRecord (SYCLMemObjI *MemObject)
 
MemObjRecordgetOrInsertMemObjRecord (const QueueImplPtr &Queue, const Requirement *Req, std::vector< Command * > &ToEnqueue)
 
void decrementLeafCountersForRecord (MemObjRecord *Record)
 Decrements leaf counters for all leaves of the record. More...
 
void cleanupCommandsForRecord (MemObjRecord *Record)
 Removes commands that use the given MemObjRecord from the graph. More...
 
void removeRecordForMemObj (SYCLMemObjI *MemObject)
 Removes the MemObjRecord for the memory object passed. More...
 
void addNodeToLeaves (MemObjRecord *Record, Command *Cmd, access::mode AccessMode, std::vector< Command * > &ToEnqueue)
 Adds new command to leaves if needed. More...
 
void updateLeaves (const std::set< Command * > &Cmds, MemObjRecord *Record, access::mode AccessMode, std::vector< Command * > &ToCleanUp)
 Removes commands from leaves. More...
 
CommandconnectDepEvent (Command *const Cmd, const EventImplPtr &DepEvent, const DepDesc &Dep, std::vector< Command * > &ToCleanUp)
 Perform connection of events in multiple contexts. More...
 
void startFusion (QueueImplPtr Queue)
 
void cancelFusion (QueueImplPtr Queue, std::vector< Command * > &ToEnqueue)
 
EventImplPtr completeFusion (QueueImplPtr Queue, std::vector< Command * > &ToEnqueue, const property_list &)
 
bool isInFusionMode (QueueIdT queue)
 

Public Attributes

std::vector< SYCLMemObjI * > MMemObjs
 

Protected Member Functions

DepDesc findDepForRecord (Command *Cmd, MemObjRecord *Record)
 Finds a command dependency corresponding to the record. More...
 
AllocaCommandBasefindAllocaForReq (MemObjRecord *Record, const Requirement *Req, const ContextImplPtr &Context, bool AllowConst=true)
 Searches for suitable alloca in memory record. More...
 

Friends

class Command
 
class ::MockScheduler
 

Detailed Description

Graph builder class.

The graph builder provides means to change an existing graph (e.g. add or remove edges/nodes).

Definition at line 522 of file scheduler.hpp.

Constructor & Destructor Documentation

◆ GraphBuilder()

sycl::_V1::detail::Scheduler::GraphBuilder::GraphBuilder ( )

Definition at line 95 of file graph_builder.cpp.

Member Function Documentation

◆ addCG()

Scheduler::GraphBuildResult sycl::_V1::detail::Scheduler::GraphBuilder::addCG ( std::unique_ptr< detail::CG CommandGroup,
const QueueImplPtr Queue,
std::vector< Command * > &  ToEnqueue 
)

Registers command group and adds it to the dependency graph.

See also
queue::submit, Scheduler::addCG
Returns
a command that represents command group execution and a bool indicating whether this command should be enqueued to the graph processor right away or not.

Definition at line 932 of file graph_builder.cpp.

References sycl::_V1::detail::isInteropHostTask().

◆ addCGUpdateHost()

Command * sycl::_V1::detail::Scheduler::GraphBuilder::addCGUpdateHost ( std::unique_ptr< detail::CG CommandGroup,
const QueueImplPtr HostQueue,
std::vector< Command * > &  ToEnqueue 
)

Registers a command group that updates host memory to the latest state.

Returns
a command that represents command group execution.

Definition at line 557 of file graph_builder.cpp.

◆ addCopyBack()

◆ addHostAccessor()

Command * sycl::_V1::detail::Scheduler::GraphBuilder::addHostAccessor ( Requirement Req,
std::vector< Command * > &  ToEnqueue 
)

◆ addNodeToLeaves()

void sycl::_V1::detail::Scheduler::GraphBuilder::addNodeToLeaves ( MemObjRecord Record,
Command Cmd,
access::mode  AccessMode,
std::vector< Command * > &  ToEnqueue 
)

◆ cancelFusion()

void sycl::_V1::detail::Scheduler::GraphBuilder::cancelFusion ( QueueImplPtr  Queue,
std::vector< Command * > &  ToEnqueue 
)

Definition at line 1406 of file graph_builder.cpp.

◆ cleanupCommand()

◆ cleanupCommandsForRecord()

◆ completeFusion()

EventImplPtr sycl::_V1::detail::Scheduler::GraphBuilder::completeFusion ( QueueImplPtr  Queue,
std::vector< Command * > &  ToEnqueue,
const property_list PropList 
)

◆ connectDepEvent()

Command * sycl::_V1::detail::Scheduler::GraphBuilder::connectDepEvent ( Command *const  Cmd,
const EventImplPtr DepEvent,
const DepDesc Dep,
std::vector< Command * > &  ToCleanUp 
)

Perform connection of events in multiple contexts.

Parameters
Cmddependant command
DepEventevent to depend on
Depoptional DepDesc to perform connection properly
ToCleanUpcontainer for commands that can be cleaned up due to their removal from leaves
Returns
the connecting command which is to be enqueued

Optionality of Dep is set by Dep.MDepCommand equal to nullptr.

Definition at line 1296 of file graph_builder.cpp.

References sycl::_V1::detail::Command::addDep(), sycl::_V1::detail::Command::addUser(), sycl::_V1::detail::Command::getEvent(), sycl::_V1::detail::Command::getWorkerContext(), sycl::_V1::detail::DepDesc::MDepCommand, and sycl::_V1::detail::DepDesc::MDepRequirement.

Referenced by sycl::_V1::detail::Command::processDepEvent().

◆ decrementLeafCountersForRecord()

void sycl::_V1::detail::Scheduler::GraphBuilder::decrementLeafCountersForRecord ( MemObjRecord Record)

◆ findAllocaForReq()

◆ findDepForRecord()

DepDesc sycl::_V1::detail::Scheduler::GraphBuilder::findDepForRecord ( Command Cmd,
MemObjRecord Record 
)
protected

Finds a command dependency corresponding to the record.

Definition at line 634 of file graph_builder.cpp.

References sycl::_V1::detail::DepDesc::MDepRequirement, sycl::_V1::detail::Command::MDeps, and sycl::_V1::detail::AccessorImplHost::MSYCLMemObj.

◆ getMemObjRecord()

MemObjRecord * sycl::_V1::detail::Scheduler::GraphBuilder::getMemObjRecord ( SYCLMemObjI MemObject)
Returns
a pointer to the corresponding memory object record for the SYCL memory object provided, or nullptr if it does not exist.

Definition at line 191 of file graph_builder.cpp.

References sycl::_V1::detail::SYCLMemObjI::MRecord.

◆ getOrInsertMemObjRecord()

MemObjRecord * sycl::_V1::detail::Scheduler::GraphBuilder::getOrInsertMemObjRecord ( const QueueImplPtr Queue,
const Requirement Req,
std::vector< Command * > &  ToEnqueue 
)

◆ isInFusionMode()

bool sycl::_V1::detail::Scheduler::GraphBuilder::isInFusionMode ( QueueIdT  queue)

Definition at line 1626 of file graph_builder.cpp.

◆ optimize() [1/2]

void sycl::_V1::detail::Scheduler::GraphBuilder::optimize ( )

[Provisional] Optimizes the whole graph.

◆ optimize() [2/2]

void sycl::_V1::detail::Scheduler::GraphBuilder::optimize ( const EventImplPtr Event)

[Provisional] Optimizes subgraph that consists of command associated with Event passed and its dependencies.

◆ removeRecordForMemObj()

void sycl::_V1::detail::Scheduler::GraphBuilder::removeRecordForMemObj ( SYCLMemObjI MemObject)

Removes the MemObjRecord for the memory object passed.

Definition at line 1274 of file graph_builder.cpp.

References sycl::_V1::detail::SYCLMemObjI::MRecord.

◆ rescheduleCommand()

void sycl::_V1::detail::Scheduler::GraphBuilder::rescheduleCommand ( Command Cmd,
const QueueImplPtr Queue 
)

Reschedules the command passed using Queue provided.

This can lead to rescheduling of all dependent commands. This can be used when the user provides a "secondary" queue to the submit method which may be used when the command fails to enqueue/execute in the primary queue.

◆ startFusion()

void sycl::_V1::detail::Scheduler::GraphBuilder::startFusion ( QueueImplPtr  Queue)

Definition at line 1352 of file graph_builder.cpp.

References sycl::_V1::make_error_code().

◆ updateLeaves()

void sycl::_V1::detail::Scheduler::GraphBuilder::updateLeaves ( const std::set< Command * > &  Cmds,
MemObjRecord Record,
access::mode  AccessMode,
std::vector< Command * > &  ToCleanUp 
)

Friends And Related Function Documentation

◆ ::MockScheduler

friend class ::MockScheduler
friend

Definition at line 683 of file scheduler.hpp.

◆ Command

friend class Command
friend

Definition at line 680 of file scheduler.hpp.

Member Data Documentation

◆ MMemObjs

std::vector<SYCLMemObjI *> sycl::_V1::detail::Scheduler::GraphBuilder::MMemObjs

Definition at line 625 of file scheduler.hpp.


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