Skip to content

Commit

Permalink
[flang][openacc] Relax clause rule on routine directive
Browse files Browse the repository at this point in the history
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
  • Loading branch information
clementval committed Jun 28, 2023
1 parent 25b5119 commit 9ed76f3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 2 additions & 0 deletions flang/docs/OpenACC.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 0 additions & 2 deletions flang/test/Semantics/OpenACC/acc-routine-validity.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
4 changes: 1 addition & 3 deletions llvm/include/llvm/Frontend/OpenACC/ACC.td
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down

0 comments on commit 9ed76f3

Please sign in to comment.