================
@@ -2590,13 +2590,27 @@ convertOmpWsloop(Operation &opInst, llvm::IRBuilderBase 
&builder,
   }
 
   builder.SetInsertPoint(*regionBlock, (*regionBlock)->begin());
+
+  bool noLoopMode = false;
+  omp::TargetOp targetOp = wsloopOp->getParentOfType<mlir::omp::TargetOp>();
+  if (targetOp) {
+    Operation *targetCapturedOp = targetOp.getInnermostCapturedOmpOp();
----------------
skatrak wrote:

Thank you for the clarifications, Dominik.

> Yes. There is assumption in `TargetRegionFlags TargetOp::getKernelExecFlags` 
> which checks if the argument is is the result of calling 
> `getInnermostCapturedOmpOp()`.

What I mean is adding something like this:
```c++
Operation *targetCapturedOp = targetOp.getInnermostCapturedOmpOp();
if (*loopOp == targetCapturedOp) {
  omp::TargetRegionFlags kernelFlags = 
targetOp.getKernelExecFlags(targetCapturedOp);
  ...
}
```
We need that because, if not, `noLoopMode` will also be set to `true` for every 
`omp.wsloop` nested inside of a no-loop SPMD target region, even if that loop 
is not the top-level SPMD one.

https://github.com/llvm/llvm-project/pull/155818
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to