Skip to content

[flang][cuda] Allow DO CONCURRENT in cuf kernel #124190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

clementval
Copy link
Contributor

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

@llvmbot llvmbot added flang Flang issues not falling into any other category flang:semantics labels Jan 23, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 23, 2025

@llvm/pr-subscribers-flang-semantics

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

Changes

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 --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

@clementval clementval merged commit 3d59e30 into llvm:main Jan 23, 2025
11 checks passed
@clementval clementval deleted the cuf_doconc branch January 23, 2025 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants