Skip to content

Commit 3385a4a

Browse files
committed
Add todo for cancelling a taskloop
No unit test can be written for this todo because there is no support at all for lowering taskloop.
1 parent 5e1a9a0 commit 3385a4a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,22 @@ static LogicalResult checkImplementationStatus(Operation &op) {
158158
if (op.getBare())
159159
result = todo("ompx_bare");
160160
};
161+
auto checkCancelDirective = [&todo](auto op, LogicalResult &result) {
162+
omp::ClauseCancellationConstructType cancelledDirective =
163+
op.getCancelDirective();
164+
// Cancelling a taskloop is not yet supported because we don't yet have LLVM
165+
// IR conversion for taskloop
166+
if (cancelledDirective == omp::ClauseCancellationConstructType::Taskgroup) {
167+
Operation *parent = op->getParentOp();
168+
while (parent) {
169+
if (parent->getDialect() == op->getDialect())
170+
break;
171+
parent = parent->getParentOp();
172+
}
173+
if (isa_and_nonnull<omp::TaskloopOp>(parent))
174+
result = todo("cancel directive inside of taskloop");
175+
}
176+
};
161177
auto checkDepend = [&todo](auto op, LogicalResult &result) {
162178
if (!op.getDependVars().empty() || op.getDependKinds())
163179
result = todo("depend");
@@ -248,6 +264,10 @@ static LogicalResult checkImplementationStatus(Operation &op) {
248264

249265
LogicalResult result = success();
250266
llvm::TypeSwitch<Operation &>(op)
267+
.Case([&](omp::CancelOp op) { checkCancelDirective(op, result); })
268+
.Case([&](omp::CancellationPointOp op) {
269+
checkCancelDirective(op, result);
270+
})
251271
.Case([&](omp::DistributeOp op) {
252272
checkAllocate(op, result);
253273
checkDistSchedule(op, result);

0 commit comments

Comments
 (0)