1 //===- FxpMathConfig.h - Reference fixed point config -----------*- C++ -*-===//
2 //
3 // Part of the MLIR Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines a TargetConfiguration for reference fixed-point math
10 // quantization scheme based on the FxpMathOps (plus a small category of
11 // extension ops that can be added from other dialects).
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef MLIR_QUANTIZER_CONFIGURATIONS_FXPMATHCONFIG_H
16 #define MLIR_QUANTIZER_CONFIGURATIONS_FXPMATHCONFIG_H
17 
18 #include "mlir/Quantizer/Support/Configuration.h"
19 #include "mlir/Quantizer/Support/Metadata.h"
20 
21 namespace mlir {
22 namespace quantizer {
23 
24 /// Target configuration for a reference affine/fixed-point quantization
25 /// scheme defined in terms of the FxpMathOps dialect. This can be extended
26 /// with select ops from other dialects by way of the following public
27 /// methods:
28 ///   - addValueIdentityOp
29 class FxpMathTargetConfig : public TargetConfiguration {
30 public:
31   /// Creates an FxpMathTargetConfig instance which can be further customized.
32   static std::unique_ptr<FxpMathTargetConfig> create(SolverContext &context);
33 
34 protected:
FxpMathTargetConfig(SolverContext & context)35   FxpMathTargetConfig(SolverContext &context) : TargetConfiguration(context) {}
36 };
37 
38 } // namespace quantizer
39 } // namespace mlir
40 
41 #endif // MLIR_QUANTIZER_CONFIGURATIONS_FXPMATHCONFIG_H
42