[flang-commits] [flang] [Flang][OpenMP] Align map clause generation and fix issue with non-shared allocations for assumed shape/size descriptor types (PR #97855)
via flang-commits
flang-commits at lists.llvm.org
Fri Aug 2 03:22:30 PDT 2024
================
@@ -455,12 +455,11 @@ subroutine omp_target_implicit_bounds(n)
!CHECK: %[[VAL_8:.*]] = fir.alloca !fir.array<?xi32>, %[[VAL_7]] {bindc_name = "a", uniq_name = "_QFomp_target_implicit_boundsEa"}
!CHECK: %[[VAL_9:.*]] = fir.shape %[[VAL_7]] : (index) -> !fir.shape<1>
!CHECK: %[[VAL_10:.*]]:2 = hlfir.declare %[[VAL_8]](%[[VAL_9]]) {uniq_name = "_QFomp_target_implicit_boundsEa"} : (!fir.ref<!fir.array<?xi32>>, !fir.shape<1>) -> (!fir.box<!fir.array<?xi32>>, !fir.ref<!fir.array<?xi32>>)
- !CHECK: %[[DIMS0:.*]]:3 = fir.box_dims %{{[0-9]+}}#0, %c0{{.*}} : (!fir.box<!fir.array<?xi32>>, index) -> (index, index, index)
- !CHECK: %[[UB:.*]] = arith.subi %[[DIMS0]]#1, %c1{{.*}} : index
+ !CHECK: %[[UB:.*]] = arith.subi %[[VAL_7]], %c1{{.*}} : index
integer :: n
integer :: a(n)
- !CHECK: %[[VAL_14:.*]] = omp.map.bounds lower_bound(%c0{{.*}} : index) upper_bound(%[[UB]] : index) extent(%[[DIMS0]]#1 : index) stride(%[[DIMS0]]#2 : index) start_idx(%c1{{.*}} : index) {stride_in_bytes = true}
+ !CHECK: %[[VAL_14:.*]] = omp.map.bounds lower_bound(%c0{{.*}} : index) upper_bound(%[[UB]] : index) extent(%[[VAL_7]] : index) stride(%c1{{.*}} : index) start_idx(%c1{{.*}} : index)
----------------
agozillon wrote:
As we're moving to utilising the "raw input" across all cases of map.info generation for now (until a case arises where we need the alternative, sometimes more "complex" variation, can see prior discussion in the comments for some more background information on this, as well as the description of the PR i believe) to simplify and unify things we end up with a non-BoxType in certain cases where previously we used to have a BoxType, in some of these cases we generate the bounds differently e.g. line 1729~/1733 of Lower/OpenMP.cpp this can result in certain differences like the above, where we end up with a stride no longer in bytes (you can see it the effect partially in the way we end up with a constant input for stride now instead of the previous access into the BoxType's dimensions, which is an access into the fortran descriptor), basically we end up with a SequenceType instead of a BoxType due to utilization of the "raw input" which means the bounds are generated slightly differently. A side affect of this is that we end up with simpler, likely quicker mapping in a lot of cases, at the cost of less information on the device, for the moment this doesn't appear to have any side affects from testing, but I am keeping an eye on it for the future.
https://github.com/llvm/llvm-project/pull/97855
More information about the flang-commits
mailing list