CIRCT  19.0.0git
ArcInterfaces.h
Go to the documentation of this file.
1 //===- ArcInterfaces.h ------------------------------------------*- 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 provides registration functions for all external interfaces.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef CIRCT_DIALECT_ARC_ARCINTERFACES_H
14 #define CIRCT_DIALECT_ARC_ARCINTERFACES_H
15 
16 #include "mlir/IR/DialectInterface.h"
17 
18 // Forward declarations.
19 namespace mlir {
20 class DialectRegistry;
21 } // namespace mlir
22 
23 namespace circt {
24 namespace arc {
25 
26 void registerCombRuntimeCostEstimateInterface(mlir::DialectRegistry &registry);
27 void registerHWRuntimeCostEstimateInterface(mlir::DialectRegistry &registry);
28 void registerSCFRuntimeCostEstimateInterface(mlir::DialectRegistry &registry);
29 
30 inline void initAllExternalInterfaces(mlir::DialectRegistry &registry) {
34 }
35 
36 /// A dialect interface to get runtime cost estimates of MLIR operations. This
37 /// is useful for implementing heuristics in optimization passes.
39  : public mlir::DialectInterface::Base<RuntimeCostEstimateDialectInterface> {
40 public:
41  RuntimeCostEstimateDialectInterface(mlir::Dialect *dialect) : Base(dialect) {}
42 
43  /// Returns a number indicating the expected number of cycles the given
44  /// operation will take to execute on hardware times 10 (to allow a bit more
45  /// fine tuning for high-throughput operations)
46  virtual uint32_t getCostEstimate(mlir::Operation *op) const = 0;
47 };
48 
49 } // namespace arc
50 } // namespace circt
51 
52 #endif // CIRCT_DIALECT_ARC_ARCINTERFACES_H
A dialect interface to get runtime cost estimates of MLIR operations.
Definition: ArcInterfaces.h:39
virtual uint32_t getCostEstimate(mlir::Operation *op) const =0
Returns a number indicating the expected number of cycles the given operation will take to execute on...
RuntimeCostEstimateDialectInterface(mlir::Dialect *dialect)
Definition: ArcInterfaces.h:41
void initAllExternalInterfaces(mlir::DialectRegistry &registry)
Definition: ArcInterfaces.h:30
void registerCombRuntimeCostEstimateInterface(mlir::DialectRegistry &registry)
void registerSCFRuntimeCostEstimateInterface(mlir::DialectRegistry &registry)
void registerHWRuntimeCostEstimateInterface(mlir::DialectRegistry &registry)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21