Skip to content

[Frontend][OpenMP] Follow compound construct clause restrictions #107853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions flang/test/Lower/OpenMP/distribute-parallel-do.f90
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ subroutine distribute_parallel_do_dist_schedule()
!$omp end teams
end subroutine distribute_parallel_do_dist_schedule

! CHECK-LABEL: func.func @_QPdistribute_parallel_do_ordered(
subroutine distribute_parallel_do_ordered()
! CHECK-LABEL: func.func @_QPdistribute_parallel_do_schedule(
subroutine distribute_parallel_do_schedule()
!$omp teams

! CHECK: omp.parallel private({{.*}}) {
! CHECK: omp.distribute {
! CHECK-NEXT: omp.wsloop ordered(1) {
! CHECK-NEXT: omp.wsloop schedule(runtime) {
! CHECK-NEXT: omp.loop_nest
!$omp distribute parallel do ordered(1)
!$omp distribute parallel do schedule(runtime)
do index_ = 1, 10
end do
!$omp end distribute parallel do

!$omp end teams
end subroutine distribute_parallel_do_ordered
end subroutine distribute_parallel_do_schedule

! CHECK-LABEL: func.func @_QPdistribute_parallel_do_private(
subroutine distribute_parallel_do_private()
Expand Down
1 change: 1 addition & 0 deletions flang/test/Semantics/OpenMP/combined-constructs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ program main
enddo
!$omp end target parallel do

!ERROR: COPYIN clause is not allowed on the TARGET PARALLEL DO directive
!ERROR: Non-THREADPRIVATE object 'a' in COPYIN clause
!$omp target parallel do copyin(a)
do i = 1, N
Expand Down
1 change: 1 addition & 0 deletions flang/test/Semantics/OpenMP/ordered03.f90
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ subroutine sub1()
end do
!$omp end target parallel do

!ERROR: ORDERED clause is not allowed on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
!$omp target teams distribute parallel do ordered(1)
do i = 1, N
!ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter
Expand Down
9 changes: 0 additions & 9 deletions llvm/include/llvm/Frontend/OpenMP/OMP.td
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,6 @@ def OMP_DistributeParallelDo : Directive<"distribute parallel do"> {
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Order, 50>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Schedule>,
];
Expand Down Expand Up @@ -1293,7 +1292,6 @@ def OMP_DistributeSimd : Directive<"distribute simd"> {
VersionedClause<OMPC_If, 50>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Order, 50>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_SafeLen>,
VersionedClause<OMPC_Schedule>,
Expand Down Expand Up @@ -1840,7 +1838,6 @@ def OMP_TargetParallel : Directive<"target parallel"> {
def OMP_TargetParallelDo : Directive<"target parallel do"> {
let allowedClauses = [
VersionedClause<OMPC_Allocator>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Default>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_FirstPrivate>,
Expand Down Expand Up @@ -1977,7 +1974,6 @@ def OMP_TargetParallelForSimd : Directive<"target parallel for simd"> {
def OMP_target_parallel_loop : Directive<"target parallel loop"> {
let allowedClauses = [
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_Device>,
VersionedClause<OMPC_FirstPrivate>,
Expand Down Expand Up @@ -2106,7 +2102,6 @@ def OMP_TargetTeamsDistributeParallelDo :
Directive<"target teams distribute parallel do"> {
let allowedClauses = [
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_HasDeviceAddr, 51>,
Expand All @@ -2115,7 +2110,6 @@ def OMP_TargetTeamsDistributeParallelDo :
VersionedClause<OMPC_LastPrivate>,
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Shared>,
Expand Down Expand Up @@ -2143,7 +2137,6 @@ def OMP_TargetTeamsDistributeParallelDoSimd :
let allowedClauses = [
VersionedClause<OMPC_Aligned>,
VersionedClause<OMPC_Allocate>,
VersionedClause<OMPC_Copyin>,
VersionedClause<OMPC_Depend>,
VersionedClause<OMPC_FirstPrivate>,
VersionedClause<OMPC_HasDeviceAddr, 51>,
Expand All @@ -2153,7 +2146,6 @@ def OMP_TargetTeamsDistributeParallelDoSimd :
VersionedClause<OMPC_Linear>,
VersionedClause<OMPC_Map>,
VersionedClause<OMPC_NonTemporal>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_Private>,
VersionedClause<OMPC_Reduction>,
VersionedClause<OMPC_Shared>,
Expand Down Expand Up @@ -2395,7 +2387,6 @@ def OMP_TeamsDistributeParallelDo :
VersionedClause<OMPC_NumTeams>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_Order, 50>,
VersionedClause<OMPC_Ordered>,
VersionedClause<OMPC_ProcBind>,
VersionedClause<OMPC_Schedule>,
VersionedClause<OMPC_ThreadLimit>,
Expand Down
Loading