[Mlir-commits] [clang] [llvm] [mlir] [Flang][OpenMP] Enable no-loop kernels (PR #155818)

Sergio Afonso llvmlistbot at llvm.org
Fri Aug 29 08:12:48 PDT 2025


================
@@ -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:

Should we check here that the captured op is the `omp.loop_nest` wrapped by this `omp.wsloop`? The current implementation will set `noLoopMode = true` for both `omp.wsloop`s generated by this code:
```f90
!$omp target teams distribute parallel do
do i=1,10
  !$omp do
  do j=1,i
  end do
end do
```
I'm not actually sure about what is the expected behavior of this, but I imagine that no-loop would just refer to the outer loop, as it's the one for which the trip count can be evaluated in the host.

https://github.com/llvm/llvm-project/pull/155818


More information about the Mlir-commits mailing list