[flang-commits] [flang] [flang][cuda] Allow DO CONCURRENT in cuf kernel (PR #124190)

via flang-commits flang-commits at lists.llvm.org
Thu Jan 23 12:56:16 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-semantics

Author: Valentin Clement (バレンタイン クレメン) (clementval)

<details>
<summary>Changes</summary>

DO CONCURRENT in cuf kernel is allowed in the reference compiler. 

---
Full diff: https://github.com/llvm/llvm-project/pull/124190.diff


2 Files Affected:

- (modified) flang/lib/Semantics/check-cuda.cpp (+2-1) 
- (modified) flang/test/Semantics/cuf09.cuf (-1) 


``````````diff
diff --git a/flang/lib/Semantics/check-cuda.cpp b/flang/lib/Semantics/check-cuda.cpp
index d8a5639227648f..3878fa8468d691 100644
--- a/flang/lib/Semantics/check-cuda.cpp
+++ b/flang/lib/Semantics/check-cuda.cpp
@@ -520,7 +520,8 @@ void CUDAChecker::Enter(const parser::SeparateModuleSubprogram &x) {
 
 static int DoConstructTightNesting(
     const parser::DoConstruct *doConstruct, const parser::Block *&innerBlock) {
-  if (!doConstruct || !doConstruct->IsDoNormal()) {
+  if (!doConstruct ||
+      (!doConstruct->IsDoNormal() && !doConstruct->IsDoConcurrent())) {
     return 0;
   }
   innerBlock = &std::get<parser::Block>(doConstruct->t);
diff --git a/flang/test/Semantics/cuf09.cuf b/flang/test/Semantics/cuf09.cuf
index 06c9070fcbcd00..fda8938b8ffc0d 100644
--- a/flang/test/Semantics/cuf09.cuf
+++ b/flang/test/Semantics/cuf09.cuf
@@ -130,7 +130,6 @@ program main
   do
     exit
   end do
-  !ERROR: !$CUF KERNEL DO (1) must be followed by a DO construct with tightly nested outer levels of counted DO loops
   !$cuf kernel do <<< 1, 2 >>>
   do concurrent (j=1:10)
   end do

``````````

</details>


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


More information about the flang-commits mailing list