[flang-commits] [flang] [flang][acc] Allow nested gang loops inside acc routines (PR #158693)

via flang-commits flang-commits at lists.llvm.org
Tue Sep 16 03:21:23 PDT 2025


================
@@ -293,7 +293,7 @@ void AccStructureChecker::CheckNotInSameOrSubLevelLoopConstruct() {
           bool invalid{false};
           if (parentClause == llvm::acc::Clause::ACCC_gang &&
               cl == llvm::acc::Clause::ACCC_gang) {
-            if (IsInsideParallelConstruct()) {
+            if (!IsInsideKernelsConstruct()) {
----------------
jeanPerier wrote:

I would suggest reversing the logic and emitting an error mentioning Kernel constructs (something like "nested GANG clause is not allowed inside the region of a KERNEL construct". I am not sure that is a textual restriction of the ACC standard, my understanding is that it is derived from the fact that GANG clause cannot have a DIM argument inside KERENEL, so it makes little sense to have nested GANG clauses).

The current error: `GANG clause is not allowed in the region of a loop with the GANG clause` is a bit misleading IMHO.


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


More information about the flang-commits mailing list