Skip to content

[Flang][OpenMP]Add tests for TODOs and small changes to improve messages #111562

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 2 commits into from
Oct 11, 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
9 changes: 6 additions & 3 deletions flang/lib/Lower/OpenMP/OpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1255,8 +1255,8 @@ static void genTaskClauses(lower::AbstractConverter &converter,
cp.processUntied(clauseOps);
// TODO Support delayed privatization.

cp.processTODO<clause::Affinity, clause::Detach, clause::InReduction>(
loc, llvm::omp::Directive::OMPD_task);
cp.processTODO<clause::Affinity, clause::Detach, clause::InReduction,
clause::Mergeable>(loc, llvm::omp::Directive::OMPD_task);
}

static void genTaskgroupClauses(lower::AbstractConverter &converter,
Expand Down Expand Up @@ -2764,7 +2764,10 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
!std::holds_alternative<clause::ThreadLimit>(clause.u) &&
!std::holds_alternative<clause::Threads>(clause.u) &&
!std::holds_alternative<clause::UseDeviceAddr>(clause.u) &&
!std::holds_alternative<clause::UseDevicePtr>(clause.u)) {
!std::holds_alternative<clause::UseDevicePtr>(clause.u) &&
!std::holds_alternative<clause::InReduction>(clause.u) &&
!std::holds_alternative<clause::Mergeable>(clause.u) &&
!std::holds_alternative<clause::TaskReduction>(clause.u)) {
TODO(clauseLocation, "OpenMP Block construct clause");
}
}
Expand Down
14 changes: 14 additions & 0 deletions flang/test/Lower/OpenMP/Todo/reduction-inscan.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s

! CHECK: not yet implemented: Reduction modifiers are not supported
subroutine reduction_inscan()
integer :: i,j
i = 0

!$omp do reduction(inscan, +:i)
do j=1,10
i = i + 1
end do
!$omp end do
end subroutine reduction_inscan
12 changes: 12 additions & 0 deletions flang/test/Lower/OpenMP/Todo/reduction-task.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s

! CHECK: not yet implemented: Reduction modifiers are not supported
subroutine reduction_task()
integer :: i
i = 0

!$omp parallel reduction(task, +:i)
i = i + 1
!$omp end parallel
end subroutine reduction_task
15 changes: 15 additions & 0 deletions flang/test/Lower/OpenMP/Todo/target-inreduction.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -fopenmp-version=50 -o - %s 2>&1 | FileCheck %s
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -fopenmp-version=50 -o - %s 2>&1 | FileCheck %s

!===============================================================================
! `mergeable` clause
!===============================================================================

! CHECK: not yet implemented: Unhandled clause IN_REDUCTION in TARGET construct
subroutine omp_target_inreduction()
integer i
i = 0
!$omp target in_reduction(+:i)
i = i + 1
!$omp end target
end subroutine omp_target_inreduction
15 changes: 15 additions & 0 deletions flang/test/Lower/OpenMP/Todo/task-inreduction.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s

!===============================================================================
! `mergeable` clause
!===============================================================================

! CHECK: not yet implemented: Unhandled clause IN_REDUCTION in TASK construct
subroutine omp_task_in_reduction()
integer i
i = 0
!$omp task in_reduction(+:i)
i = i + 1
!$omp end task
end subroutine omp_task_in_reduction
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/Todo/task_mergeable.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
! `mergeable` clause
!===============================================================================

! CHECK: not yet implemented: OpenMP Block construct clause
! CHECK: not yet implemented: Unhandled clause MERGEABLE in TASK construct
subroutine omp_task_mergeable()
!$omp task mergeable
call foo()
Expand Down
10 changes: 10 additions & 0 deletions flang/test/Lower/OpenMP/Todo/taskgroup-task-reduction.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s -fopenmp-version=50 2>&1 | FileCheck %s
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s -fopenmp-version=50 2>&1 | FileCheck %s

! CHECK: not yet implemented: Unhandled clause TASK_REDUCTION in TASKGROUP construct
subroutine omp_taskgroup_task_reduction
integer :: res
!$omp taskgroup task_reduction(+:res)
res = res + 1
!$omp end taskgroup
end subroutine omp_taskgroup_task_reduction
13 changes: 13 additions & 0 deletions flang/test/Lower/OpenMP/Todo/taskloop.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s -fopenmp-version=50 2>&1 | FileCheck %s
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s -fopenmp-version=50 2>&1 | FileCheck %s

! CHECK: not yet implemented: Taskloop construct
subroutine omp_taskloop
integer :: res, i
!$omp taskloop
do i = 1, 10
res = res + 1
end do
!$omp end taskloop
end subroutine omp_taskloop

10 changes: 10 additions & 0 deletions flang/test/Lower/OpenMP/Todo/taskwait-depend.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s -fopenmp-version=50 2>&1 | FileCheck %s
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s -fopenmp-version=50 2>&1 | FileCheck %s

! CHECK: not yet implemented: Unhandled clause DEPEND in TASKWAIT construct
subroutine omp_tw_depend
integer :: res
!$omp taskwait depend(out: res)
res = res + 1
end subroutine omp_tw_depend

8 changes: 8 additions & 0 deletions flang/test/Lower/OpenMP/Todo/taskwait-nowait.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s -fopenmp-version=51 2>&1 | FileCheck %s
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s -fopenmp-version=51 2>&1 | FileCheck %s

! CHECK: not yet implemented: Unhandled clause NOWAIT in TASKWAIT construct
subroutine omp_tw_nowait
!$omp taskwait nowait
end subroutine omp_tw_nowait

Loading