DPC++ Runtime
Runtime libraries for oneAPI DPC++
sycl::_V1::ext::oneapi::experimental::detail::node_impl Class Reference

Implementation of node class from SYCL_EXT_ONEAPI_GRAPH. More...

#include <detail/graph_impl.hpp>

Collaboration diagram for sycl::_V1::ext::oneapi::experimental::detail::node_impl:

Public Member Functions

void registerSuccessor (const std::shared_ptr< node_impl > &Node, const std::shared_ptr< node_impl > &Prev)
 Add successor to the node. More...
 
void registerPredecessor (const std::shared_ptr< node_impl > &Node)
 Add predecessor to the node. More...
 
 node_impl ()
 Construct an empty node. More...
 
 node_impl (node_type NodeType, std::unique_ptr< sycl::detail::CG > &&CommandGroup)
 Construct a node representing a command-group. More...
 
 node_impl (node_impl &Other)
 Construct a node from another node. More...
 
bool hasRequirement (sycl::detail::AccessorImplHost *IncomingReq)
 Checks if this node has a given requirement. More...
 
bool isEmpty () const
 Query if this is an empty node. More...
 
std::unique_ptr< sycl::detail::CG > getCGCopy () const
 Get a deep copy of this node's command group. More...
 
bool isSimilar (const std::shared_ptr< node_impl > &Node, bool CompareContentOnly=false) const
 Tests if the caller is similar to Node, this is only used for testing. More...
 
void printDotRecursive (std::fstream &Stream, std::vector< node_impl * > &Visited, bool Verbose)
 Recursive Depth first traversal of linked nodes. More...
 

Public Attributes

std::vector< std::weak_ptr< node_impl > > MSuccessors
 List of successors to this node. More...
 
std::vector< std::weak_ptr< node_impl > > MPredecessors
 List of predecessors to this node. More...
 
sycl::detail::CG::CGTYPE MCGType = sycl::detail::CG::None
 Type of the command-group for the node. More...
 
node_type MNodeType = node_type::empty
 User facing type of the node. More...
 
std::unique_ptr< sycl::detail::CG > MCommandGroup
 Command group object which stores all args etc needed to enqueue the node. More...
 
std::shared_ptr< exec_graph_implMSubGraphImpl
 Stores the executable graph impl associated with this node if it is a subgraph node. More...
 
bool MVisited = false
 Used for tracking visited status during cycle checks. More...
 
int MPartitionNum = -1
 Partition number needed to assign a Node to a a partition. More...
 

Detailed Description

Implementation of node class from SYCL_EXT_ONEAPI_GRAPH.

Definition at line 76 of file graph_impl.hpp.

Constructor & Destructor Documentation

◆ node_impl() [1/3]

sycl::_V1::ext::oneapi::experimental::detail::node_impl::node_impl ( )
inline

Construct an empty node.

Definition at line 133 of file graph_impl.hpp.

◆ node_impl() [2/3]

sycl::_V1::ext::oneapi::experimental::detail::node_impl::node_impl ( node_type  NodeType,
std::unique_ptr< sycl::detail::CG > &&  CommandGroup 
)
inline

Construct a node representing a command-group.

Parameters
NodeTypeType of the command-group.
CommandGroupThe CG which stores the command information for this node.

Definition at line 139 of file graph_impl.hpp.

References MCommandGroup, MSubGraphImpl, and sycl::_V1::ext::oneapi::experimental::subgraph.

◆ node_impl() [3/3]

sycl::_V1::ext::oneapi::experimental::detail::node_impl::node_impl ( node_impl Other)
inline

Construct a node from another node.

This will perform a deep-copy of the command group object associated with this node.

Definition at line 152 of file graph_impl.hpp.

Member Function Documentation

◆ getCGCopy()

std::unique_ptr<sycl::detail::CG> sycl::_V1::ext::oneapi::experimental::detail::node_impl::getCGCopy ( ) const
inline

Get a deep copy of this node's command group.

Returns
A unique ptr to the new command group object.

Definition at line 181 of file graph_impl.hpp.

References MCGType, and MCommandGroup.

◆ hasRequirement()

bool sycl::_V1::ext::oneapi::experimental::detail::node_impl::hasRequirement ( sycl::detail::AccessorImplHost *  IncomingReq)
inline

Checks if this node has a given requirement.

Parameters
RequirementRequirement to lookup.
Returns
True if Requirement is present in node, false otherwise.

Definition at line 160 of file graph_impl.hpp.

References MCommandGroup.

◆ isEmpty()

bool sycl::_V1::ext::oneapi::experimental::detail::node_impl::isEmpty ( ) const
inline

Query if this is an empty node.

Barrier nodes are also considered empty nodes since they do not embed any workload but only dependencies

Returns
True if this is an empty node, false otherwise.

Definition at line 174 of file graph_impl.hpp.

References MCGType.

◆ isSimilar()

bool sycl::_V1::ext::oneapi::experimental::detail::node_impl::isSimilar ( const std::shared_ptr< node_impl > &  Node,
bool  CompareContentOnly = false 
) const
inline

Tests if the caller is similar to Node, this is only used for testing.

Parameters
NodeThe node to check for similarity.
CompareContentOnlySkip comparisons related to graph structure, compare only the type and command groups of the nodes
Returns
True if the two nodes are similar

Definition at line 262 of file graph_impl.hpp.

References MCGType, MCommandGroup, MPredecessors, and MSuccessors.

◆ printDotRecursive()

void sycl::_V1::ext::oneapi::experimental::detail::node_impl::printDotRecursive ( std::fstream &  Stream,
std::vector< node_impl * > &  Visited,
bool  Verbose 
)
inline

Recursive Depth first traversal of linked nodes.

to print node information and connection to Stream.

Parameters
StreamWhere to print node information.
VisitedVector of the already visited nodes.
VerboseIf true, print additional information about the nodes such as kernel args or memory access where applicable.

Definition at line 313 of file graph_impl.hpp.

References MPartitionNum, MPredecessors, and MSuccessors.

◆ registerPredecessor()

void sycl::_V1::ext::oneapi::experimental::detail::node_impl::registerPredecessor ( const std::shared_ptr< node_impl > &  Node)
inline

Add predecessor to the node.

Parameters
NodeNode to add as a predecessor.

Definition at line 122 of file graph_impl.hpp.

References MPredecessors.

◆ registerSuccessor()

void sycl::_V1::ext::oneapi::experimental::detail::node_impl::registerSuccessor ( const std::shared_ptr< node_impl > &  Node,
const std::shared_ptr< node_impl > &  Prev 
)
inline

Add successor to the node.

Parameters
NodeNode to add as a successor.
PrevPredecessor to node being added as successor.

Prev should be a shared_ptr to an instance of this object, but can't use a raw this pointer, so the extra \Prev parameter is passed.

Definition at line 108 of file graph_impl.hpp.

References MSuccessors.

Member Data Documentation

◆ MCGType

sycl::detail::CG::CGTYPE sycl::_V1::ext::oneapi::experimental::detail::node_impl::MCGType = sycl::detail::CG::None

Type of the command-group for the node.

Definition at line 85 of file graph_impl.hpp.

Referenced by getCGCopy(), isEmpty(), and isSimilar().

◆ MCommandGroup

std::unique_ptr<sycl::detail::CG> sycl::_V1::ext::oneapi::experimental::detail::node_impl::MCommandGroup

Command group object which stores all args etc needed to enqueue the node.

Definition at line 89 of file graph_impl.hpp.

Referenced by getCGCopy(), hasRequirement(), isSimilar(), and node_impl().

◆ MNodeType

node_type sycl::_V1::ext::oneapi::experimental::detail::node_impl::MNodeType = node_type::empty

User facing type of the node.

Definition at line 87 of file graph_impl.hpp.

◆ MPartitionNum

int sycl::_V1::ext::oneapi::experimental::detail::node_impl::MPartitionNum = -1

Partition number needed to assign a Node to a a partition.

Note : This number is only used during the partitionning process and cannot be used to find out the partion of a node outside of this process.

Definition at line 100 of file graph_impl.hpp.

Referenced by printDotRecursive().

◆ MPredecessors

std::vector<std::weak_ptr<node_impl> > sycl::_V1::ext::oneapi::experimental::detail::node_impl::MPredecessors

List of predecessors to this node.

Using weak_ptr here to prevent circular references between nodes.

Definition at line 83 of file graph_impl.hpp.

Referenced by isSimilar(), printDotRecursive(), and registerPredecessor().

◆ MSubGraphImpl

std::shared_ptr<exec_graph_impl> sycl::_V1::ext::oneapi::experimental::detail::node_impl::MSubGraphImpl

Stores the executable graph impl associated with this node if it is a subgraph node.

Definition at line 92 of file graph_impl.hpp.

Referenced by node_impl().

◆ MSuccessors

std::vector<std::weak_ptr<node_impl> > sycl::_V1::ext::oneapi::experimental::detail::node_impl::MSuccessors

List of successors to this node.

Definition at line 79 of file graph_impl.hpp.

Referenced by isSimilar(), printDotRecursive(), and registerSuccessor().

◆ MVisited

bool sycl::_V1::ext::oneapi::experimental::detail::node_impl::MVisited = false

Used for tracking visited status during cycle checks.

Definition at line 95 of file graph_impl.hpp.


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