[flang-commits] [flang] 9ed76f3 - [flang][openacc] Relax clause rule on routine directive

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Wed Jun 28 09:07:45 PDT 2023


Author: Valentin Clement
Date: 2023-06-28T09:07:38-07:00
New Revision: 9ed76f3958bba8abb0e40fa51f9ff54961332f18

URL: https://github.com/llvm/llvm-project/commit/9ed76f3958bba8abb0e40fa51f9ff54961332f18
DIFF: https://github.com/llvm/llvm-project/commit/9ed76f3958bba8abb0e40fa51f9ff54961332f18.diff

LOG: [flang][openacc] Relax clause rule on routine directive

Some compiler treat `acc routine` without a parallelism clause as
if seq is present. Relax the parser rule to allow acc routine
without clause. The default clause will be handled in lowering.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D153896

Added: 
    

Modified: 
    flang/docs/OpenACC.md
    flang/test/Semantics/OpenACC/acc-routine-validity.f90
    llvm/include/llvm/Frontend/OpenACC/ACC.td

Removed: 
    


################################################################################
diff  --git a/flang/docs/OpenACC.md b/flang/docs/OpenACC.md
index 8132a5beaef039..c63fcd9a9daa01 100644
--- a/flang/docs/OpenACC.md
+++ b/flang/docs/OpenACC.md
@@ -15,3 +15,5 @@
 
 ## Intentional deviation from the specification
 * The end directive for combined construct can omit the `loop` keyword.
+* An `!$acc routine` with no parallelism clause is treated as if the `seq`
+  clause was present.

diff  --git a/flang/test/Semantics/OpenACC/acc-routine-validity.f90 b/flang/test/Semantics/OpenACC/acc-routine-validity.f90
index 83583fcabf8f79..5b8ecdec4f5267 100644
--- a/flang/test/Semantics/OpenACC/acc-routine-validity.f90
+++ b/flang/test/Semantics/OpenACC/acc-routine-validity.f90
@@ -10,7 +10,6 @@ module openacc_routine_validity
 
   !$acc routine(fct2) vector
 
-  !ERROR: At least one of GANG, SEQ, VECTOR, WORKER clause must appear on the ROUTINE directive
   !$acc routine(sub3)
 
   !ERROR: ROUTINE directive without name must appear within the specification part of a subroutine or function definition, or within an interface body for a subroutine or function in an interface block
@@ -23,7 +22,6 @@ module openacc_routine_validity
 
   subroutine sub1(a)
     real :: a(:)
-    !ERROR: At least one of GANG, SEQ, VECTOR, WORKER clause must appear on the ROUTINE directive
     !$acc routine
   end subroutine sub1
 

diff  --git a/llvm/include/llvm/Frontend/OpenACC/ACC.td b/llvm/include/llvm/Frontend/OpenACC/ACC.td
index 1b186075851415..98cf49f03a49d9 100644
--- a/llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ b/llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -418,9 +418,7 @@ def ACC_Routine : Directive<"routine"> {
   let allowedOnceClauses = [
     VersionedClause<ACCC_Bind>,
     VersionedClause<ACCC_DeviceType>,
-    VersionedClause<ACCC_NoHost>
-  ];
-  let requiredClauses = [
+    VersionedClause<ACCC_NoHost>,
     VersionedClause<ACCC_Gang>,
     VersionedClause<ACCC_Seq>,
     VersionedClause<ACCC_Vector>,


        


More information about the flang-commits mailing list