1 //===- Passes.h - Quantizer passes -----------------------------*- 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 entry points to create passes to perform various kinds 10 // of quantization related transforms. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef MLIR_QUANTIZER_TRANSFORMS_PASSES_H 15 #define MLIR_QUANTIZER_TRANSFORMS_PASSES_H 16 17 #include "mlir/Pass/Pass.h" 18 19 namespace mlir { 20 namespace quantizer { 21 22 class SolverContext; 23 class TargetConfiguration; 24 25 /// Creates a pass that infers quantized types based on metadata discovered 26 /// in the computation. 27 std::unique_ptr<OpPassBase<ModuleOp>> 28 createInferQuantizedTypesPass(SolverContext &solverContext, 29 const TargetConfiguration &config); 30 31 /// Creates a pass which removes any instrumentation and hint ops which have 32 /// no effect on final runtime. 33 std::unique_ptr<OpPassBase<FuncOp>> createRemoveInstrumentationPass(); 34 35 /// Adds default (dummy) statistics to ops that can benefit from runtime stats. 36 /// Meant for testing. 37 std::unique_ptr<OpPassBase<FuncOp>> createAddDefaultStatsPass(); 38 39 } // namespace quantizer 40 } // namespace mlir 41 42 #endif // MLIR_QUANTIZER_TRANSFORMS_PASSES_H 43