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

Mathematical library node base class with expansion support. More...

Go to the source code of this file.

Classes

class  sdfg::math::MathNode
 Base class for mathematical library nodes with expansion support. More...

Namespaces

namespace  sdfg
namespace  sdfg::analysis
namespace  sdfg::builder
namespace  sdfg::math

Detailed Description

Mathematical library node base class with expansion support.

This file defines the MathNode base class for all mathematical library nodes. Math nodes support expansion, which converts high-level mathematical operations into primitive SDFG operations (maps, tasklets, etc.).

Expansion

Expansion is the process of transforming a library node into more primitive operations. For example:

  • A tensor elementwise addition can be expanded into a map with a tasklet
  • A reduction operation can be expanded into nested maps with accumulation

The expansion process is controlled by:

  • The implementation_type field: If set to ImplementationType_NONE, expansion is attempted
  • The expand() method: Subclasses implement the expansion logic

Example

Expanding a tensor operation:

auto& tensor_add = builder.add_library_node<math::tensor::AddNode>(block, debug_info, shape);
analysis::AnalysisManager analysis_manager(sdfg);
if (tensor_add.expand(builder, analysis_manager)) {
// Node was successfully expanded into primitive operations
}
Definition analysis.h:7
See also
math::tensor::ElementWiseUnaryNode for tensor elementwise operations
math::tensor::ReduceNode for tensor reduction operations
math::blas::BLASNode for BLAS operations