[llvm-branch-commits] [mlir] [flang] [mlir][flang][openmp] Rework wsloop reduction operations (PR #80019)
Tom Eccles via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Feb 5 05:53:30 PST 2024
================
@@ -398,11 +400,39 @@ struct ParallelOpLowering : public OpRewritePattern<scf::ParallelOp> {
// Replace the reduction operations contained in this loop. Must be done
// here rather than in a separate pattern to have access to the list of
// reduction variables.
+ unsigned int reductionIndex = 0;
for (auto [x, y] :
llvm::zip_equal(reductionVariables, reduce.getOperands())) {
OpBuilder::InsertionGuard guard(rewriter);
rewriter.setInsertionPoint(reduce);
- rewriter.create<omp::ReductionOp>(reduce.getLoc(), y, x);
+ Region &redRegion =
+ ompReductionDecls[reductionIndex].getReductionRegion();
+ assert(redRegion.hasOneBlock() &&
+ "expect reduction region to have one block");
----------------
tblah wrote:
Please could you add a comment explaining why a reduction region must have only one block, or adding a TODO for multiple blocks.
https://github.com/llvm/llvm-project/pull/80019
More information about the llvm-branch-commits
mailing list