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

Edge in the dataflow graph representing data movement. More...

#include <sdfg/data_flow/memlet.h>

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

Public Member Functions

 Memlet (const Memlet &memlet)=delete
Memlet & operator= (const Memlet &)=delete
ElementType type_id () const override
 Returns the type of the element.
void validate (const Function &function) const override
 Validate the memlet.
const graph::Edge edge () const
 Get the graph edge for this memlet.
const DataFlowGraph & get_parent () const
 Get the parent dataflow graph (const).
DataFlowGraph & get_parent ()
 Get the parent dataflow graph (mutable).
MemletType type () const
 Determine the type of this memlet.
bool is_src_read () const
 Memlet actually reads src (from memory).
bool is_src_direct_read () const
 Memlet returns the contents of src (this is [is_src_read()], excluding that the contents are only used transitively).
bool is_src_pointed_to_read () const
 Makes a memory read with src-contents as (partial) address.
bool is_src_address_leak () const
 Leaks the address of src or uses it in an address calculation that is returned.
bool is_src_pointed_to_address_leak (const types::IType &src_type) const
 Leaks address of what src points to.
bool is_dst_write () const
 makes a memory write to dst (itself).
bool is_dst_pointed_to_write () const
 Contents of dst are used in the address calculation of a memory write.
bool is_dst_read () const
 Contents of dst are read.
bool is_src_constant (double value) const
 Check if the source is a constant scalar with the given value.
bool is_src_constant (int64_t value) const
 Check if the source is a constant scalar with the given integer value.
const DataFlowNode & src () const
 Get the source node (const).
DataFlowNode & src ()
 Get the source node (mutable).
const DataFlowNode & dst () const
 Get the destination node (const).
DataFlowNode & dst ()
 Get the destination node (mutable).
const std::string & src_conn () const
 Get the source connector name.
const std::string & dst_conn () const
 Get the destination connector name.
const Subset & subset () const
 Get the data access subset.
void set_subset (const Subset &subset)
 Set the data access subset.
const types::IType & base_type () const
 Get the base type of the data.
void set_base_type (const types::IType &base_type)
 Set the base type of the data.
std::unique_ptr< types::IType > result_type (const Function &function) const
 Compute the result type after applying subset.
std::unique_ptr< Memlet > clone (size_t element_id, const graph::Edge &edge, DataFlowGraph &parent, DataFlowNode &src, DataFlowNode &dst) const
 Clone this memlet for graph transformations.
void replace (const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
 Replace symbolic expressions in this memlet.
void replace (const symbolic::ExpressionMapping &replacements) override
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 bool classof (const Element &element)

Friends

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

Additional Inherited Members

Protected Attributes inherited from sdfg::Element
size_t element_id_
DebugInfo debug_info_
std::unordered_map< std::string, std::string > metadata_

Detailed Description

Edge in the dataflow graph representing data movement.

Memlets are the edges of the dataflow graph that describe how data flows between nodes. Each memlet specifies:

  • Source and destination nodes
  • Source and destination connectors
  • Data subset being transferred
  • Base type of the data
  • Type of data movement

Memlets are validated to ensure correct connections between node types and proper type usage.

Constructor & Destructor Documentation

◆ Memlet()

sdfg::data_flow::Memlet::Memlet ( const Memlet & memlet)
delete

Member Function Documentation

◆ base_type()

const types::IType & sdfg::data_flow::Memlet::base_type ( ) const

Get the base type of the data.

Returns
Type of the data container being accessed

◆ classof()

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

◆ clone()

std::unique_ptr< Memlet > sdfg::data_flow::Memlet::clone ( size_t element_id,
const graph::Edge & edge,
DataFlowGraph & parent,
DataFlowNode & src,
DataFlowNode & dst ) const

Clone this memlet for graph transformations.

Parameters
element_idNew element identifier
edgeNew graph edge
parentNew parent graph
srcNew source node
dstNew destination node
Returns
Unique pointer to cloned memlet

◆ dst() [1/2]

DataFlowNode & sdfg::data_flow::Memlet::dst ( )

Get the destination node (mutable).

Returns
Mutable reference to destination node

◆ dst() [2/2]

const DataFlowNode & sdfg::data_flow::Memlet::dst ( ) const

Get the destination node (const).

Returns
Const reference to destination node

◆ dst_conn()

const std::string & sdfg::data_flow::Memlet::dst_conn ( ) const

Get the destination connector name.

Returns
Destination connector name ("void" for access nodes)

◆ edge()

const graph::Edge sdfg::data_flow::Memlet::edge ( ) const

Get the graph edge for this memlet.

Returns
The Boost graph edge

◆ get_parent() [1/2]

DataFlowGraph & sdfg::data_flow::Memlet::get_parent ( )

Get the parent dataflow graph (mutable).

Returns
Mutable reference to parent graph

◆ get_parent() [2/2]

const DataFlowGraph & sdfg::data_flow::Memlet::get_parent ( ) const

Get the parent dataflow graph (const).

Returns
Const reference to parent graph

◆ is_dst_pointed_to_write()

bool sdfg::data_flow::Memlet::is_dst_pointed_to_write ( ) const

Contents of dst are used in the address calculation of a memory write.

◆ is_dst_read()

bool sdfg::data_flow::Memlet::is_dst_read ( ) const

Contents of dst are read.

◆ is_dst_write()

bool sdfg::data_flow::Memlet::is_dst_write ( ) const

makes a memory write to dst (itself).

Using dst as pointer is not a write to dst

◆ is_src_address_leak()

bool sdfg::data_flow::Memlet::is_src_address_leak ( ) const

Leaks the address of src or uses it in an address calculation that is returned.

If the result is not DeadCode, somebody else could use it to change src, without using the container

◆ is_src_constant() [1/2]

bool sdfg::data_flow::Memlet::is_src_constant ( double value) const

Check if the source is a constant scalar with the given value.

Parameters
valueValue to check against
Returns
True if the source is a constant scalar with the specified value, false otherwise

◆ is_src_constant() [2/2]

bool sdfg::data_flow::Memlet::is_src_constant ( int64_t value) const

Check if the source is a constant scalar with the given integer value.

Parses the constant exactly as a signed 64-bit integer, avoiding the precision loss of the floating-point overload for large integers.

Parameters
valueValue to check against
Returns
True if the source is a constant scalar with the specified value, false otherwise

◆ is_src_direct_read()

bool sdfg::data_flow::Memlet::is_src_direct_read ( ) const

Memlet returns the contents of src (this is [is_src_read()], excluding that the contents are only used transitively).

◆ is_src_pointed_to_address_leak()

bool sdfg::data_flow::Memlet::is_src_pointed_to_address_leak ( const types::IType & src_type) const

Leaks address of what src points to.

Only valid for when src is a pointer-like

◆ is_src_pointed_to_read()

bool sdfg::data_flow::Memlet::is_src_pointed_to_read ( ) const

Makes a memory read with src-contents as (partial) address.

◆ is_src_read()

bool sdfg::data_flow::Memlet::is_src_read ( ) const

Memlet actually reads src (from memory).

Address calculations with the src as symbol are not reads. If src is local memory,

◆ operator=()

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

◆ replace() [1/2]

void sdfg::data_flow::Memlet::replace ( const symbolic::Expression old_expression,
const symbolic::Expression new_expression )
overridevirtual

Replace symbolic expressions in this memlet.

Parameters
old_expressionExpression to replace
new_expressionReplacement expression

Replaces occurrences in the subset vector & the base type.

Implements sdfg::Element.

◆ replace() [2/2]

void sdfg::data_flow::Memlet::replace ( const symbolic::ExpressionMapping & replacements)
overridevirtual

Reimplemented from sdfg::Element.

◆ result_type()

std::unique_ptr< types::IType > sdfg::data_flow::Memlet::result_type ( const Function & function) const

Compute the result type after applying subset.

Parameters
functionFunction context for type inference
Returns
The inferred result type

◆ set_base_type()

void sdfg::data_flow::Memlet::set_base_type ( const types::IType & base_type)

Set the base type of the data.

Parameters
base_typeNew base type

◆ set_subset()

void sdfg::data_flow::Memlet::set_subset ( const Subset & subset)

Set the data access subset.

Parameters
subsetNew subset vector

◆ src() [1/2]

DataFlowNode & sdfg::data_flow::Memlet::src ( )

Get the source node (mutable).

Returns
Mutable reference to source node

◆ src() [2/2]

const DataFlowNode & sdfg::data_flow::Memlet::src ( ) const

Get the source node (const).

Returns
Const reference to source node

◆ src_conn()

const std::string & sdfg::data_flow::Memlet::src_conn ( ) const

Get the source connector name.

Returns
Source connector name ("void" for access nodes)

◆ subset()

const Subset & sdfg::data_flow::Memlet::subset ( ) const

Get the data access subset.

Returns
Vector of symbolic expressions describing the subset

◆ type()

MemletType sdfg::data_flow::Memlet::type ( ) const

Determine the type of this memlet.

Returns
MemletType indicating the kind of data movement

◆ type_id()

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

Returns the type of the element.

Implements sdfg::Element.

◆ validate()

void sdfg::data_flow::Memlet::validate ( const Function & function) const
overridevirtual

Validate the memlet.

Parameters
functionFunction context for validation
Exceptions
InvalidSDFGExceptionif validation fails

Validates that:

  • Subset dimensions are not null
  • For computational memlets: connects code and access nodes correctly
  • For computational memlets: connector names are valid
  • For computational memlets to tasklets: result type is scalar
  • For reference memlets: destination is an access node with pointer type

Implements sdfg::Element.

◆ sdfg::builder::SDFGBuilder

friend class sdfg::builder::SDFGBuilder
friend

◆ sdfg::builder::StructuredSDFGBuilder


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