docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
ozaki_matmul_node.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5
12
13namespace sdfg {
14namespace fp_math {
15
17
30 types::PrimitiveType element_;
31 int slices_;
32
33public:
34 static constexpr size_t Y_INPUT_IDX = 0;
35 static constexpr size_t A_INPUT_IDX = 1;
36 static constexpr size_t SCALES_INPUT_IDX = 2;
37 static constexpr size_t FIRST_SLICE_INPUT_IDX = 3;
38
40 size_t element_id,
41 const DebugInfo& debug_info,
47 int slices,
49 );
50
52 return layout_a_;
53 }
55 return layout_y_;
56 }
58 return element_;
59 }
60 int slices() const {
61 return slices_;
62 }
63
67
68 void validate(const Function& function) const override;
69
70 symbolic::SymbolSet symbols() const override;
71
72 void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override;
73 void replace(const symbolic::ExpressionMapping& replacements) override;
74
75 std::unique_ptr<data_flow::DataFlowNode>
76 clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const override;
77
78 std::string toStr() const override;
79
81};
82
84public:
85 nlohmann::json serialize(const data_flow::LibraryNode& library_node) override;
88 ) override;
89};
90
102
105
106} // namespace fp_math
107} // namespace sdfg
Definition element.h:30
size_t element_id() const
const DebugInfo & debug_info() const
Definition function.h:43
Definition analysis.h:53
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
OzakiMatMulExpander()
Definition ozaki_matmul_node.h:93
passes::LibNodeExpander::ExpandOutcome handle_expand(passes::LibNodeExpander::ExpandContext &context, structured_control_flow::Block &block, OzakiMatMulNode &node) const override
Definition ozaki_matmul_node.h:83
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.
Y = A @ B with B given as its Ozaki slices, prepared once for many products, e.g.
Definition ozaki_matmul_node.h:27
const math::tensor::TensorLayout & layout_y() const
Definition ozaki_matmul_node.h:54
static constexpr size_t SCALES_INPUT_IDX
Definition ozaki_matmul_node.h:36
symbolic::Expression k() const
OzakiMatMulNode(size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, const math::tensor::TensorLayout &layout_a, const math::tensor::TensorLayout &layout_y, types::PrimitiveType element, int slices, const data_flow::ImplementationType &impl_type=data_flow::ImplementationType_NONE)
void replace(const symbolic::ExpressionMapping &replacements) override
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.
symbolic::Expression n() const
symbolic::Expression m() const
void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
void validate(const Function &function) const override
Validate the code node's configuration.
const math::tensor::TensorLayout & layout_a() const
Definition ozaki_matmul_node.h:51
types::PrimitiveType element() const
Definition ozaki_matmul_node.h:57
static constexpr size_t Y_INPUT_IDX
Definition ozaki_matmul_node.h:34
std::string toStr() const override
Convert node to string representation.
symbolic::SymbolSet symbols() const override
Get all symbols used in this node.
data_flow::PointerAccessType pointer_access_type(int input_idx) const override
Describes what a pointer is used for.
static constexpr size_t FIRST_SLICE_INPUT_IDX
Definition ozaki_matmul_node.h:37
static constexpr size_t A_INPUT_IDX
Definition ozaki_matmul_node.h:35
int slices() const
Definition ozaki_matmul_node.h:60
The metadata associated with a addressing a tensor in elements Meant to be used with TensorNodes to d...
Definition tensor_layout.h:20
Definition lib_node_expander.h:191
CodeLibNodeExpander(const data_flow::LibraryNodeCode &code)
Definition lib_node_expander.h:195
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
Library node definitions for calling functions beyond simple instructions.
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
Definition kernel_builder.h:18
data_flow::LibraryNodeCode LibraryNodeType_OzakiMatMul("fp::OzakiMatMul")
bool expand_ozaki_matmuls(builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager)
Expands every OzakiMatMul node of the SDFG into the slicing of A, the Int8 MatMuls and the rescaling;...
boost::graph_traits< Graph >::vertex_descriptor Vertex
Definition graph.h:25
PrimitiveType
Enumeration of all primitive data types supported by sdfglib.
Definition type.h:35
Definition analysis.h:7
Definition lib_node_expander.h:12