Recently introduced support for converting sequential reduction loops to
CFG of basic blocks in the Standard dialect makes it possible to perform
a staged conversion of parallel reduction loops into a similar CFG by
using sequential loops as an intermediate step. This is already the case
for parallel loops without reduction, so extend the pattern to support
an additional use case.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Thank you for doing that!
mlir/lib/Conversion/LoopToStandard/ConvertLoopToStandard.cpp | ||
---|---|---|
284 | will this work? SmallVector<Value, 4> iterArgs = llvm::to_vector(parallelOp.initVals()); | |
309 | nit: if (first) { // Store the results of the outermost loop that will be used to replace // the results of the parallel loop when it is fully rewritten. loopResults.assign(forOp.result_begin(), forOp.result_end()); first = false; continue; } // A loop is constructed with an empty "yield" terminator by default. // Replace it with another "yield" that forwards the results of the nested // loop to the parent loop. We need to explicitly make sure the new // terminator is the last operation in the block because further transfoms // rely on this. rewriter.setInsertionPointToEnd(rewriter.getInsertionBlock()); rewriter.replaceOpWithNewOp<YieldOp>( rewriter.getInsertionBlock()->getTerminator(), forOp.getResults()); |
mlir/lib/Dialect/LoopOps/LoopOps.cpp | ||
---|---|---|
67 | You should be able to do do: result.addTypes(iterArgs.getTypes()) |
will this work?