Skip to content

Commit

Permalink
[Flang][OpenMP] Mark mergeable and untied clauses as unsupported (#71209
Browse files Browse the repository at this point in the history
)

These two clauses are not supported in the OpenMP Dialect to LLVM
conversion. Mark as TODO till support is added.
  • Loading branch information
kiranchandramohan committed Nov 6, 2023
1 parent 1a1a5ec commit 1275683
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 62 deletions.
2 changes: 0 additions & 2 deletions flang/lib/Lower/OpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3092,8 +3092,6 @@ genOMP(Fortran::lower::AbstractConverter &converter,
!std::get_if<Fortran::parser::OmpClause::Allocate>(&clause.u) &&
!std::get_if<Fortran::parser::OmpClause::Default>(&clause.u) &&
!std::get_if<Fortran::parser::OmpClause::Final>(&clause.u) &&
!std::get_if<Fortran::parser::OmpClause::Untied>(&clause.u) &&
!std::get_if<Fortran::parser::OmpClause::Mergeable>(&clause.u) &&
!std::get_if<Fortran::parser::OmpClause::Priority>(&clause.u) &&
!std::get_if<Fortran::parser::OmpClause::Reduction>(&clause.u) &&
!std::get_if<Fortran::parser::OmpClause::Depend>(&clause.u) &&
Expand Down
32 changes: 2 additions & 30 deletions flang/test/Lower/OpenMP/FIR/task.f90
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,6 @@ subroutine omp_task_final(bar)
!$omp end task
end subroutine omp_task_final

!===============================================================================
! `untied` clause
!===============================================================================

!CHECK-LABEL: func @_QPomp_task_untied() {
subroutine omp_task_untied()
!CHECK: omp.task untied {
!$omp task untied
!CHECK: fir.call @_QPfoo() {{.*}}: () -> ()
call foo()
!CHECK: omp.terminator
!$omp end task
end subroutine omp_task_untied

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

!CHECK-LABEL: func @_QPomp_task_mergeable() {
subroutine omp_task_mergeable()
!CHECK: omp.task mergeable {
!$omp task mergeable
!CHECK: fir.call @_QPfoo() {{.*}}: () -> ()
call foo()
!CHECK: omp.terminator
!$omp end task
end subroutine omp_task_mergeable

!===============================================================================
! `priority` clause
!===============================================================================
Expand Down Expand Up @@ -245,8 +217,8 @@ subroutine task_multiple_clauses()
integer :: x, y, z
logical :: buzz

!CHECK: omp.task if(%{{.+}}) final(%{{.+}}) untied mergeable priority(%{{.+}}) allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>) {
!$omp task if(buzz) final(buzz) untied mergeable priority(z) allocate(omp_high_bw_mem_alloc: x) private(x) firstprivate(y)
!CHECK: omp.task if(%{{.+}}) final(%{{.+}}) priority(%{{.+}}) allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>) {
!$omp task if(buzz) final(buzz) priority(z) allocate(omp_high_bw_mem_alloc: x) private(x) firstprivate(y)

!CHECK: %[[x_priv:.+]] = fir.alloca i32
!CHECK: %[[y_priv:.+]] = fir.alloca i32
Expand Down
13 changes: 13 additions & 0 deletions flang/test/Lower/OpenMP/Todo/task_mergeable.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 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: OpenMP Block construct clause
subroutine omp_task_mergeable()
!$omp task mergeable
call foo()
!$omp end task
end subroutine omp_task_mergeable
13 changes: 13 additions & 0 deletions flang/test/Lower/OpenMP/Todo/task_untied.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 2>&1 | FileCheck %s
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s

!===============================================================================
! `untied` clause
!===============================================================================

! CHECK: not yet implemented: OpenMP Block construct clause
subroutine omp_task_untied()
!$omp task untied
call foo()
!$omp end task
end subroutine omp_task_untied
32 changes: 2 additions & 30 deletions flang/test/Lower/OpenMP/task.f90
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,6 @@ subroutine omp_task_final(bar)
!$omp end task
end subroutine omp_task_final

!===============================================================================
! `untied` clause
!===============================================================================

!CHECK-LABEL: func @_QPomp_task_untied() {
subroutine omp_task_untied()
!CHECK: omp.task untied {
!$omp task untied
!CHECK: fir.call @_QPfoo() {{.*}}: () -> ()
call foo()
!CHECK: omp.terminator
!$omp end task
end subroutine omp_task_untied

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

!CHECK-LABEL: func @_QPomp_task_mergeable() {
subroutine omp_task_mergeable()
!CHECK: omp.task mergeable {
!$omp task mergeable
!CHECK: fir.call @_QPfoo() {{.*}}: () -> ()
call foo()
!CHECK: omp.terminator
!$omp end task
end subroutine omp_task_mergeable

!===============================================================================
! `priority` clause
!===============================================================================
Expand Down Expand Up @@ -253,8 +225,8 @@ subroutine task_multiple_clauses()
integer :: x, y, z
logical :: buzz

!CHECK: omp.task if(%{{.+}}) final(%{{.+}}) untied mergeable priority(%{{.+}}) allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>) {
!$omp task if(buzz) final(buzz) untied mergeable priority(z) allocate(omp_high_bw_mem_alloc: x) private(x) firstprivate(y)
!CHECK: omp.task if(%{{.+}}) final(%{{.+}}) priority(%{{.+}}) allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>) {
!$omp task if(buzz) final(buzz) priority(z) allocate(omp_high_bw_mem_alloc: x) private(x) firstprivate(y)

!CHECK: %[[X_PRIV_ALLOCA:.+]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFtask_multiple_clausesEx"}
!CHECK: %[[X_PRIV:.+]]:2 = hlfir.declare %[[X_PRIV_ALLOCA]] {uniq_name = "_QFtask_multiple_clausesEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
Expand Down

0 comments on commit 1275683

Please sign in to comment.