docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
sdfg::math::blas::GEMMNode Class Reference

#include <sdfg/data_flow/library_nodes/math/blas/gemm_node.h>

Inheritance diagram for sdfg::math::blas::GEMMNode:
[legend]

Public Member Functions

 GEMMNode (size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, const data_flow::ImplementationType &implementation_type, const BLAS_Precision &precision, const BLAS_Layout &layout, const BLAS_Transpose &trans_a, const BLAS_Transpose &trans_b, symbolic::Expression m, symbolic::Expression n, symbolic::Expression k, symbolic::Expression lda, symbolic::Expression ldb, symbolic::Expression ldc)
BLAS_Layout layout () const
BLAS_Transpose trans_a () const
BLAS_Transpose trans_b () const
symbolic::Expression m () const
symbolic::Expression n () const
symbolic::Expression k () const
symbolic::Expression lda () const
symbolic::Expression ldb () const
symbolic::Expression ldc () const
void validate (const Function &function) const override
 Validate the code node's configuration.
passes::LibNodeExpander::ExpandOutcome expand (passes::LibNodeExpander::ExpandContext &context, structured_control_flow::Block &block) override
 Expand this node into its internal operations.
symbolic::SymbolSet symbols () const override
 Get all symbols used in this node.
void replace (const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
void replace (const symbolic::ExpressionMapping &replacements) override
std::unique_ptr< data_flow::DataFlowNode > clone (size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph &parent) const override
 Clone this node for graph transformations.
std::string toStr () const override
 Convert node to string representation.
symbolic::Expression flop () const override
 Calculate floating point operations for this node.
symbolic::Expression flops (symbolic::Condition alpha_non_zero, symbolic::Condition alpha_non_ident, symbolic::Condition beta_non_zero, symbolic::Condition beta_non_ident) const
data_flow::PointerAccessType pointer_access_type (int input_idx) const override
 Describes what a pointer is used for.
bool relocalize_operand (int input_idx, const math::tensor::TensorLayout &packed) override
 Repoint the operand at input_idx to a locally staged buffer.
bool can_relocalize_operand (int input_idx, const math::tensor::TensorLayout &packed) const override
 Side-effect-free predicate mirroring relocalize_operand: whether the operand at input_idx can be repointed at the buffer view packed.
Public Member Functions inherited from sdfg::math::blas::BLASNode
 BLASNode (size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, const data_flow::LibraryNodeCode &code, const std::vector< std::string > &outputs, const std::vector< std::string > &inputs, const data_flow::ImplementationType &implementation_type, const BLAS_Precision &precision)
 Construct a BLAS node.
BLAS_Precision precision () const
 Get the precision/data type.
types::PrimitiveType scalar_primitive () const
 Get the corresponding scalar primitive type.
std::optional< double > constant_input (const std::string &conn) const
 The value of the scalar input conn if a constant feeds it.
Public Member Functions inherited from sdfg::math::MathNode
 MathNode (size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, const data_flow::LibraryNodeCode &code, const std::vector< std::string > &outputs, const std::vector< std::string > &inputs, const data_flow::ImplementationType &implementation_type, bool side_effects=false)
 Construct a mathematical library node.
Public Member Functions inherited from sdfg::data_flow::LibraryNode
 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.
PointerAccessType pointer_access_type (const Memlet &edge) const
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
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 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.

Static Public Member Functions

static symbolic::Expression calc_matrix_access_range (const symbolic::Expression &outer_dim, const symbolic::Expression &inner_dim, const symbolic::Expression &line_size, BLAS_Transpose trans, BLAS_Layout layout)
Static Public Member Functions inherited from sdfg::data_flow::LibraryNode
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.

Static Public Attributes

static constexpr int A_INPUT_IDX = 0
static constexpr int B_INPUT_IDX = 1
static constexpr int C_INPUT_IDX = 2
static constexpr int ALPHA_INPUT_IDX = 3
static constexpr int BETA_INPUT_IDX = 4
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.

Additional Inherited Members

Protected Member Functions inherited from 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 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 inherited from sdfg::math::blas::BLASNode
BLAS_Precision precision_
 Floating-point precision for the operation.
Protected Attributes inherited from sdfg::data_flow::LibraryNode
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_

Constructor & Destructor Documentation

◆ GEMMNode()

sdfg::math::blas::GEMMNode::GEMMNode ( size_t element_id,
const DebugInfo & debug_info,
const graph::Vertex vertex,
data_flow::DataFlowGraph & parent,
const data_flow::ImplementationType & implementation_type,
const BLAS_Precision & precision,
const BLAS_Layout & layout,
const BLAS_Transpose & trans_a,
const BLAS_Transpose & trans_b,
symbolic::Expression m,
symbolic::Expression n,
symbolic::Expression k,
symbolic::Expression lda,
symbolic::Expression ldb,
symbolic::Expression ldc )

Member Function Documentation

◆ calc_matrix_access_range()

symbolic::Expression sdfg::math::blas::GEMMNode::calc_matrix_access_range ( const symbolic::Expression & outer_dim,
const symbolic::Expression & inner_dim,
const symbolic::Expression & line_size,
BLAS_Transpose trans,
BLAS_Layout layout )
static

◆ can_relocalize_operand()

bool sdfg::math::blas::GEMMNode::can_relocalize_operand ( int input_idx,
const math::tensor::TensorLayout & packed ) const
overridevirtual

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

Reimplemented from sdfg::data_flow::LibraryNode.

◆ clone()

std::unique_ptr< data_flow::DataFlowNode > sdfg::math::blas::GEMMNode::clone ( size_t element_id,
const graph::Vertex vertex,
data_flow::DataFlowGraph & parent ) const
overridevirtual

Clone this node for graph transformations.

Parameters
element_idNew element identifier for the clone
vertexNew graph vertex for the clone
parentParent graph for the clone
Returns
Unique pointer to the cloned node

Pure virtual function that must be implemented by derived classes to support graph transformations and optimizations.

Implements sdfg::data_flow::DataFlowNode.

◆ expand()

passes::LibNodeExpander::ExpandOutcome sdfg::math::blas::GEMMNode::expand ( passes::LibNodeExpander::ExpandContext & context,
structured_control_flow::Block & block )
overridevirtual

Expand this node into its internal operations.

Note: some nodes need more than one expansion, so these should be separate impls. of LibNodeExpander instead

The expansion process transforms the high-level mathematical operation represented by this node into primitive SDFG constructs (maps, tasklets, etc.). This allows the operation to be further optimized and scheduled.

Parameters
contextway to request isolation of node or add new blocks, loops etc.
blockthe block in which the node is contained
Returns
context, which will know of all the changes that were made

Implements sdfg::math::MathNode.

◆ flop()

symbolic::Expression sdfg::math::blas::GEMMNode::flop ( ) const
overridevirtual

Calculate floating point operations for this node.

Returns
Symbolic expression for FLOP count (or null)

Reimplemented from sdfg::data_flow::LibraryNode.

◆ flops()

symbolic::Expression sdfg::math::blas::GEMMNode::flops ( symbolic::Condition alpha_non_zero,
symbolic::Condition alpha_non_ident,
symbolic::Condition beta_non_zero,
symbolic::Condition beta_non_ident ) const

◆ k()

symbolic::Expression sdfg::math::blas::GEMMNode::k ( ) const

◆ layout()

BLAS_Layout sdfg::math::blas::GEMMNode::layout ( ) const

◆ lda()

symbolic::Expression sdfg::math::blas::GEMMNode::lda ( ) const

◆ ldb()

symbolic::Expression sdfg::math::blas::GEMMNode::ldb ( ) const

◆ ldc()

symbolic::Expression sdfg::math::blas::GEMMNode::ldc ( ) const

◆ m()

symbolic::Expression sdfg::math::blas::GEMMNode::m ( ) const

◆ n()

symbolic::Expression sdfg::math::blas::GEMMNode::n ( ) const

◆ pointer_access_type()

data_flow::PointerAccessType sdfg::math::blas::GEMMNode::pointer_access_type ( int input_idx) const
overridevirtual

Describes what a pointer is used for.

Parameters
input_idxindex of input that is a pointer.
Returns
Invalid if not asked about a pointer input

Reimplemented from sdfg::data_flow::LibraryNode.

◆ relocalize_operand()

bool sdfg::math::blas::GEMMNode::relocalize_operand ( int input_idx,
const math::tensor::TensorLayout & packed )
overridevirtual

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 from sdfg::data_flow::LibraryNode.

◆ replace() [1/2]

void sdfg::math::blas::GEMMNode::replace ( const symbolic::Expression old_expression,
const symbolic::Expression new_expression )
overridevirtual

Implements sdfg::Element.

◆ replace() [2/2]

void sdfg::math::blas::GEMMNode::replace ( const symbolic::ExpressionMapping & replacements)
overridevirtual

Reimplemented from sdfg::Element.

◆ symbols()

symbolic::SymbolSet sdfg::math::blas::GEMMNode::symbols ( ) const
overridevirtual

Get all symbols used in this node.

Returns
Set of symbolic expressions used by this node

Implements sdfg::data_flow::LibraryNode.

◆ toStr()

std::string sdfg::math::blas::GEMMNode::toStr ( ) const
overridevirtual

Convert node to string representation.

Returns
String representation of the node

Reimplemented from sdfg::data_flow::LibraryNode.

◆ trans_a()

BLAS_Transpose sdfg::math::blas::GEMMNode::trans_a ( ) const

◆ trans_b()

BLAS_Transpose sdfg::math::blas::GEMMNode::trans_b ( ) const

◆ validate()

void sdfg::math::blas::GEMMNode::validate ( const Function & function) const
overridevirtual

Validate the code node's configuration.

Parameters
functionFunction context for validation

Ensures that:

  • No two access nodes connect to the same data for inputs/outputs

Reimplemented from sdfg::data_flow::CodeNode.

Member Data Documentation

◆ A_INPUT_IDX

int sdfg::math::blas::GEMMNode::A_INPUT_IDX = 0
staticconstexpr

◆ ALPHA_INPUT_IDX

int sdfg::math::blas::GEMMNode::ALPHA_INPUT_IDX = 3
staticconstexpr

◆ B_INPUT_IDX

int sdfg::math::blas::GEMMNode::B_INPUT_IDX = 1
staticconstexpr

◆ BETA_INPUT_IDX

int sdfg::math::blas::GEMMNode::BETA_INPUT_IDX = 4
staticconstexpr

◆ C_INPUT_IDX

int sdfg::math::blas::GEMMNode::C_INPUT_IDX = 2
staticconstexpr

The documentation for this class was generated from the following file:
  • sdfg/include/sdfg/data_flow/library_nodes/math/blas/gemm_node.h