Skip to content

Cycle in an OpenMP Do breaks #1426

@wsmoses

Description

@wsmoses
error: loc("./lbm_pre.f90":7:1): block with no terminator, has omp.wsloop (%arg2) : i32 = (%c0_i32) to (%c43199999_i32) inclusive step (%c20_i32) schedule(static)  {
  fir.store %arg2 to %13 : !fir.ref<i32>
  br ^bb1
^bb1:  // pred: ^bb0
  %c19_i32 = arith.constant 19 : i32
  %14 = fir.load %13 : !fir.ref<i32>
  %15 = fir.no_reassoc %14 : i32
  %16 = arith.addi %c19_i32, %15 : i32
  %17 = fir.convert %16 : (i32) -> i64
  %18 = fir.convert %c0 : (index) -> i64
  %19 = arith.subi %17, %18 : i64
  %20 = fir.coordinate_of %arg0, %19 : (!fir.ref<!fir.array<43200000xf32>>, i64) -> !fir.ref<f32>
  %c1_i32 = arith.constant 1 : i32
  fir.store %c1_i32 to %7 : !fir.ref<i32>
  %21 = fir.call @_QPcond(%20, %7) : (!fir.ref<f32>, !fir.ref<i32>) -> !fir.logical<4>
  %22 = fir.convert %21 : (!fir.logical<4>) -> i1
  cond_br %22, ^bb2, ^bb3
^bb2:  // pred: ^bb1
  br ^bb3
^bb3:  // 2 preds: ^bb1, ^bb2
  omp.yield
}
function cond(g, f)
  real :: g
  integer :: i, f
  logical :: cond
  cond = (0 .ne. iand(transfer(g,i), f))
end function
subroutine lbm_sc_atomic(srcGrid, dstGrid)
  implicit none
  real, dimension(0:(150)*(1*(120))*(1*(120))*20 -1) :: srcGrid, dstGrid
  real :: ux, uy, uz, u2, rho
  integer :: u
  integer :: i
  logical :: cond
  !$AD OMP_ADJ ATOMIC(srcGrid)
  !$omp parallel do private( ux, uy, uz, u2, rho ) schedule(static)
  do i = (0)+20*((0)+(0)*(1*(120))+(0)*(1*(120))*(1*(120))), (0)+20*((0)+(0)*(1*(120))+((150))*(1*(120))*(1*(120)))-1, 20
  if( cond(srcGrid((19)+20*((0)+(0)*(1*(120))+(0)*(1*(120))*(1*(120)))+(i)),1)) then
    cycle
  end if
  end do
  return
end subroutine
 subroutine lbm_sc_atomicENZYME(srcGrid, dsrcGrid, dstGrid, ddstGrid)
     CALL ENZYME_AUTODIFF(lbm_sc_atomic, srcGrid, dsrcGrid, dstGrid, ddstGrid)
    return
 end subroutine

Metadata

Metadata

Assignees

No one assigned

    Labels

    OpenMPLowering and codegen of OpenMP

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions