82 std::vector<symbolic::Expression>
shape_;
102 const std::vector<symbolic::Expression>&
shape,
103 const std::string& modified_tensor_conn,
104 const std::vector<std::string>& tensor_inputs,
109 static std::vector<std::string>
174 const std::vector<symbolic::Expression>&
shape()
const {
184 static std::pair<structured_control_flow::Sequence*, std::vector<symbolic::Expression>>
add_eltwise_scope(
188 const std::vector<symbolic::Expression>&
shape
191 static std::unique_ptr<types::IType>
access_type(
const std::pair<types::PrimitiveType, const TensorLayout*>& pair);
197 const std::pair<types::PrimitiveType, const TensorLayout*>& src_type,
199 const std::vector<symbolic::Expression>& eltwise_subset,
200 std::unordered_map<const data_flow::AccessNode*, data_flow::AccessNode*>& new_node_mapping
209 const std::vector<symbolic::Expression>& eltwise_subset
243 std::vector<ElementInput>& needed_inputs,
250 const std::string& prefix,
260 std::vector<symbolic::Expression>
shape;
278 T>(parent, base.
debug_info, base.shape, base.quantization));
Dispatchers for dataflow blocks and library nodes.
size_t element_id() const
const DebugInfo & debug_info() const
Note: Even though the class references unique_ptr, it will never delete an SDFG it has a reference to...
Definition structured_sdfg_builder.h:44
Node representing access to a data container in the dataflow graph.
Definition access_node.h:84
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.
const std::vector< std::string > & inputs() const
Get input connector names (const).
std::vector< std::string > inputs_
Names of input connectors.
Definition code_node.h:94
Definition data_flow_graph.h:29
graph::Vertex vertex() const
Get the graph vertex for this node.
const DataFlowGraph & get_parent() const
Get the parent dataflow graph (const).
Base class for all library nodes in the dataflow graph.
Definition library_node.h:106
const LibraryNodeCode & code() const
Get the operation code.
Definition elementwise_node.h:255
BaseDeser deserialize_base_values(const nlohmann::json &j)
nlohmann::json serialize(const data_flow::LibraryNode &library_node) override
Serialize a library node to JSON.
Defined by each element of the output tensor (defined by shape) can be defined independently of any o...
Definition elementwise_node.h:79
void validate_all_input_tensors(const data_flow::DataFlowGraph &graph) const
ElementWiseDataflowTensorNode(size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, const data_flow::LibraryNodeCode &code, const std::vector< symbolic::Expression > &shape, const std::string &modified_tensor_conn, const std::vector< std::string > &tensor_inputs, QuantizationType quantization=QUANTIZATION_MATCH_INPUTS, const data_flow::ImplementationType &impl_type=data_flow::ImplementationType_NONE)
QuantizationType fixed_quantization_
Definition elementwise_node.h:81
void set_fixed_quantization(const QuantizationType quant)
static bool create_input(builder::StructuredSDFGBuilder &builder, structured_control_flow::Block &block, const data_flow::AccessNode &org_src, const std::pair< types::PrimitiveType, const TensorLayout * > &src_type, const ElementInput &needed_input, const std::vector< symbolic::Expression > &eltwise_subset, std::unordered_map< const data_flow::AccessNode *, data_flow::AccessNode * > &new_node_mapping)
virtual int mandatory_input_count() const
How many inputs, starting with 0 are optional?
Definition elementwise_node.h:132
void validate(const Function &function) const override
Validate the code node's configuration.
static std::pair< structured_control_flow::Sequence *, std::vector< symbolic::Expression > > add_eltwise_scope(builder::StructuredSDFGBuilder &builder, const DebugInfo &scope_deb_info, Sequence &parent, const std::vector< symbolic::Expression > &shape)
virtual int tensor_input_count() const
How many inputs, starting with 0 are full tensors?
Definition elementwise_node.h:120
data_flow::PointerAccessType pointer_access_type(int input_idx) const override
Describes what a pointer is used for.
symbolic::SymbolSet symbols() const override
Get all symbols used in this node.
QuantizationType quantization(const data_flow::DataFlowGraph &dataflow) const
type of the math calculations.
data_flow::AccessNode & create_tmp_access_node(builder::StructuredSDFGBuilder &builder, structured_control_flow::Block &block, const std::string &prefix, const types::IType &type) const
void replace(const symbolic::ExpressionMapping &replacements) override
static void create_output(builder::StructuredSDFGBuilder &builder, structured_control_flow::Block &block, const data_flow::AccessNode &org_dst, const types::Tensor &dst_type, const ElementOutput &provided_output, const std::vector< symbolic::Expression > &eltwise_subset)
void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
std::optional< QuantizationType > uniform_quantization(const data_flow::DataFlowGraph &dataflow) const
Same result as quantization if it matches all the inputs.
QuantizationType fixed_quantization() const
configuration of the type for the math calculations, independent of current input types etc.
virtual void validate_non_tensor_inputs(const data_flow::DataFlowGraph &graph) const
by default, everything after the tensors is mandated to be scalar.
QuantizationType quantization() const
Definition elementwise_node.h:136
const std::vector< symbolic::Expression > & shape() const
Get the tensor shape.
Definition elementwise_node.h:174
void validate_target_tensor(const data_flow::DataFlowGraph &graph) const
static std::unique_ptr< types::IType > access_type(const std::pair< types::PrimitiveType, const TensorLayout * > &pair)
static std::vector< std::string > build_input_conns(const std::string &modified_tensor_conn, const std::vector< std::string > &inputs)
std::vector< symbolic::Expression > shape_
Logical tensor shape.
Definition elementwise_node.h:82
passes::LibNodeExpander::ExpandOutcome expand(passes::LibNodeExpander::ExpandContext &context, structured_control_flow::Block &block) override
Expand into map with linearized indexing.
virtual ElementOutput expand_operation_dataflow(builder::StructuredSDFGBuilder &builder, structured_control_flow::Block &block, std::vector< ElementInput > &needed_inputs, types::PrimitiveType expected_type)=0
Models the pure dataflow of the operation as applied to each element of the output as a function of t...
Definition elementwise_node.h:269
data_flow::LibraryNode & deserialize(const nlohmann::json &j, builder::StructuredSDFGBuilder &builder, structured_control_flow::Block &parent) override
Deserialize a library node from JSON.
Definition elementwise_node.h:271
TensorNode(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 &impl_type)
Construct a tensor node.
Definition lib_node_expander.h:122
Base class for library node serialization.
Definition json_serializer.h:195
A control flow node representing a basic block with dataflow computations.
Definition block.h:42
A sequential container of control flow nodes.
Definition sequence.h:52
Abstract base interface for all types in the sdfglib type system.
Definition type.h:625
SymEngine::RCP< const SymEngine::Basic > Expression
Reference-counted pointer to a symbolic expression (SymEngine Basic).
Definition symbolic.h:83
std::set< Symbol, SymEngine::RCPBasicKeyLess > SymbolSet
Ordered set of symbols.
Definition symbolic.h:95
SymEngine::map_basic_basic ExpressionMapping
Definition symbolic.h:109
Definition function_builder.h:10
StringEnum ImplementationType
Implementation type identifier for library nodes.
Definition library_node.h:75
StringEnum LibraryNodeCode
Definition library_node.h:65
ImplementationType ImplementationType_NONE
Default implementation type indicating no specific implementation.
Definition library_node.h:84
std::unique_ptr< PointerAccessMeta, PtrAccessDeleter > PointerAccessType
Definition pointer_metadata.h:32
boost::graph_traits< Graph >::vertex_descriptor Vertex
Definition graph.h:25
Definition arange_node.h:8
constexpr QuantizationType QUANTIZATION_MATCH_INPUTS
Definition tensor_node.h:27
types::PrimitiveType QuantizationType
Definition tensor_node.h:26
Definition batched_gemm_node.h:12
PrimitiveType
Enumeration of all primitive data types supported by sdfglib.
Definition type.h:35
@ Void
Void type (0 bits).
Definition type.h:36
Definition elementwise_node.h:259
DebugInfo debug_info
Definition elementwise_node.h:262
QuantizationType quantization
Definition elementwise_node.h:261
std::vector< symbolic::Expression > shape
Definition elementwise_node.h:260
Definition elementwise_node.h:85
int output_conn_index
Definition elementwise_node.h:87
types::PrimitiveType type
Definition elementwise_node.h:88
CodeNode * producer
Definition elementwise_node.h:86
Definition lib_node_expander.h:12
Abstract base class for tensor library nodes.