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

Method CreatePass

compiler/lib/CodeGen/Elemwise.cpp:89–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected