[PATCH] D153896: [flang][openacc] Relax clause rule on routine directive

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 10:10:59 PDT 2023


clementval created this revision.
clementval added reviewers: razvanlupusoru, vzakhari, jeanPerier.
Herald added a subscriber: sunshaoce.
Herald added projects: Flang, All.
clementval requested review of this revision.
Herald added subscribers: llvm-commits, jdoerfert.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153896

Files:
  flang/docs/OpenACC.md
  flang/test/Semantics/OpenACC/acc-routine-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
@@ -417,9 +417,7 @@
   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>,
Index: flang/test/Semantics/OpenACC/acc-routine-validity.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-routine-validity.f90
+++ flang/test/Semantics/OpenACC/acc-routine-validity.f90
@@ -10,7 +10,6 @@
 
   !$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 @@
 
   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
 
Index: flang/docs/OpenACC.md
===================================================================
--- flang/docs/OpenACC.md
+++ 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153896.535042.patch
Type: text/x-patch
Size: 1748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230627/959d775b/attachment.bin>


More information about the llvm-commits mailing list