Skip to content

Commit 21eb8e1

Browse files
LeporacanthicusDanielCChen
authored andcommitted
[Flang][OpenMP]Add tests for TODOs and small changes to improve messages (llvm#111562)
The bulk of this change are new tests to check that we get a "Not yet implemneted: *some stuff here*" message when using some not yet supported OpenMP functionality. For some of these cases, this also means adding additional clauses to a filter list in OpenMP.cpp - this changes nothing [to the best of my understanding] other than allowing the clause to get to the point where it can be rejected in a TODO with a more clear message. One of the TOOD filters were missing Mergeable clause, so this was also added and the existing test updated for the new more specific error message. There is no functional change intended here.
1 parent 4db62c4 commit 21eb8e1

File tree

10 files changed

+104
-4
lines changed

10 files changed

+104
-4
lines changed

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,8 +1310,8 @@ static void genTaskClauses(lower::AbstractConverter &converter,
13101310
cp.processUntied(clauseOps);
13111311
// TODO Support delayed privatization.
13121312

1313-
cp.processTODO<clause::Affinity, clause::Detach, clause::InReduction>(
1314-
loc, llvm::omp::Directive::OMPD_task);
1313+
cp.processTODO<clause::Affinity, clause::Detach, clause::InReduction,
1314+
clause::Mergeable>(loc, llvm::omp::Directive::OMPD_task);
13151315
}
13161316

13171317
static void genTaskgroupClauses(lower::AbstractConverter &converter,
@@ -2780,7 +2780,10 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
27802780
!std::holds_alternative<clause::ThreadLimit>(clause.u) &&
27812781
!std::holds_alternative<clause::Threads>(clause.u) &&
27822782
!std::holds_alternative<clause::UseDeviceAddr>(clause.u) &&
2783-
!std::holds_alternative<clause::UseDevicePtr>(clause.u)) {
2783+
!std::holds_alternative<clause::UseDevicePtr>(clause.u) &&
2784+
!std::holds_alternative<clause::InReduction>(clause.u) &&
2785+
!std::holds_alternative<clause::Mergeable>(clause.u) &&
2786+
!std::holds_alternative<clause::TaskReduction>(clause.u)) {
27842787
TODO(clauseLocation, "OpenMP Block construct clause");
27852788
}
27862789
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
2+
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
3+
4+
! CHECK: not yet implemented: Reduction modifiers are not supported
5+
subroutine reduction_inscan()
6+
integer :: i,j
7+
i = 0
8+
9+
!$omp do reduction(inscan, +:i)
10+
do j=1,10
11+
i = i + 1
12+
end do
13+
!$omp end do
14+
end subroutine reduction_inscan
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
2+
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
3+
4+
! CHECK: not yet implemented: Reduction modifiers are not supported
5+
subroutine reduction_task()
6+
integer :: i
7+
i = 0
8+
9+
!$omp parallel reduction(task, +:i)
10+
i = i + 1
11+
!$omp end parallel
12+
end subroutine reduction_task
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -fopenmp-version=50 -o - %s 2>&1 | FileCheck %s
2+
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -fopenmp-version=50 -o - %s 2>&1 | FileCheck %s
3+
4+
!===============================================================================
5+
! `mergeable` clause
6+
!===============================================================================
7+
8+
! CHECK: not yet implemented: Unhandled clause IN_REDUCTION in TARGET construct
9+
subroutine omp_target_inreduction()
10+
integer i
11+
i = 0
12+
!$omp target in_reduction(+:i)
13+
i = i + 1
14+
!$omp end target
15+
end subroutine omp_target_inreduction
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
2+
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
3+
4+
!===============================================================================
5+
! `mergeable` clause
6+
!===============================================================================
7+
8+
! CHECK: not yet implemented: Unhandled clause IN_REDUCTION in TASK construct
9+
subroutine omp_task_in_reduction()
10+
integer i
11+
i = 0
12+
!$omp task in_reduction(+:i)
13+
i = i + 1
14+
!$omp end task
15+
end subroutine omp_task_in_reduction

flang/test/Lower/OpenMP/Todo/task_mergeable.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
! `mergeable` clause
66
!===============================================================================
77

8-
! CHECK: not yet implemented: OpenMP Block construct clause
8+
! CHECK: not yet implemented: Unhandled clause MERGEABLE in TASK construct
99
subroutine omp_task_mergeable()
1010
!$omp task mergeable
1111
call foo()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s -fopenmp-version=50 2>&1 | FileCheck %s
2+
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s -fopenmp-version=50 2>&1 | FileCheck %s
3+
4+
! CHECK: not yet implemented: Unhandled clause TASK_REDUCTION in TASKGROUP construct
5+
subroutine omp_taskgroup_task_reduction
6+
integer :: res
7+
!$omp taskgroup task_reduction(+:res)
8+
res = res + 1
9+
!$omp end taskgroup
10+
end subroutine omp_taskgroup_task_reduction
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s -fopenmp-version=50 2>&1 | FileCheck %s
2+
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s -fopenmp-version=50 2>&1 | FileCheck %s
3+
4+
! CHECK: not yet implemented: Taskloop construct
5+
subroutine omp_taskloop
6+
integer :: res, i
7+
!$omp taskloop
8+
do i = 1, 10
9+
res = res + 1
10+
end do
11+
!$omp end taskloop
12+
end subroutine omp_taskloop
13+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s -fopenmp-version=50 2>&1 | FileCheck %s
2+
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s -fopenmp-version=50 2>&1 | FileCheck %s
3+
4+
! CHECK: not yet implemented: Unhandled clause DEPEND in TASKWAIT construct
5+
subroutine omp_tw_depend
6+
integer :: res
7+
!$omp taskwait depend(out: res)
8+
res = res + 1
9+
end subroutine omp_tw_depend
10+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s -fopenmp-version=51 2>&1 | FileCheck %s
2+
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s -fopenmp-version=51 2>&1 | FileCheck %s
3+
4+
! CHECK: not yet implemented: Unhandled clause NOWAIT in TASKWAIT construct
5+
subroutine omp_tw_nowait
6+
!$omp taskwait nowait
7+
end subroutine omp_tw_nowait
8+

0 commit comments

Comments
 (0)