MCPcopy Create free account
hub / github.com/MegEngine/MegCC / CreatePass

Method CreatePass

compiler/lib/CodeGen/Matmul.cpp:82–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void MatmulKernel::CreatePass(
83 mlir::PassManager& pm, mlir::MLIRContext* ctx, TContext* context) const {
84 tosa::addTosaToLinalgPasses(pm);
85 //! used to do complex math with some simple operations
86 pm.addNestedPass<FuncOp>(arith::createArithmeticExpandOpsPass());
87 //! below pass not used for dynamic shape, and not divisible
88 //! pm.addNestedPass<FuncOp>(createLinalgTilingPass({4, 16, 1}));
89
90 //! Linalg To Loops, may not used in gpu
91 pm.addNestedPass<FuncOp>(createConvertLinalgToLoopsPass());
92 //! Loops to CFG
93 pm.addNestedPass<FuncOp>(createLowerToCFGPass());
94 //! std optimize
95 pm.addNestedPass<FuncOp>(createCanonicalizerPass());
96 pm.addNestedPass<FuncOp>(createCSEPass());
97 //! check only memref is used
98 pm.addNestedPass<FuncOp>(bufferization::createFinalizingBufferizePass());
99 //! memref to llvm
100 pm.addPass(createMemRefToLLVMPass());
101 //! arith to llvm
102 pm.addNestedPass<FuncOp>(arith::createConvertArithmeticToLLVMPass());
103 LowerToLLVMOptions std2llvm_opt(ctx);
104 std2llvm_opt.emitCWrappers = true;
105 //! std to llvm with emit-c
106 pm.addPass(createLowerToLLVMPass(std2llvm_opt));
107 //! remove all unsupported ir
108 pm.addPass(createReconcileUnrealizedCastsPass());
109}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected