3#include <nlohmann/json_fwd.hpp>
66 static const std::vector<int64_t>&
moduli();
80 virtual std::string
name()
const override;
87 virtual void to_json(nlohmann::json& j)
const override;
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
Base class for all library nodes in the dataflow graph.
Definition library_node.h:106
OzakiVariant variant() const
Definition ozaki_contraction.h:91
int effective_splits() const
The slices or moduli the transformation uses for node, resolving 0 to the default.
static int modular_bits(int moduli, int64_t k)
Bits each of A and B keeps per row or column in the modular variant with moduli and reduction k.
static constexpr int MAX_SLICES
Definition ozaki_contraction.h:63
static constexpr int MAX_MODULI
Definition ozaki_contraction.h:67
static OzakiContraction from_json(builder::StructuredSDFGBuilder &builder, const nlohmann::json &j)
virtual void to_json(nlohmann::json &j) const override
Serialize this transformation to JSON.
virtual void apply(builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager) override
Apply this transformation to the SDFG.
OzakiContraction(data_flow::LibraryNode &node, OzakiVariant variant=OzakiVariant::Modular, int splits=0, Rescaling rescaling=Rescaling::Exponents)
virtual std::string name() const override
Get the name of this transformation.
virtual bool can_be_applied(builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager) override
Check if this transformation can be safely applied.
static const std::vector< int64_t > & moduli()
Odd primes below 256, largest first; the first MAX_MODULI serve as the moduli of the modular variant.
Rescaling rescaling() const
Definition ozaki_contraction.h:95
int matmuls() const
Int8 matmuls the transformation computes.
Library node definitions for calling functions beyond simple instructions.
Definition function_builder.h:10
Definition kernel_builder.h:18
Rescaling
How QuantizeContraction applies the scales of A's rows and B's columns to the Int32 products.
Definition quantize_contraction.h:15
@ Exponents
Through the scales' power-of-two exponents in one step, so that no intermediate overflows where the r...
Definition quantize_contraction.h:18
OzakiVariant
How the Ozaki scheme represents the operands in Int8.
Definition ozaki_contraction.h:17
@ Slicing
Ozaki-I: split each operand into 7-bit slices and sum the s(s+1)/2 leading products of slices.
Definition ozaki_contraction.h:19
@ Modular
Ozaki-II: scale the operands to integers, multiply their residues modulo coprime moduli and reconstru...
Definition ozaki_contraction.h:22