docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
access_node.h File Reference

Access nodes for reading/writing data in the dataflow graph. More...

Go to the source code of this file.

Classes

class  sdfg::data_flow::AccessNode
 Node representing access to a data container in the dataflow graph. More...
class  sdfg::data_flow::ConstantNode
 Node representing a constant literal value in the dataflow graph. More...

Namespaces

namespace  sdfg
namespace  sdfg::builder
namespace  sdfg::data_flow

Detailed Description

Access nodes for reading/writing data in the dataflow graph.

Access nodes represent data access points in the SDFG dataflow graph. They serve as interfaces between the dataflow graph and the function's data containers. Access nodes can represent reads from or writes to variables, arrays, and other data structures.

Key Concepts

AccessNode

An AccessNode represents a reference to a data container in the function. Multiple access nodes can reference the same data container, representing different access points in the dataflow. Access nodes are connected to code nodes (tasklets, library nodes) via memlets that describe the data movement.

ConstantNode

A ConstantNode is a special type of access node that represents a constant literal value. Unlike regular access nodes, constant nodes:

  • Do not reference function variables
  • Cannot have incoming edges
  • Carry their own type information
  • Are validated to ensure the literal matches the type

Example Usage

Creating access nodes for reading and writing:

// Add data containers
types::Scalar float_type(types::PrimitiveType::Float);
builder.add_container("input", float_type);
builder.add_container("output", float_type);
// Create access nodes
auto& read_access = builder.add_access(state, "input");
auto& write_access = builder.add_access(state, "output");
// Connect via a tasklet
auto& tasklet = builder.add_tasklet(state, TaskletCode::assign, "_out", {"_in"});
builder.add_computational_memlet(state, read_access, tasklet, "_in", {});
builder.add_computational_memlet(state, tasklet, "_out", write_access, {});

Creating a constant node:

types::Scalar int_type(types::PrimitiveType::Int32);
auto& constant = builder.add_constant(state, "42", int_type);
See also
DataFlowNode for the base class
Memlet for edge connections
CodeNode for computational nodes