docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
sdfg::data_flow::LibraryNode Class Referenceabstract

Base class for all library nodes in the dataflow graph. More...

#include <sdfg/data_flow/library_node.h>

Inheritance diagram for sdfg::data_flow::LibraryNode:
[legend]

Public Member Functions

 LibraryNode (const LibraryNode &data_node)=delete
LibraryNode & operator= (const LibraryNode &)=delete
virtual ~LibraryNode ()=default
ElementType type_id () const override
 Returns the type of the element.
const LibraryNodeCode & code () const
 Get the operation code.
const ImplementationType & implementation_type () const
 Get the implementation type (const).
ImplementationType & implementation_type ()
 Get the implementation type (mutable).
void set_implementation_type (const ImplementationType &impl_type)
bool side_effect () const override
 Check if this node has side effects.
virtual std::string toStr () const
 Convert node to string representation.
virtual symbolic::SymbolSet symbols () const =0
 Get all symbols used in this node.
virtual symbolic::Expression flop () const
 Calculate floating point operations for this node.
virtual PointerAccessType pointer_access_type (int input_idx) const
 Describes what a pointer is used for.
PointerAccessType pointer_access_type (const Memlet &edge) const
virtual bool relocalize_operand (int input_idx, const math::tensor::TensorLayout &packed)
 Repoint the operand at input_idx to a locally staged buffer.
virtual bool can_relocalize_operand (int input_idx, const math::tensor::TensorLayout &packed) const
 Side-effect-free predicate mirroring relocalize_operand: whether the operand at input_idx can be repointed at the buffer view packed.
virtual std::optional< SubgroupAccess > operand_access (int input_idx, unsigned subgroup_size) const
 The elements one subgroup of subgroup_size lanes reads from the operand at input_idx, if the node declares them.
EdgeRemoveOption can_remove_out_edge (const data_flow::DataFlowGraph &graph, const Memlet *memlet) const override
 Is the edge in question removable, or will this make the node its an output on invalid?
EdgeRemoveOption can_remove_in_edge (const data_flow::DataFlowGraph &graph, const Memlet *memlet) const override
bool pointer_use_creates_side_effects (const DataFlowGraph &dataflow, const Function &func)
Public Member Functions inherited from sdfg::data_flow::CodeNode
 CodeNode (const CodeNode &data_node)=delete
CodeNode & operator= (const CodeNode &)=delete
void validate (const Function &function) const override
 Validate the code node's configuration.
const std::vector< std::string > & outputs () const
 Get output connector names (const).
const std::vector< std::string > & inputs () const
 Get input connector names (const).
std::vector< std::string > & outputs ()
 Get output connector names (mutable).
std::vector< std::string > & inputs ()
 Get input connector names (mutable).
const std::string & output (size_t index) const
 Get output connector name by index.
const std::string & input (size_t index) const
 Get input connector name by index.
bool has_constant_input (size_t index) const
 Check if an input is connected to a constant node.
Public Member Functions inherited from sdfg::data_flow::DataFlowNode
 DataFlowNode (const DataFlowNode &data_node)=delete
DataFlowNode & operator= (const DataFlowNode &)=delete
graph::Vertex vertex () const
 Get the graph vertex for this node.
const DataFlowGraph & get_parent () const
 Get the parent dataflow graph (const).
DataFlowGraph & get_parent ()
 Get the parent dataflow graph (mutable).
virtual std::unique_ptr< DataFlowNode > clone (size_t element_id, const graph::Vertex vertex, DataFlowGraph &parent) const =0
 Clone this node for graph transformations.
virtual bool update_edge_removed (const std::string &out_conn)
Public Member Functions inherited from sdfg::Element
 Element (size_t element_id, const DebugInfo &debug_info)
virtual ~Element ()=default
size_t element_id () const
const DebugInfo & debug_info () const
void set_debug_info (const DebugInfo &debug_info)
void add_metadata (const std::string &key, const std::string &value)
void remove_metadata (const std::string &key)
const std::string & metadata (const std::string &key) const
const std::string * metadata_if_exists (const std::string &key) const
const std::unordered_map< std::string, std::string > & metadata () const
std::string_view element_type () const
 Returns the type of the element as a human-readable string.
virtual void replace (const symbolic::Expression old_expression, const symbolic::Expression new_expression)=0
virtual void replace (const symbolic::ExpressionMapping &replacements)

Static Public Member Functions

static bool classof (const Element &element)
Static Public Member Functions inherited from sdfg::data_flow::CodeNode
static bool classof (const Element &element)
 LLVM-style RTTI predicate: true if element is a CodeNode.
Static Public Member Functions inherited from sdfg::data_flow::DataFlowNode
static bool classof (const Element &element)
 LLVM-style RTTI predicate: true if element is a DataFlowNode.

Protected Member Functions

 LibraryNode (size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, DataFlowGraph &parent, const LibraryNodeCode &code, const std::vector< std::string > &outputs, const std::vector< std::string > &inputs, const bool side_effect, const ImplementationType &implementation_type)
 Protected constructor for library nodes.
Protected Member Functions inherited from sdfg::data_flow::CodeNode
 CodeNode (size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, DataFlowGraph &parent, const std::vector< std::string > &outputs, const std::vector< std::string > &inputs)
 Protected constructor for code nodes.
Protected Member Functions inherited from sdfg::data_flow::DataFlowNode
 DataFlowNode (size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, DataFlowGraph &parent)
 Protected constructor for dataflow nodes.

Protected Attributes

LibraryNodeCode code_
 Operation identifier (e.g., "GEMM", "Add").
bool side_effect_
 Whether this node has side effects.
ImplementationType implementation_type_
 How to implement this node.
Protected Attributes inherited from sdfg::data_flow::CodeNode
std::vector< std::string > outputs_
 Names of output connectors.
std::vector< std::string > inputs_
 Names of input connectors.
Protected Attributes inherited from sdfg::Element
size_t element_id_
DebugInfo debug_info_
std::unordered_map< std::string, std::string > metadata_

Friends

class sdfg::builder::SDFGBuilder
class sdfg::builder::StructuredSDFGBuilder

Additional Inherited Members

Static Public Attributes inherited from sdfg::data_flow::CodeNode
static constexpr ElementType TypeGroup = ElementType::Tasklet | ElementType::LibraryNode
 Bitmask of all concrete ElementTypes that are CodeNodes.
Static Public Attributes inherited from sdfg::data_flow::DataFlowNode
static constexpr ElementType TypeGroup
 Bitmask of all concrete ElementTypes that are DataFlowNodes.

Detailed Description

Base class for all library nodes in the dataflow graph.

Library nodes represent calls to functions beyond simple instructions (tasklets). They can be mathematical operations, standard library functions, or custom operations. Each library node has:

  • A code identifying the operation (e.g., "GEMM", "Add", "Memcpy")
  • An implementation type specifying how to generate code
  • Optional side effects

Derived classes implement specific operations and may provide expansion methods to convert high-level operations into primitive operations.

Constructor & Destructor Documentation

◆ LibraryNode() [1/2]

sdfg::data_flow::LibraryNode::LibraryNode ( size_t element_id,
const DebugInfo & debug_info,
const graph::Vertex vertex,
DataFlowGraph & parent,
const LibraryNodeCode & code,
const std::vector< std::string > & outputs,
const std::vector< std::string > & inputs,
const bool side_effect,
const ImplementationType & implementation_type )
protected

Protected constructor for library nodes.

Parameters
element_idUnique element identifier
debug_infoDebug information for this node
vertexGraph vertex for this node
parentParent dataflow graph
codeOperation code/identifier
outputsOutput connector names
inputsInput connector names
side_effectWhether this operation has side effects
implementation_typeImplementation strategy

◆ LibraryNode() [2/2]

sdfg::data_flow::LibraryNode::LibraryNode ( const LibraryNode & data_node)
delete

◆ ~LibraryNode()

virtual sdfg::data_flow::LibraryNode::~LibraryNode ( )
virtualdefault

Member Function Documentation

◆ can_relocalize_operand()

virtual bool sdfg::data_flow::LibraryNode::can_relocalize_operand ( int input_idx,
const math::tensor::TensorLayout & packed ) const
inlinevirtual

Side-effect-free predicate mirroring relocalize_operand: whether the operand at input_idx can be repointed at the buffer view packed.

Reimplemented in sdfg::gpu::GpuMmaFragmentLoadNode, sdfg::gpu::GpuMmaFragmentStoreNode, sdfg::math::blas::GEMMNode, and sdfg::math::tensor::MatMulNode.

◆ can_remove_in_edge()

EdgeRemoveOption sdfg::data_flow::LibraryNode::can_remove_in_edge ( const data_flow::DataFlowGraph & graph,
const Memlet * memlet ) const
overridevirtual

◆ can_remove_out_edge()

EdgeRemoveOption sdfg::data_flow::LibraryNode::can_remove_out_edge ( const data_flow::DataFlowGraph & graph,
const Memlet * memlet ) const
overridevirtual

Is the edge in question removable, or will this make the node its an output on invalid?

Currently, some nodes may require every out connector to have at least 1 connection attached

Returns
NotRemovable, NoDependencies, CustomRemove

[NotRemovable] means only if the entire node can be removed, can the edge be removed [NoDependencies] means, the edge can be removed trivially, the node will work without for the remaining functions [CustomRemove] means, a call to [remove_out_edge] can have the node remove the edge itself and make necessary

Implements sdfg::data_flow::DataFlowNode.

◆ classof()

bool sdfg::data_flow::LibraryNode::classof ( const Element & element)
inlinestatic

◆ code()

const LibraryNodeCode & sdfg::data_flow::LibraryNode::code ( ) const

Get the operation code.

Returns
Library node code identifier

◆ flop()

◆ implementation_type() [1/2]

ImplementationType & sdfg::data_flow::LibraryNode::implementation_type ( )

Get the implementation type (mutable).

Returns
Mutable reference to implementation type
Deprecated
use setter allow for future type-changes of ImplementationType that can still work with the existing API

◆ implementation_type() [2/2]

const ImplementationType & sdfg::data_flow::LibraryNode::implementation_type ( ) const

Get the implementation type (const).

Returns
Implementation type for this node

◆ operand_access()

virtual std::optional< SubgroupAccess > sdfg::data_flow::LibraryNode::operand_access ( int input_idx,
unsigned subgroup_size ) const
inlinevirtual

The elements one subgroup of subgroup_size lanes reads from the operand at input_idx, if the node declares them.

Reimplemented in sdfg::gpu::GpuMmaFragmentLoadNode.

◆ operator=()

LibraryNode & sdfg::data_flow::LibraryNode::operator= ( const LibraryNode & )
delete

◆ pointer_access_type() [1/2]

PointerAccessType sdfg::data_flow::LibraryNode::pointer_access_type ( const Memlet & edge) const

◆ pointer_access_type() [2/2]

◆ pointer_use_creates_side_effects()

bool sdfg::data_flow::LibraryNode::pointer_use_creates_side_effects ( const DataFlowGraph & dataflow,
const Function & func )

◆ relocalize_operand()

virtual bool sdfg::data_flow::LibraryNode::relocalize_operand ( int input_idx,
const math::tensor::TensorLayout & packed )
inlinevirtual

Repoint the operand at input_idx to a locally staged buffer.

packed is the operand's own view of that buffer: its shape, the buffer's strides, and the buffer offset of its origin (in elements; may be a sub-window of the staged tile). Updates the node's addressing metadata to match. Returns false if the node cannot express the view (localization is then rejected).

Reimplemented in sdfg::gpu::GpuMmaFragmentLoadNode, sdfg::gpu::GpuMmaFragmentStoreNode, sdfg::math::blas::GEMMNode, and sdfg::math::tensor::MatMulNode.

◆ set_implementation_type()

void sdfg::data_flow::LibraryNode::set_implementation_type ( const ImplementationType & impl_type)

◆ side_effect()

bool sdfg::data_flow::LibraryNode::side_effect ( ) const
nodiscardoverridevirtual

Check if this node has side effects.

Returns
True if the node has side effects

Implements sdfg::data_flow::DataFlowNode.

◆ symbols()

virtual symbolic::SymbolSet sdfg::data_flow::LibraryNode::symbols ( ) const
pure virtual

Get all symbols used in this node.

Returns
Set of symbolic expressions used by this node

Implemented in sdfg::cuda::CUDADataOffloadingNode, sdfg::data_flow::AtomicScalarOpNode, sdfg::data_flow::BarrierLocalNode, sdfg::data_flow::CallNode, sdfg::data_flow::InvokeNode, sdfg::data_flow::LoadConstNode, sdfg::data_flow::MetadataNode, sdfg::einsum::EinsumNode, sdfg::fp_math::OzakiMatMulNode, sdfg::gpu::GpuMmaFillNode, sdfg::gpu::GpuMmaFragmentEltwiseAddNode, sdfg::gpu::GpuMmaFragmentLoadNode, sdfg::gpu::GpuMmaFragmentStoreNode, sdfg::gpu::GpuMmaMatmulNode, sdfg::gpu::GpuTileArrivalNode, sdfg::math::blas::BatchedGEMMNode, sdfg::math::blas::DotNode, sdfg::math::blas::GEMMNode, sdfg::math::cmath::CMathNode, sdfg::math::tensor::ArangeNode, sdfg::math::tensor::BatchNormNode, sdfg::math::tensor::BroadcastNode, sdfg::math::tensor::ClampNode, sdfg::math::tensor::ConcatNode, sdfg::math::tensor::ConditionalTensorCopyNode, sdfg::math::tensor::ConstPaddingNode, sdfg::math::tensor::ConvNode, sdfg::math::tensor::ElementWiseDataflowTensorNode, sdfg::math::tensor::EluNode, sdfg::math::tensor::EmbeddingNode, sdfg::math::tensor::EmbeddingRenormNode, sdfg::math::tensor::IndexNode, sdfg::math::tensor::LayerNormNode, sdfg::math::tensor::LeakyReLUNode, sdfg::math::tensor::MatMulNode, sdfg::math::tensor::ReduceNode, sdfg::math::tensor::SpatialTensorNode, sdfg::math::tensor::TensorCopyNode, sdfg::math::tensor::UpsampleBilinear2DNode, sdfg::offloading::DataOffloadingNode, sdfg::rocm::ROCMDataOffloadingNode, sdfg::stdlib::AllocaNode, sdfg::stdlib::AssertNode, sdfg::stdlib::CallocNode, sdfg::stdlib::FreeNode, sdfg::stdlib::MallocNode, sdfg::stdlib::MemcpyNode, sdfg::stdlib::MemmoveNode, sdfg::stdlib::MemsetNode, sdfg::stdlib::TrapNode, sdfg::stdlib::UnreachableNode, sdfg::tiles::PipelineCommitNode, sdfg::tiles::PipelineWaitNode, and sdfg::tiles::TileCopyNode.

◆ toStr()

◆ type_id()

ElementType sdfg::data_flow::LibraryNode::type_id ( ) const
inlineoverridevirtual

Returns the type of the element.

Implements sdfg::Element.

◆ sdfg::builder::SDFGBuilder

friend class sdfg::builder::SDFGBuilder
friend

◆ sdfg::builder::StructuredSDFGBuilder

Member Data Documentation

◆ code_

LibraryNodeCode sdfg::data_flow::LibraryNode::code_
protected

Operation identifier (e.g., "GEMM", "Add").

◆ implementation_type_

ImplementationType sdfg::data_flow::LibraryNode::implementation_type_
protected

How to implement this node.

◆ side_effect_

bool sdfg::data_flow::LibraryNode::side_effect_
protected

Whether this node has side effects.


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