docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
quantize_contraction.h
Go to the documentation of this file.
1#pragma once
2
3#include <nlohmann/json_fwd.hpp>
4#include <string>
5
10
11namespace sdfg {
12namespace fp_math {
13
15enum class Rescaling {
22};
23
42private:
44 int bits_;
45 Rescaling rescaling_;
46
47public:
49
50 virtual std::string name() const override;
51
52 virtual bool
54
55 virtual void apply(builder::StructuredSDFGBuilder& builder, analysis::AnalysisManager& analysis_manager) override;
56
57 virtual void to_json(nlohmann::json& j) const override;
58
60
61 int bits() const {
62 return bits_;
63 }
64
66 return rescaling_;
67 }
68};
69
70} // namespace fp_math
71} // namespace sdfg
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
Base class for all library nodes in the dataflow graph.
Definition library_node.h:106
virtual std::string name() const override
Get the name of this transformation.
virtual void to_json(nlohmann::json &j) const override
Serialize this transformation to JSON.
static QuantizeContraction from_json(builder::StructuredSDFGBuilder &builder, const nlohmann::json &j)
int bits() const
Definition quantize_contraction.h:61
Rescaling rescaling() const
Definition quantize_contraction.h:65
QuantizeContraction(data_flow::LibraryNode &node, int bits=8, Rescaling rescaling=Rescaling::Exponents)
virtual bool can_be_applied(builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager) override
Check if this transformation can be safely applied.
virtual void apply(builder::StructuredSDFGBuilder &builder, analysis::AnalysisManager &analysis_manager) override
Apply this transformation to the SDFG.
Base class for all SDFG transformations.
Definition transformation.h:25
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
@ Direct
Multiplied by s_A[i] / q and then s_B[j] / q, which needs nothing beyond multiplication but overflows...
Definition quantize_contraction.h:21
Definition analysis.h:7