docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
arange_node.h
Go to the documentation of this file.
1#pragma once
2
5
6namespace sdfg {
7namespace math {
8namespace tensor {
9
11
22class ArangeNode : public TensorNode {
23private:
24 std::vector<symbolic::Expression> shape_;
25
26public:
28 size_t element_id,
29 const DebugInfo& debug_info,
32 const std::vector<symbolic::Expression>& shape,
34 );
35
36 // In-edge indices: _out is the result buffer pointer (written to); _start, _end, _step are read-only scalar inputs.
37 // All four are modelled as in-edges following the ElementWiseDataflowTensorNode convention.
38 static auto constexpr RESULT_PTR_IDX = 0; // connector: _out
39 static auto constexpr START_IDX = 1; // connector: _start
40 static auto constexpr END_IDX = 2; // connector: _end
41 static auto constexpr STEP_IDX = 3; // connector: _step
42
43 const std::vector<symbolic::Expression>& shape() const;
44
45 void validate(const Function& function) const override;
46
47 symbolic::SymbolSet symbols() const override;
48
49 void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override;
50
51 void replace(const symbolic::ExpressionMapping& replacements) override;
52
53 bool supports_integer_types() const override;
54
57
58 std::unique_ptr<data_flow::DataFlowNode>
59 clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const override;
60
65 virtual symbolic::Expression flop() const override;
66
68};
69
71public:
72 nlohmann::json serialize(const data_flow::LibraryNode& library_node) override;
73
76 ) override;
77};
78
79} // namespace tensor
80} // namespace math
81} // namespace sdfg
Definition element.h:30
size_t element_id() const
const DebugInfo & debug_info() const
Definition function.h:43
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
Definition data_flow_graph.h:29
graph::Vertex vertex() const
Get the graph vertex for this node.
Base class for all library nodes in the dataflow graph.
Definition library_node.h:106
Definition arange_node.h:70
data_flow::LibraryNode & deserialize(const nlohmann::json &j, builder::StructuredSDFGBuilder &builder, structured_control_flow::Block &parent) override
Deserialize a library node from JSON.
nlohmann::json serialize(const data_flow::LibraryNode &library_node) override
Serialize a library node to JSON.
static auto constexpr STEP_IDX
Definition arange_node.h:41
ArangeNode(size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, const std::vector< symbolic::Expression > &shape, const data_flow::ImplementationType &impl_type=data_flow::ImplementationType_NONE)
virtual symbolic::Expression flop() const override
Calculate floating point operations for this node.
data_flow::PointerAccessType pointer_access_type(int input_idx) const override
Describes what a pointer is used for.
void validate(const Function &function) const override
Validates the element.
static auto constexpr END_IDX
Definition arange_node.h:40
static auto constexpr RESULT_PTR_IDX
Definition arange_node.h:38
const std::vector< symbolic::Expression > & shape() const
void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
bool supports_integer_types() const override
Check if this operation supports integer types.
void replace(const symbolic::ExpressionMapping &replacements) override
symbolic::SymbolSet symbols() const override
Get all symbols used in this node.
passes::LibNodeExpander::ExpandOutcome expand(passes::LibNodeExpander::ExpandContext &context, structured_control_flow::Block &block) override
Expand this node into its internal operations.
std::unique_ptr< data_flow::DataFlowNode > clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph &parent) const override
Clone this node for graph transformations.
static auto constexpr START_IDX
Definition arange_node.h:39
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
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
data_flow::LibraryNodeCode LibraryNodeType_Arange("ml::Arange")
Definition batched_gemm_node.h:12
Definition analysis.h:7
Definition lib_node_expander.h:12
Abstract base class for tensor library nodes.