-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
As the title says, triton-to-linalg convert tt.func use walk rather than conversion pattern.
triton-shared/lib/Conversion/TritonToLinalg/TritonToLinalgPass.cpp
Lines 187 to 215 in 2b728ad
| // Convert tt.func and tt.return into func's counterparts | |
| moduleOp.walk([&](triton::FuncOp func) { | |
| OpBuilder builder(func); | |
| auto name = func.getName(); | |
| auto type = func.getFunctionType(); | |
| SmallVector<DictionaryAttr> argAttrs, resAttrs; | |
| func.getAllArgAttrs(argAttrs); | |
| func.getAllResultAttrs(resAttrs); | |
| auto funcFunc = builder.create<func::FuncOp>(func.getLoc(), name, type); | |
| funcFunc.setAllArgAttrs(argAttrs); | |
| funcFunc.setAllResultAttrs(resAttrs); | |
| auto &funcFuncBody = funcFunc.getBody(); | |
| auto &funcBody = func.getBody(); | |
| IRMapping map; | |
| funcBody.cloneInto(&funcFuncBody, map); | |
| for (Block &block : funcFuncBody.getBlocks()) { | |
| auto term = block.getTerminator(); | |
| builder.setInsertionPoint(term); | |
| builder.create<func::ReturnOp>(func.getLoc(), term->getOperands()); | |
| term->erase(); | |
| } | |
| func.erase(); | |
| }); |
Metadata
Metadata
Assignees
Labels
No labels