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

Simple computational operations in the dataflow graph. More...

Go to the source code of this file.

Classes

class  sdfg::data_flow::Tasklet
 Simple computational operation in the dataflow graph. More...

Namespaces

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

Enumerations

enum  sdfg::data_flow::TaskletCode {
  sdfg::data_flow::assign , sdfg::data_flow::fp_neg , sdfg::data_flow::fp_add , sdfg::data_flow::fp_sub ,
  sdfg::data_flow::fp_mul , sdfg::data_flow::fp_div , sdfg::data_flow::fp_rem , sdfg::data_flow::fp_fma ,
  sdfg::data_flow::fp_oeq , sdfg::data_flow::fp_one , sdfg::data_flow::fp_oge , sdfg::data_flow::fp_ogt ,
  sdfg::data_flow::fp_ole , sdfg::data_flow::fp_olt , sdfg::data_flow::fp_ord , sdfg::data_flow::fp_ueq ,
  sdfg::data_flow::fp_une , sdfg::data_flow::fp_ugt , sdfg::data_flow::fp_uge , sdfg::data_flow::fp_ult ,
  sdfg::data_flow::fp_ule , sdfg::data_flow::fp_uno , sdfg::data_flow::int_add , sdfg::data_flow::int_sub ,
  sdfg::data_flow::int_mul , sdfg::data_flow::int_sdiv , sdfg::data_flow::int_srem , sdfg::data_flow::int_udiv ,
  sdfg::data_flow::int_urem , sdfg::data_flow::int_and , sdfg::data_flow::int_or , sdfg::data_flow::int_xor ,
  sdfg::data_flow::int_shl , sdfg::data_flow::int_ashr , sdfg::data_flow::int_lshr , sdfg::data_flow::int_smin ,
  sdfg::data_flow::int_smax , sdfg::data_flow::int_scmp , sdfg::data_flow::int_umin , sdfg::data_flow::int_umax ,
  sdfg::data_flow::int_ucmp , sdfg::data_flow::int_eq , sdfg::data_flow::int_ne , sdfg::data_flow::int_sge ,
  sdfg::data_flow::int_sgt , sdfg::data_flow::int_sle , sdfg::data_flow::int_slt , sdfg::data_flow::int_uge ,
  sdfg::data_flow::int_ugt , sdfg::data_flow::int_ule , sdfg::data_flow::int_ult , sdfg::data_flow::int_abs
}
 Operation codes for tasklet computations. More...

Functions

constexpr size_t sdfg::data_flow::arity (TaskletCode c)
 Get the number of inputs for a tasklet operation.
constexpr bool sdfg::data_flow::is_unsigned (TaskletCode c)
 Check if a tasklet operation is unsigned.
constexpr bool sdfg::data_flow::is_integer (TaskletCode c)
 Check if a tasklet operation is an integer operation.
constexpr bool sdfg::data_flow::is_floating_point (TaskletCode c)
 Check if a tasklet operation is a floating-point operation.

Detailed Description

Simple computational operations in the dataflow graph.

Tasklets represent primitive computational operations like arithmetic, logic, and type conversions. They are the fundamental building blocks for computation in the SDFG dataflow graph.

Key Concepts

Tasklet Operations

Tasklets support various operation types:

  • assign: Direct assignment/copy
  • Floating-point: fp_add, fp_mul, fp_div, fp_neg, fp_fma, etc.
  • Integer: int_add, int_mul, int_and, int_or, int_shl, etc.
  • Comparisons: fp_oeq, int_eq, int_slt, etc.

Type Conversions

The assign operation can represent type conversions when input and output types differ:

  • zext: Zero extend (unsigned to larger)
  • sext: Sign extend (signed to larger)
  • trunc: Truncate (larger to smaller)
  • fptoui/fptosi: Float to integer
  • uitofp/sitofp: Integer to float
  • fpext/fptrunc: Float precision conversion

Operation Properties

Each operation has:

  • Arity: Number of inputs (1, 2, or 3)
  • Type: Integer, floating-point, or generic
  • Signedness: For integer operations

Example Usage

Creating a simple addition tasklet:

auto& tasklet = builder.add_tasklet(
state,
TaskletCode::fp_add, // operation
"_out", // output connector
{"_in1", "_in2"} // input connectors
);

Creating an assignment/conversion:

auto& tasklet = builder.add_tasklet(
state,
TaskletCode::assign,
"_out",
{"_in"}
);
// If input and output types differ, this becomes a type conversion

Querying tasklet properties:

TaskletCode code = tasklet.code();
bool is_cast = tasklet.is_cast(function);
bool is_trivial = tasklet.is_trivial(function);
size_t num_inputs = arity(code);
See also
CodeNode for the base class
LibraryNode for complex operations
DataFlowNode for node interface