Skip to content

Conversation

@erichkeane
Copy link
Collaborator

in #136610 we agreed that all async clauses on compute constructs should act as 'only 1 per device-type-group'. On data, it has the same specification language, and the same real requirements, so it seems sensible to make it work the same way.

in llvm#136610 we agreed that all async clauses on compute constructs should act
as 'only 1 per device-type-group'.  On `data`, it has the same
specification language, and the same real requirements, so it seems
sensible to make it work the same way.
@llvmbot llvmbot added flang Flang issues not falling into any other category openacc flang:semantics labels Apr 23, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 23, 2025

@llvm/pr-subscribers-flang-semantics

@llvm/pr-subscribers-openacc

Author: Erich Keane (erichkeane)

Changes

in #136610 we agreed that all async clauses on compute constructs should act as 'only 1 per device-type-group'. On data, it has the same specification language, and the same real requirements, so it seems sensible to make it work the same way.


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

2 Files Affected:

  • (modified) flang/test/Semantics/OpenACC/acc-data.f90 (+11)
  • (modified) llvm/include/llvm/Frontend/OpenACC/ACC.td (+1-1)
diff --git a/flang/test/Semantics/OpenACC/acc-data.f90 b/flang/test/Semantics/OpenACC/acc-data.f90
index ac49532c495d5..473b91d555cea 100644
--- a/flang/test/Semantics/OpenACC/acc-data.f90
+++ b/flang/test/Semantics/OpenACC/acc-data.f90
@@ -187,6 +187,17 @@ program openacc_data_validity
   !$acc data copy(aa) device_type(default) wait
   !$acc end data
 
+  !ERROR: At most one ASYNC clause can appear on the DATA directive or in group separated by the DEVICE_TYPE clause
+  !$acc data copy(aa) async(async1) async(2)
+  !$acc end data
+
+  !$acc data copy(aa) async(async1) device_type(multicore) async(2) ! ok
+  !$acc end data
+
+  !ERROR: At most one ASYNC clause can appear on the DATA directive or in group separated by the DEVICE_TYPE clause
+  !$acc data copy(aa) async(async1) device_type(multicore) async(2) async(3)
+  !$acc end data
+
   do i = 1, 100
     !$acc data copy(aa)
     !ERROR: CYCLE to construct outside of DATA construct is not allowed
diff --git a/llvm/include/llvm/Frontend/OpenACC/ACC.td b/llvm/include/llvm/Frontend/OpenACC/ACC.td
index 7dc97e6c89bee..d372fc221e4b4 100644
--- a/llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ b/llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -284,11 +284,11 @@ def ACC_Atomic : Directive<"atomic"> {
 // 2.6.5
 def ACC_Data : Directive<"data"> {
   let allowedOnceClauses = [
-    VersionedClause<ACCC_Async, 32>,
     VersionedClause<ACCC_If>,
     VersionedClause<ACCC_Default>
   ];
   let allowedClauses = [
+    VersionedClause<ACCC_Async, 32>,
     VersionedClause<ACCC_DeviceType, 32>,
     VersionedClause<ACCC_Wait, 32>
   ];

Copy link
Contributor

@clementval clementval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@erichkeane erichkeane merged commit 2e389cb into llvm:main Apr 23, 2025
15 checks passed
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…lvm#136866)

in llvm#136610 we agreed that all async clauses on compute constructs should
act as 'only 1 per device-type-group'. On `data`, it has the same
specification language, and the same real requirements, so it seems
sensible to make it work the same way.
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 openacc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants