Skip to content

Commit fcd5871

Browse files
authored
[MLIR][OpenMP] Allow omp.atomic_update in SPMD loops (llvm#98)
1 parent 87ec30c commit fcd5871

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,6 +1543,15 @@ Operation *TargetOp::getInnermostCapturedOmpOp() {
15431543

15441544
bool TargetOp::isTargetSPMDLoop() {
15451545
Operation *capturedOp = getInnermostCapturedOmpOp();
1546+
1547+
// Allow an omp.atomic_update to be captured inside of the loop and still
1548+
// consider the parent omp.target operation to be potentially defining an SPMD
1549+
// loop.
1550+
// TODO: Potentially accept other captured OpenMP dialect operations as well,
1551+
// if they are allowed inside of an SPMD loop.
1552+
if (isa_and_present<AtomicUpdateOp>(capturedOp))
1553+
capturedOp = capturedOp->getParentOp();
1554+
15461555
if (!isa_and_present<LoopNestOp>(capturedOp))
15471556
return false;
15481557

0 commit comments

Comments
 (0)