174 [[deprecated(
"Use input_type(), accumulator_type(), output_type() or uniform_quantization() instead")]]
179 [[deprecated(
"Use input_type(), accumulator_type(), output_type() or uniform_quantization() instead")]]
182 [[deprecated(
"Use input_type() instead")]]
185 [[deprecated(
"Use output_type() instead")]]
189 [[deprecated(
"Use types() instead")]]
192 [[deprecated(
"Use set_types(ContractionTypes::uniform(...)) instead")]]
247 std::unique_ptr<data_flow::DataFlowNode>
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
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
MatMulBlasExpander(bool supports_half=false)
Definition matmul_node.h:292
passes::LibNodeExpander::ExpandOutcome handle_expand(passes::LibNodeExpander::ExpandContext &context, structured_control_flow::Block &block, MatMulNode &node) const override
MatMulNaiveExpander()
Definition matmul_node.h:279
passes::LibNodeExpander::ExpandOutcome handle_expand(passes::LibNodeExpander::ExpandContext &context, structured_control_flow::Block &block, MatMulNode &node) const override
Serializer for MatMulNode.
Definition matmul_node.h:268
nlohmann::json serialize(const data_flow::LibraryNode &library_node) override
Serialize a library node to JSON.
data_flow::LibraryNode & deserialize(const nlohmann::json &j, builder::StructuredSDFGBuilder &builder, structured_control_flow::Block &parent) override
Deserialize a library node from JSON.
Tensor matrix multiplication following ONNX MatMul operator specification.
Definition matmul_node.h:84
const TensorLayout & layout_a() const
TensorLayout & layout_b()
Definition matmul_node.h:205
void replace(const symbolic::ExpressionMapping &replacements) override
types::PrimitiveType output_quantization() const
static auto constexpr A_INPUT_IDX
Definition matmul_node.h:133
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.
void set_types(const ContractionTypes &types)
bool can_relocalize_operand(int input_idx, const TensorLayout &packed) const override
Side-effect-free predicate mirroring relocalize_operand: whether the operand at input_idx can be repo...
std::string toStr() const override
Convert node to string representation.
TensorLayout & layout_y()
Definition matmul_node.h:209
symbolic::SymbolSet symbols() const override
Get all symbols used in this node.
void verify_data_types(const data_flow::DataFlowGraph &graph) const override
Called as part of validate.
TensorLayout & layout_a()
Definition matmul_node.h:201
const ContractionTypes & types() const
The configured element types; Void entries are inferred, see input_type(), accumulator_type(),...
bool supports_integer_types() const override
Check if this operation supports integer types.
Definition matmul_node.h:259
void set_fixed_quantization(const QuantizationType quant)
QuantizationType quantization(const data_flow::DataFlowGraph &dataflow) const
const TensorLayout & layout_b() const
symbolic::Expression k() const
Get the K dimension (columns of A, rows of B - contraction dimension).
types::PrimitiveType accumulator_type() const
Element type the products are summed in: configured, or the output type.
types::PrimitiveType input_type() const
Element type of A and B: configured, or inferred from their memlets (Void if they disagree).
symbolic::Expression flop() const override
Calculate floating point operations for this node.
const TensorLayout & layout_y() const
MatMulNode(size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, const TensorLayout &layout_a, const TensorLayout &layout_b, const ContractionTypes &types, const TensorLayout *layout_y=nullptr, const data_flow::ImplementationType &impl_type=data_flow::ImplementationType_NONE)
Construct a matmul node with explicit element types.
static TensorLayout get_linear_result_layout(const TensorLayout &layout_a, const TensorLayout &layout_b)
data_flow::PointerAccessType pointer_access_type(int input_idx) const override
Describes what a pointer is used for.
types::PrimitiveType input_quantization() const
MatMulNode(size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, const TensorLayout &layout_a, const TensorLayout &layout_b, QuantizationType quantization=QUANTIZATION_MATCH_INPUTS, const TensorLayout *layout_y=nullptr, const data_flow::ImplementationType &impl_type=data_flow::ImplementationType_NONE)
Construct a matmul node.
static auto constexpr B_INPUT_IDX
Definition matmul_node.h:134
symbolic::Expression m() const
Get the M dimension (rows of A, rows of output).
void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
static auto constexpr Y_INPUT_IDX
Definition matmul_node.h:132
types::PrimitiveType output_type() const
Element type of Y: configured, or inferred from its memlet.
QuantizationType fixed_quantization() const
The configured type if inputs and output share one (Void otherwise).
static constexpr const char * OPERAND_METADATA_KEY
Metadata key tagging a memlet with the matmul operand it carries ("A", "B", or "Y"),...
Definition matmul_node.h:139
bool relocalize_operand(int input_idx, const TensorLayout &packed) override
Repoint the operand at input_idx to a locally staged buffer.
QuantizationType quantization() const
Definition matmul_node.h:175
void validate(const Function &function) const override
Validate the code node's configuration.
virtual passes::LibNodeExpander::ExpandOutcome expand(passes::LibNodeExpander::ExpandContext &, structured_control_flow::Block &block) override
Expand matmul into nested maps.
symbolic::Expression n() const
Get the N dimension (columns of B, columns of output).
std::optional< types::PrimitiveType > uniform_quantization(const data_flow::DataFlowGraph &dataflow) const
The single type of inputs, accumulator and output, if they all agree.
The metadata associated with a addressing a tensor in elements Meant to be used with TensorNodes to d...
Definition tensor_layout.h:20
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: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
std::vector< Expression > MultiExpression
Vector of symbolic expressions for multi-dimensional operations.
Definition symbolic.h:89
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
data_flow::LibraryNodeCode LibraryNodeType_MatMul("ml::MatMul")
Definition batched_gemm_node.h:12
Definition approximate_math.h:12
PrimitiveType
Enumeration of all primitive data types supported by sdfglib.
Definition type.h:35
Element types of a contraction such as a matmul.
Definition tensor_node.h:36
Definition lib_node_expander.h:12
Symbolic system for integer-based symbol analysis.
Abstract base class for tensor library nodes.