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 Types

using id_type = uint64_t
 

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...
 
node_imploperator= (node_impl &Other)
 Copy-assignment operator. More...
 
bool hasRequirementDependency (sycl::detail::AccessorImplHost *IncomingReq)
 Checks if this node should be a dependency of another node based on accessor requirements. 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...
 
void updateAccessor (int ArgIndex, const sycl::detail::AccessorBaseHost *Acc)
 Update the value of an accessor inside this node. More...
 
void updateArgValue (int ArgIndex, const void *NewValue, size_t Size)
 
template<int Dimensions>
void updateNDRange (nd_range< Dimensions > ExecutionRange)
 
template<int Dimensions>
void updateRange (range< Dimensions > ExecutionRange)
 
void updateFromOtherNode (const std::shared_ptr< node_impl > &Other)
 
id_type getID () const
 

Public Attributes

id_type MID = getNextNodeID()
 Unique identifier for this node. More...
 
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...
 
bool MNDRangeUsed = false
 Track whether an ND-Range was used for kernel nodes. More...
 

Detailed Description

Implementation of node class from SYCL_EXT_ONEAPI_GRAPH.

Definition at line 77 of file graph_impl.hpp.

Member Typedef Documentation

◆ id_type

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 141 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 147 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 160 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 224 of file graph_impl.hpp.

References sycl::_V1::detail::CG::StorageInitHelper::MArgsStorage, MCGType, and MCommandGroup.

Referenced by operator=().

◆ getID()

id_type sycl::_V1::ext::oneapi::experimental::detail::node_impl::getID ( ) const
inline

Definition at line 525 of file graph_impl.hpp.

References MID.

◆ hasRequirementDependency()

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

Checks if this node should be a dependency of another node based on accessor requirements.

This is calculated using access modes if a requirement to the same buffer is found inside this node.

Parameters
IncomingReqIncoming requirement.
Returns
True if a dependency is needed, false if not.

Definition at line 183 of file graph_impl.hpp.

References sycl::_V1::access::atomic, MCommandGroup, sycl::_V1::access::read, and sycl::_V1::access::write.

◆ 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 217 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 314 of file graph_impl.hpp.

References MCGType, MCommandGroup, MPredecessors, and MSuccessors.

◆ operator=()

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

Copy-assignment operator.

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

Definition at line 167 of file graph_impl.hpp.

References getCGCopy(), MCGType, MCommandGroup, MNodeType, MPredecessors, MSubGraphImpl, 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 365 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 130 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 116 of file graph_impl.hpp.

References MSuccessors.

◆ updateAccessor()

void sycl::_V1::ext::oneapi::experimental::detail::node_impl::updateAccessor ( int  ArgIndex,
const sycl::detail::AccessorBaseHost *  Acc 
)
inline

Update the value of an accessor inside this node.

Accessors must be handled specifically compared to other argument values.

Parameters
ArgIndexThe index of the accessor arg to be updated
AccPointer to the new accessor value

Definition at line 390 of file graph_impl.hpp.

References sycl::_V1::detail::getSyclObjImpl(), sycl::_V1::invalid, sycl::_V1::make_error_code(), and MCommandGroup.

◆ updateArgValue()

void sycl::_V1::ext::oneapi::experimental::detail::node_impl::updateArgValue ( int  ArgIndex,
const void *  NewValue,
size_t  Size 
)
inline

Definition at line 439 of file graph_impl.hpp.

References MCommandGroup.

◆ updateFromOtherNode()

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

Definition at line 508 of file graph_impl.hpp.

References MCommandGroup.

◆ updateNDRange()

template<int Dimensions>
void sycl::_V1::ext::oneapi::experimental::detail::node_impl::updateNDRange ( nd_range< Dimensions ExecutionRange)
inline

Definition at line 456 of file graph_impl.hpp.

References sycl::_V1::Dimensions, MCGType, MCommandGroup, and MNDRangeUsed.

◆ updateRange()

template<int Dimensions>
void sycl::_V1::ext::oneapi::experimental::detail::node_impl::updateRange ( range< Dimensions ExecutionRange)
inline

Definition at line 482 of file graph_impl.hpp.

References sycl::_V1::Dimensions, MCGType, MCommandGroup, and MNDRangeUsed.

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 90 of file graph_impl.hpp.

Referenced by getCGCopy(), isEmpty(), isSimilar(), operator=(), updateNDRange(), and updateRange().

◆ 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 94 of file graph_impl.hpp.

Referenced by getCGCopy(), hasRequirementDependency(), isSimilar(), node_impl(), operator=(), updateAccessor(), updateArgValue(), updateFromOtherNode(), updateNDRange(), and updateRange().

◆ MID

id_type sycl::_V1::ext::oneapi::experimental::detail::node_impl::MID = getNextNodeID()

Unique identifier for this node.

Definition at line 82 of file graph_impl.hpp.

Referenced by getID().

◆ MNDRangeUsed

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

Track whether an ND-Range was used for kernel nodes.

Definition at line 108 of file graph_impl.hpp.

Referenced by updateNDRange(), and updateRange().

◆ MNodeType

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

User facing type of the node.

Definition at line 92 of file graph_impl.hpp.

Referenced by operator=().

◆ 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 105 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 88 of file graph_impl.hpp.

Referenced by isSimilar(), operator=(), 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 97 of file graph_impl.hpp.

Referenced by node_impl(), and operator=().

◆ 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 84 of file graph_impl.hpp.

Referenced by isSimilar(), operator=(), 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 100 of file graph_impl.hpp.


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