1 //===- Passes.h - Quantization Passes ------ --------------------*- C++ -*-===//
2 //
3 // Part of the LLVM 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 all of the passes owned by the quantization dialect. As
10 // things mature, it is expected that passes specific to certain frontend or
11 // backend dialects will move to those dialects directly. For now, they are
12 // incubated here.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef MLIR_DIALECT_QUANT_PASSES_H
17 #define MLIR_DIALECT_QUANT_PASSES_H
18 
19 #include "mlir/Pass/Pass.h"
20 
21 namespace mlir {
22 namespace quant {
23 
24 /// Creates a pass that converts quantization simulation operations (i.e.
25 /// FakeQuant and those like it) to casts into/out of supported QuantizedTypes.
26 std::unique_ptr<OperationPass<FuncOp>> createConvertSimulatedQuantPass();
27 
28 /// Creates a pass that converts constants followed by a qbarrier to a
29 /// constant whose value is quantized. This is typically one of the last
30 /// passes done when lowering to express actual quantized arithmetic in a
31 /// low level representation. Because it modifies the constant, it is
32 /// destructive and cannot be undone.
33 std::unique_ptr<OperationPass<FuncOp>> createConvertConstPass();
34 
35 //===----------------------------------------------------------------------===//
36 // Registration
37 //===----------------------------------------------------------------------===//
38 
39 /// Generate the code for registering passes.
40 #define GEN_PASS_REGISTRATION
41 #include "mlir/Dialect/Quant/Passes.h.inc"
42 
43 } // namespace quant
44 } // namespace mlir
45 
46 #endif // MLIR_DIALECT_QUANT_PASSES_H
47