17#include "mlir/IR/MLIRContext.h"
18#include "mlir/Pass/Pass.h"
20#define DEBUG_TYPE "arc-print-cost-model"
24#define GEN_PASS_DEF_PRINTCOSTMODEL
25#include "circt/Dialect/Arc/ArcPasses.h.inc"
33struct PrintCostModelPass
34 :
public arc::impl::PrintCostModelBase<PrintCostModelPass> {
35 void runOnOperation()
override;
39void PrintCostModelPass::runOnOperation() {
40 OperationCosts statVars;
41 ArcCostModel arcCostModel;
42 for (
auto moduleOp : getOperation().getOps<
hw::HWModuleOp>()) {
43 moduleOp.walk([&](Operation *op) { statVars += arcCostModel.getCost(op); });
46 moduleCost = statVars.totalCost();
47 packingCost = statVars.packingCost;
48 shufflingCost = statVars.shufflingCost;
49 vectoroizeOpsBodyCost = statVars.vectorizeOpsBodyCost;
50 allVectorizeOpsCost = statVars.packingCost + statVars.shufflingCost +
51 statVars.vectorizeOpsBodyCost;
54std::unique_ptr<Pass> arc::createPrintCostModelPass() {
55 return std::make_unique<PrintCostModelPass>();
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.