docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
library_node.h
Go to the documentation of this file.
1
44
45#pragma once
46
47#include <optional>
48#include <string>
49#include <vector>
50
53#include "sdfg/graph/graph.h"
55
56namespace sdfg {
57
58namespace builder {
59class SDFGBuilder;
61} // namespace builder
62
63namespace data_flow {
64
66
76
85
89 std::vector<std::vector<std::vector<int64_t>>> lanes;
90};
91
106class LibraryNode : public CodeNode {
109
110protected:
113
115
129 size_t element_id,
130 const DebugInfo& debug_info,
131 const graph::Vertex vertex,
132 DataFlowGraph& parent,
133 const LibraryNodeCode& code,
134 const std::vector<std::string>& outputs,
135 const std::vector<std::string>& inputs,
136 const bool side_effect,
138 );
139
140public:
141 LibraryNode(const LibraryNode& data_node) = delete;
143
144 virtual ~LibraryNode() = default;
145
146 ElementType type_id() const override {
148 }
149
150 static bool classof(const Element& element) {
151 return element.type_id() == ElementType::LibraryNode;
152 }
153
158 const LibraryNodeCode& code() const;
159
165
172 [[deprecated("use set_implementationtype(impl_type)")]]
174
176
181 [[nodiscard]] bool side_effect() const override;
182
187 virtual std::string toStr() const;
188
193 virtual symbolic::SymbolSet symbols() const = 0;
194
199 virtual symbolic::Expression flop() const;
200
206 virtual PointerAccessType pointer_access_type(int input_idx) const {
207 return nullptr;
208 }
209
211
219 virtual bool relocalize_operand(int input_idx, const math::tensor::TensorLayout& packed) {
220 return false;
221 }
222
224 virtual bool can_relocalize_operand(int input_idx, const math::tensor::TensorLayout& packed) const {
225 return false;
226 }
227
229 virtual std::optional<SubgroupAccess> operand_access(int input_idx, unsigned subgroup_size) const {
230 return std::nullopt;
231 }
233
235
236 bool pointer_use_creates_side_effects(const DataFlowGraph& dataflow, const Function& func);
237};
238
239} // namespace data_flow
240} // namespace sdfg
Definition element.h:30
Element(size_t element_id, const DebugInfo &debug_info)
size_t element_id() const
const DebugInfo & debug_info() const
virtual ElementType type_id() const =0
Returns the type of the element.
Definition function.h:43
Definition exceptions.h:28
Definition sdfg_builder.h:13
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
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 > & outputs() const
Get output connector names (const).
const std::vector< std::string > & inputs() const
Get input connector names (const).
Definition data_flow_graph.h:29
graph::Vertex vertex() const
Get the graph vertex for this node.
virtual symbolic::Expression flop() const
Calculate floating point operations for this node.
virtual std::string toStr() const
Convert node to string representation.
bool side_effect_
Whether this node has side effects.
Definition library_node.h:112
virtual ~LibraryNode()=default
void set_implementation_type(const ImplementationType &impl_type)
virtual std::optional< SubgroupAccess > operand_access(int input_idx, unsigned subgroup_size) const
The elements one subgroup of subgroup_size lanes reads from the operand at input_idx,...
Definition library_node.h:229
LibraryNode & operator=(const LibraryNode &)=delete
LibraryNodeCode code_
Operation identifier (e.g., "GEMM", "Add").
Definition library_node.h:111
virtual bool relocalize_operand(int input_idx, const math::tensor::TensorLayout &packed)
Repoint the operand at input_idx to a locally staged buffer.
Definition library_node.h:219
virtual symbolic::SymbolSet symbols() const =0
Get all symbols used in this node.
const LibraryNodeCode & code() const
Get the operation code.
static bool classof(const Element &element)
Definition library_node.h:150
ImplementationType implementation_type_
How to implement this node.
Definition library_node.h:114
LibraryNode(const LibraryNode &data_node)=delete
ElementType type_id() const override
Returns the type of the element.
Definition library_node.h:146
const ImplementationType & implementation_type() const
Get the implementation type (const).
EdgeRemoveOption can_remove_in_edge(const data_flow::DataFlowGraph &graph, const Memlet *memlet) const override
LibraryNode(size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, DataFlowGraph &parent, const LibraryNodeCode &code, const std::vector< std::string > &outputs, const std::vector< std::string > &inputs, const bool side_effect, const ImplementationType &implementation_type)
Protected constructor for library nodes.
PointerAccessType pointer_access_type(const Memlet &edge) const
EdgeRemoveOption can_remove_out_edge(const data_flow::DataFlowGraph &graph, const Memlet *memlet) const override
Is the edge in question removable, or will this make the node its an output on invalid?
bool side_effect() const override
Check if this node has side effects.
virtual PointerAccessType pointer_access_type(int input_idx) const
Describes what a pointer is used for.
Definition library_node.h:206
virtual bool can_relocalize_operand(int input_idx, const math::tensor::TensorLayout &packed) const
Side-effect-free predicate mirroring relocalize_operand: whether the operand at input_idx can be repo...
Definition library_node.h:224
bool pointer_use_creates_side_effects(const DataFlowGraph &dataflow, const Function &func)
ImplementationType & implementation_type()
Get the implementation type (mutable).
Edge in the dataflow graph representing data movement.
Definition memlet.h:131
The metadata associated with a addressing a tensor in elements Meant to be used with TensorNodes to d...
Definition tensor_layout.h:20
Base class for computational nodes in the dataflow graph.
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
Definition function_builder.h:10
Definition access_node.h:67
StringEnum ImplementationType
Implementation type identifier for library nodes.
Definition library_node.h:75
EdgeRemoveOption
Definition data_flow_node.h:71
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
Definition graph.h:22
boost::graph_traits< Graph >::vertex_descriptor Vertex
Definition graph.h:25
Definition analysis.h:7
ElementType
Definition element.h:72
@ LibraryNode
Definition element.h:78
The operand elements one subgroup touches in a single access: for every lane, the operand coordinates...
Definition library_node.h:88
std::vector< std::vector< std::vector< int64_t > > > lanes
Definition library_node.h:89
Symbolic system for integer-based symbol analysis.