[PATCH] D91888: [flang][openacc] Add clause validaty tests for data construct + fix default restriction

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 20 12:40:36 PST 2020


clementval created this revision.
clementval added reviewers: kiranchandramohan, kiranktp, sscalpone, sameeranjoshi, SouraVX, tskeith, klausler.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
clementval requested review of this revision.

Add clause validity tests for the data construct. The default clause can appear only once
and this was not enforce in the ACC.td.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91888

Files:
  flang/test/Semantics/acc-clause-validity.f90
  llvm/include/llvm/Frontend/OpenACC/ACC.td


Index: llvm/include/llvm/Frontend/OpenACC/ACC.td
===================================================================
--- llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -257,7 +257,8 @@
 // 2.6.5
 def ACC_Data : Directive<"data"> {
   let allowedOnceClauses = [
-    VersionedClause<ACCC_If>
+    VersionedClause<ACCC_If>,
+    VersionedClause<ACCC_Default>
   ];
   let requiredClauses = [
     VersionedClause<ACCC_Attach>,
Index: flang/test/Semantics/acc-clause-validity.f90
===================================================================
--- flang/test/Semantics/acc-clause-validity.f90
+++ flang/test/Semantics/acc-clause-validity.f90
@@ -27,7 +27,7 @@
   logical, dimension(N) :: d, e
   real :: reduction_r
   logical :: reduction_l
-  real(8), dimension(N, N) :: aa
+  real(8), dimension(N, N) :: aa, bb, cc
   logical :: ifCondition = .TRUE.
 
   !ERROR: At least one clause is required on the DECLARE directive
@@ -106,7 +106,42 @@
   !$acc data
   !$acc end data
 
-  !$acc data copyin(i)
+  !$acc data copy(aa) if(.true.)
+  !$acc end data
+
+  !$acc data copy(aa) if(ifCondition)
+  !$acc end data
+
+  !$acc data copy(aa, bb, cc)
+  !$acc end data
+
+  !$acc data copyin(aa) copyin(readonly: bb) copyout(cc)
+  !$acc end data
+
+  !$acc data copyin(readonly: aa, bb) copyout(zero: cc)
+  !$acc end data
+
+  !$acc data create(aa, bb(:,:)) create(zero: cc(:,:))
+  !$acc end data
+
+  !$acc data no_create(aa) present(bb, cc)
+  !$acc end data
+
+  !$acc data deviceptr(aa) attach(bb, cc)
+  !$acc end data
+
+  !$acc data copy(aa, bb) default(none)
+  !$acc end data
+
+  !$acc data copy(aa, bb) default(present)
+  !$acc end data
+
+  !ERROR: At most one DEFAULT clause can appear on the DATA directive
+  !$acc data copy(aa, bb) default(none) default(present)
+  !$acc end data
+
+  !ERROR: At most one IF clause can appear on the DATA directive
+  !$acc data copy(aa) if(.true.) if(ifCondition)
   !$acc end data
 
   !$acc data copyin(i)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91888.306764.patch
Type: text/x-patch
Size: 2003 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201120/11733bb0/attachment.bin>


More information about the llvm-commits mailing list