Skip to content

Commit ec91055

Browse files
committed
Fix One More Comment
1 parent 357cb5d commit ec91055

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

mlir/lib/Dialect/SCF/Transforms/ParallelForToNestedFors.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ namespace mlir {
2121
#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
2222
} // namespace mlir
2323

24+
#define DEBUG_TYPE "parallel-for-to-nested-fors"
2425
using namespace mlir;
2526

2627
FailureOr<scf::LoopNest>
2728
mlir::scf::parallelForToNestedFors(RewriterBase &rewriter,
2829
scf::ParallelOp parallelOp) {
2930

30-
if (!parallelOp.getResults().empty()) {
31-
parallelOp->emitError("Currently scf.parallel to scf.for conversion "
32-
"doesn't support scf.parallel with results.");
33-
return failure();
34-
}
31+
if (!parallelOp.getResults().empty())
32+
return rewriter.notifyMatchFailure(
33+
parallelOp, "Currently scf.parallel to scf.for conversion doesn't "
34+
"support scf.parallel with results.");
3535

3636
rewriter.setInsertionPoint(parallelOp);
3737

@@ -66,11 +66,17 @@ struct ParallelForToNestedFors final
6666
Operation *parentOp = getOperation();
6767
IRRewriter rewriter(parentOp->getContext());
6868

69-
parentOp->walk([&](scf::ParallelOp parallelOp) {
70-
if (failed(scf::parallelForToNestedFors(rewriter, parallelOp))) {
71-
return signalPassFailure();
72-
}
73-
});
69+
parentOp->walk(
70+
[&](scf::ParallelOp parallelOp) {
71+
if (failed(scf::parallelForToNestedFors(rewriter, parallelOp))) {
72+
LLVM_DEBUG(
73+
llvm::dbgs()
74+
<< "Failed to convert scf.parallel to nested scf.for ops for:\n"
75+
<< parallelOp << "\n");
76+
return WalkResult::advance();
77+
}
78+
return WalkResult::advance();
79+
});
7480
}
7581
};
7682
} // namespace

mlir/test/Dialect/SCF/parallel-to-nested-fors.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func.func private @callee(%i: index, %j: index) -> i32
6767

6868
func.func @two_iters_with_reduce(%lb1: index, %lb2: index, %ub1: index, %ub2: index, %step1: index, %step2: index) -> i32 {
6969
%c0 = arith.constant 0 : i32
70-
// expected-error@+1 {{Currently scf.parallel to scf.for conversion doesn't support scf.parallel with results}}
70+
// CHECK: scf.parallel
7171
%0 = scf.parallel (%i, %j) = (%lb1, %lb2) to (%ub1, %ub2) step (%step1, %step2) init (%c0) -> i32 {
7272
%curr = func.call @callee(%i, %j) : (index, index) -> i32
7373
scf.reduce(%curr : i32) {

0 commit comments

Comments
 (0)