[flang-commits] [flang] [mlir] [Flang][OpenMP] Privatize descriptors for assumed shape array maps for performance increase (PR #212336)
via flang-commits
flang-commits at lists.llvm.org
Mon Jul 27 12:50:36 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-openmp
Author: agozillon
<details>
<summary>Changes</summary>
This PR aims to decrease the performance overhead of descriptor mapping by privatizing the descriptors, thus having them part of the initial kernel payload as opposed to a separate more costly H2D transfer. We do so by modifying the map types for the descriptor, hooking into the runtimes existing privatization of attach pointers. Some minor tweaks in the lowering to LLVM-IR are also required to specialize around this attach map privatization case. The intent is to expand this privatization to more comprehensively be the default case for descriptors, so hopefully we'll be able to assimilate the edge case better with the member mapping in the future.
This currently only applies to assumed shape array arguments while we test the cost effectiveness and possible downsides.
Co-author: Akash Banerjee <Akash.Banerjee@<!-- -->amd.com>
---
Patch is 32.97 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/212336.diff
9 Files Affected:
- (modified) flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp (+57-19)
- (modified) flang/test/Lower/OpenMP/array-bounds.f90 (+1-1)
- (modified) flang/test/Lower/OpenMP/map-descriptor-deferral.f90 (+2-2)
- (added) flang/test/Lower/OpenMP/map-descriptor-privatization.f90 (+19)
- (modified) flang/test/Lower/OpenMP/optional-argument-map-3.f90 (+2-2)
- (modified) mlir/include/mlir/Dialect/OpenMP/OpenMPEnums.td (+3-1)
- (modified) mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp (+5)
- (modified) mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp (+56-20)
- (added) mlir/test/Target/LLVMIR/omptarget-map-pointer-privatization.mlir (+39)
``````````diff
diff --git a/flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp b/flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
index 992ca8b94c5cb..fba190b5a69bc 100644
--- a/flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
+++ b/flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
@@ -340,7 +340,8 @@ class MapInfoFinalizationPass
/// base address can be utilised.
mlir::Value getDescriptorFromBoxMap(mlir::omp::MapInfoOp boxMap,
fir::FirOpBuilder &builder,
- bool &canDescBeDeferred) {
+ bool &canDescBeDeferred,
+ bool &canOptimizeDescViaPrivatization) {
mlir::Value descriptor = boxMap.getVarPtr();
if (!fir::isTypeWithDescriptor(boxMap.getVarPtrType()))
if (auto addrOp = mlir::dyn_cast_if_present<fir::BoxAddrOp>(
@@ -349,8 +350,13 @@ class MapInfoFinalizationPass
canDescBeDeferred = canDeferDescriptorMapping(descriptor);
- if (!mlir::isa<fir::BaseBoxType>(descriptor.getType()) &&
- !fir::factory::isOptionalArgument(descriptor.getDefiningOp()))
+ // A restricted subset of canDeferDescriptorMapping for the moment
+ // can extend to encompass more as we find acceptable cases.
+ canOptimizeDescViaPrivatization = isDummyArgument(descriptor) &&
+ fir::isAssumedShape(descriptor.getType());
+
+ if ((!mlir::isa<fir::BaseBoxType>(descriptor.getType()) &&
+ !fir::factory::isOptionalArgument(descriptor.getDefiningOp())))
return descriptor;
mlir::Value &alloca = localBoxAllocas[descriptor.getDefiningOp()];
@@ -752,10 +758,20 @@ class MapInfoFinalizationPass
/// issues.
mlir::omp::ClauseMapFlags
getDescriptorMapType(mlir::omp::ClauseMapFlags mapTypeFlag,
- mlir::Operation *target) {
+ mlir::Operation *target, bool privatizeDescriptor) {
using MapFlags = mlir::omp::ClauseMapFlags;
MapFlags flags = MapFlags::none;
+ // Special runtime case for descriptor privatization requires the
+ // following map types in synergy:
+ //
+ // PRIVATE | ATTACH | TARGET_PARAM
+ //
+ if (privatizeDescriptor) {
+ return MapFlags::priv | MapFlags::attach | MapFlags::target_param |
+ (mapTypeFlag & MapFlags::implicit);
+ }
+
if (llvm::isa_and_nonnull<mlir::omp::TargetExitDataOp,
mlir::omp::TargetUpdateOp>(target)) {
return mapTypeFlag;
@@ -817,6 +833,18 @@ class MapInfoFinalizationPass
return false;
}
+ /// Gets the underlying type of a pointer type, effectively unwrapping
+ /// fir.ref, and fir.array to get the underlying scalar type.
+ mlir::Type getUnderlyingVarType(mlir::Type baseAddrType) {
+ baseAddrType =
+ llvm::cast<mlir::omp::PointerLikeType>(fir::unwrapRefType(baseAddrType))
+ .getElementType();
+ if (auto seqType = llvm::dyn_cast<fir::SequenceType>(baseAddrType))
+ if (seqType.hasDynamicExtents())
+ baseAddrType = seqType.getEleTy();
+ return baseAddrType;
+ }
+
/// This function generates an attach map, which is an type of OpenMP map that
/// binds a pointer to its data. In the case of Fortran, this binding is
/// primarily for binding the pointer inside of descriptors to the underlying
@@ -838,12 +866,8 @@ class MapInfoFinalizationPass
? reuseBaseAddr
: fir::BoxOffsetOp::create(builder, descMapOp->getLoc(), descriptor,
fir::BoxFieldAttr::base_addr);
- mlir::Type underlyingVarType = llvm::cast<mlir::omp::PointerLikeType>(
- fir::unwrapRefType(baseAddr.getType()))
- .getElementType();
- if (auto seqType = llvm::dyn_cast<fir::SequenceType>(underlyingVarType))
- if (seqType.hasDynamicExtents())
- underlyingVarType = seqType.getEleTy();
+
+ mlir::Type underlyingVarType = getUnderlyingVarType(baseAddr.getType());
auto implicitAttachMap = mlir::omp::MapInfoOp::create(
builder, descMapOp->getLoc(), descMapOp.getResult().getType(),
@@ -1068,7 +1092,8 @@ class MapInfoFinalizationPass
mlir::Operation *target, mlir::Value descriptor,
llvm::SmallVectorImpl<ParentAndPlacement> &mapMemberUsers,
bool isAttachNever, bool isAttachAlways, bool isHasDeviceAddrFlag,
- bool descCanBeDeferred, mlir::FlatSymbolRefAttr mapperId) {
+ bool descCanBeDeferred, bool canOptimizeDescViaPrivatization,
+ mlir::FlatSymbolRefAttr mapperId) {
bool isRefPtrPtee =
bitEnumContainsAll(op.getMapType(),
mlir::omp::ClauseMapFlags::ref_ptr) &&
@@ -1095,19 +1120,30 @@ class MapInfoFinalizationPass
newMembersAttr, newMembers, memberIndices);
}
+ bool optDescMap = canOptimizeDescViaPrivatization &&
+ llvm::isa<mlir::omp::TargetOp>(target);
+
// If we have been provided RefPtrPtee, utilise the user specified map
// types, otherwise, use the default descriptor map types.
auto mapType = isRefPtrPtee ? op.getMapType()
- : getDescriptorMapType(op.getMapType(), target);
+ : getDescriptorMapType(op.getMapType(), target,
+ optDescMap);
mapType = removeAttachModifiers(mapType);
+ mlir::Type underlyingVarType = mlir::Type{};
+ if (optDescMap)
+ underlyingVarType = getUnderlyingVarType(baseAddr.getType());
+
auto newMapInfoOp = mlir::omp::MapInfoOp::create(
builder, op->getLoc(), op.getResult().getType(), descriptor,
mlir::TypeAttr::get(fir::unwrapRefType(descriptor.getType())),
builder.getAttr<mlir::omp::ClauseMapFlagsAttr>(mapType),
- op.getMapCaptureTypeAttr(), /*varPtrPtr=*/mlir::Value{},
- /*varPtrPtTyper=*/mlir::TypeAttr{}, newMembers, newMembersAttr,
+ op.getMapCaptureTypeAttr(),
+ optDescMap ? baseAddr.getVarPtrPtr() : mlir::Value{},
+ underlyingVarType ? mlir::TypeAttr::get(underlyingVarType)
+ : mlir::TypeAttr{},
+ newMembers, newMembersAttr,
/*bounds=*/mlir::SmallVector<mlir::Value>{},
/*mapperId*/ mlir::FlatSymbolRefAttr(), op.getNameAttr(),
/*partial_map=*/builder.getBoolAttr(false));
@@ -1143,6 +1179,7 @@ class MapInfoFinalizationPass
void genDescriptorMaps(mlir::omp::MapInfoOp op, fir::FirOpBuilder &builder,
mlir::Operation *target) {
bool descCanBeDeferred = false;
+ bool canOptimizeDescViaPrivatization = false;
llvm::SmallVector<ParentAndPlacement> mapMemberUsers;
getMemberUserList(op, mapMemberUsers);
@@ -1162,8 +1199,8 @@ class MapInfoFinalizationPass
!bitEnumContainsAll(op.getMapType(),
mlir::omp::ClauseMapFlags::ref_ptr);
- mlir::Value descriptor =
- getDescriptorFromBoxMap(op, builder, descCanBeDeferred);
+ mlir::Value descriptor = getDescriptorFromBoxMap(
+ op, builder, descCanBeDeferred, canOptimizeDescViaPrivatization);
mlir::FlatSymbolRefAttr mapperId = op.getMapperIdAttr();
// If we're a derived type descriptor, that's been flagged as ref_ptr,
@@ -1189,9 +1226,10 @@ class MapInfoFinalizationPass
genRefPteeMap(op, builder, target, descriptor, mapMemberUsers,
isAttachNever, isAttachAlways, mapperId);
} else {
- genRefPtrPteeOrDefaultMap(
- op, builder, target, descriptor, mapMemberUsers, isAttachNever,
- isAttachAlways, isHasDeviceAddrFlag, descCanBeDeferred, mapperId);
+ genRefPtrPteeOrDefaultMap(op, builder, target, descriptor, mapMemberUsers,
+ isAttachNever, isAttachAlways,
+ isHasDeviceAddrFlag, descCanBeDeferred,
+ canOptimizeDescViaPrivatization, mapperId);
}
}
diff --git a/flang/test/Lower/OpenMP/array-bounds.f90 b/flang/test/Lower/OpenMP/array-bounds.f90
index a9f2ad448c632..382e559c673ee 100644
--- a/flang/test/Lower/OpenMP/array-bounds.f90
+++ b/flang/test/Lower/OpenMP/array-bounds.f90
@@ -52,7 +52,7 @@ module assumed_array_routines
!HOST: %[[BOUNDS:.*]] = omp.map.bounds lower_bound(%[[C3]] : index) upper_bound(%[[C4]] : index) extent(%[[DIMS1]]#1 : index) stride(%[[DIMS0]]#2 : index) start_idx(%[[C0]] : index) {stride_in_bytes = true}
!HOST: %[[VAR_PTR_PTR:.*]] = fir.box_offset %{{.*}} base_addr : (!fir.ref<!fir.box<!fir.array<?xi32>>>) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>
!HOST: %[[MAP_INFO_MEMBER:.*]] = omp.map.info var_ptr(%[[INTERMEDIATE_ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(tofrom) capture(ByRef) var_ptr_ptr(%[[VAR_PTR_PTR]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, i32) bounds(%[[BOUNDS]]) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>> {name = ""}
-!HOST: %[[MAP:.*]] = omp.map.info var_ptr(%[[INTERMEDIATE_ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(always, to) capture(ByRef) members(%[[MAP_INFO_MEMBER]] : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) -> !fir.ref<!fir.array<?xi32>> {name = "arr_read_write(2:5)"}
+!HOST: %[[MAP:.*]] = omp.map.info var_ptr(%[[INTERMEDIATE_ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(target_param, private, attach) capture(ByRef) var_ptr_ptr(%[[VAR_PTR_PTR]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, i32) members(%[[MAP_INFO_MEMBER]] : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) -> !fir.ref<!fir.array<?xi32>> {name = "arr_read_write(2:5)"}
!HOST: %[[ATTACH_MAP:.*]] = omp.map.info var_ptr(%[[INTERMEDIATE_ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(attach, ref_ptr, ref_ptee) capture(ByRef) var_ptr_ptr(%[[VAR_PTR_PTR]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, i32) bounds(%[[BOUNDS]]) -> !fir.ref<!fir.array<?xi32>> {name = "arr_read_write(2:5)"}
!HOST: omp.target kernel_type(generic) map_entries(%[[MAP]] -> %{{.*}}, {{.*}} -> {{.*}}, %[[ATTACH_MAP]] -> {{.*}}, %[[MAP_INFO_MEMBER]] -> %{{.*}} : !fir.ref<!fir.array<?xi32>>, !fir.ref<i32>, !fir.ref<!fir.array<?xi32>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) {
subroutine assumed_shape_array(arr_read_write)
diff --git a/flang/test/Lower/OpenMP/map-descriptor-deferral.f90 b/flang/test/Lower/OpenMP/map-descriptor-deferral.f90
index fee20612d8bc3..35398f4886dad 100644
--- a/flang/test/Lower/OpenMP/map-descriptor-deferral.f90
+++ b/flang/test/Lower/OpenMP/map-descriptor-deferral.f90
@@ -23,7 +23,7 @@ subroutine assume_map_target_enter_exit(assumed_arr)
!CHECK: omp.target_enter_data map_entries(%[[MAP_ADDR]] : !fir.ref<!fir.array<?xi32>>)
!CHECK: %[[BOX_ADDR:.*]] = fir.box_offset %{{.*}} base_addr : (!fir.ref<!fir.box<!fir.array<?xi32>>>) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>
!CHECK: %[[MAP_ADDR:.*]] = omp.map.info var_ptr(%{{.*}} : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(implicit, tofrom) capture(ByRef) var_ptr_ptr(%[[BOX_ADDR]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, i32) bounds(%{{.*}}) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>> {name = ""}
-!CHECK: %[[MAP_BOX:.*]] = omp.map.info var_ptr(%{{.*}} : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(always, implicit, to) capture(ByRef) members(%{{.*}} : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) -> !fir.ref<!fir.array<?xi32>> {name = "assumed_arr"}
+!CHECK: %[[MAP_BOX:.*]] = omp.map.info var_ptr(%{{.*}} : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(implicit, target_param, private, attach) capture(ByRef) var_ptr_ptr(%{{.*}} : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, i32) members(%{{.*}} : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) -> !fir.ref<!fir.array<?xi32>> {name = "assumed_arr"}
!CHECK: %[[MAP_BOX_ATTACH:.*]] = omp.map.info var_ptr(%{{.*}} : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(attach, ref_ptr, ref_ptee) capture(ByRef) var_ptr_ptr(%{{.*}} : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, i32) bounds(%{{.*}}) -> !fir.ref<!fir.array<?xi32>> {name = "assumed_arr"}
!CHECK: omp.target kernel_type(generic) map_entries(%[[MAP_BOX]] -> %{{.*}}, %[[MAP_BOX_ATTACH]] -> %{{.*}}, %[[MAP_ADDR]] -> %{{.*}} : !fir.ref<!fir.array<?xi32>>, !fir.ref<!fir.array<?xi32>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) {
!CHECK: %[[BOX_ADDR:.*]] = fir.box_offset %{{.*}} base_addr : (!fir.ref<!fir.box<!fir.array<?xi32>>>) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>
@@ -100,6 +100,6 @@ subroutine assume_map_target_data(assumed_arr)
!CHECK: omp.target_data map_entries(%[[MAP_BOX]], %[[ATTACH]], %[[MAP_ADDR]] : !fir.ref<!fir.array<?xi32>>, !fir.ref<!fir.array<?xi32>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) {
!CHECK: %[[BOX_ADDR:.*]] = fir.box_offset %{{.*}} base_addr : (!fir.ref<!fir.box<!fir.array<?xi32>>>) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>
!CHECK: %[[MAP_ADDR:.*]] = omp.map.info var_ptr(%{{.*}} : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(implicit, tofrom) capture(ByRef) var_ptr_ptr(%[[BOX_ADDR]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, i32) bounds(%{{.*}}) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>> {name = ""}
-!CHECK: %[[MAP_BOX:.*]] = omp.map.info var_ptr(%{{.*}} : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(always, implicit, to) capture(ByRef) members(%[[MAP_ADDR]] : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) -> !fir.ref<!fir.array<?xi32>> {name = "assumed_arr"}
+!CHECK: %[[MAP_BOX:.*]] = omp.map.info var_ptr(%{{.*}} : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(implicit, target_param, private, attach) capture(ByRef) var_ptr_ptr(%{{.*}} : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, i32) members(%[[MAP_ADDR]] : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) -> !fir.ref<!fir.array<?xi32>> {name = "assumed_arr"}
!CHECK: %[[ATTACH:.*]] = omp.map.info var_ptr(%{{.*}} : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(attach, ref_ptr, ref_ptee) capture(ByRef) var_ptr_ptr(%{{.*}} : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, i32) bounds(%{{.*}}) -> !fir.ref<!fir.array<?xi32>> {name = "assumed_arr"}
!CHECK: omp.target kernel_type(generic) map_entries(%[[MAP_BOX]] -> %{{.*}}, %[[ATTACH]] -> %{{.*}}, %[[MAP_ADDR]] -> %{{.*}} : !fir.ref<!fir.array<?xi32>>, !fir.ref<!fir.array<?xi32>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) {
diff --git a/flang/test/Lower/OpenMP/map-descriptor-privatization.f90 b/flang/test/Lower/OpenMP/map-descriptor-privatization.f90
new file mode 100644
index 0000000000000..ffa36d19bc263
--- /dev/null
+++ b/flang/test/Lower/OpenMP/map-descriptor-privatization.f90
@@ -0,0 +1,19 @@
+!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
+
+! This test checks the descriptor privatization for assumed arrays verifying the
+! maps have the appropriate map types applied to undergo attach map privatization.
+
+subroutine assumed_shape_array_priv(arr_read_write)
+ integer, intent(inout) :: arr_read_write(:)
+ !$omp target map(tofrom: arr_read_write)
+ arr_read_write(1) = 10
+ !$omp end target
+end subroutine
+
+!CHECK-LABEL: func.func @_QPassumed_shape_array_priv(
+!CHECK: %[[DESC_ALLOCA:.*]] = fir.alloca !fir.box<!fir.array<?xi32>>
+!CHECK: %[[BOX_ADDR:.*]] = fir.box_offset %[[DESC_ALLOCA]] base_addr : (!fir.ref<!fir.box<!fir.array<?xi32>>>) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>
+!CHECK: %[[MAP_MEMBER:.*]] = omp.map.info var_ptr(%[[DESC_ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(tofrom) capture(ByRef) var_ptr_ptr(%[[BOX_ADDR]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, i32) bounds(%{{.*}}) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>> {name = ""}
+!CHECK: %[[MAP_PARENT:.*]] = omp.map.info var_ptr(%[[DESC_ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(target_param, private, attach) capture(ByRef) var_ptr_ptr(%[[BOX_ADDR]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, i32) members(%[[MAP_MEMBER]] : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) -> !fir.ref<!fir.array<?xi32>> {name = "arr_read_write"}
+!CHECK: %[[MAP_ATTACH:.*]] = omp.map.info var_ptr(%[[DESC_ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(attach, ref_ptr, ref_ptee) capture(ByRef) var_ptr_ptr(%[[BOX_ADDR]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, i32) bounds(%{{.*}}) -> !fir.ref<!fir.array<?xi32>> {name = "arr_read_write"}
+!CHECK: omp.target kernel_type(generic) map_entries(%[[MAP_PARENT]] -> %{{.*}}, %[[MAP_ATTACH]] -> %{{.*}}, %[[MAP_MEMBER]] -> %{{.*}} : !fir.ref<!fir.array<?xi32>>, !fir.ref<!fir.array<?xi32>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) {
diff --git a/flang/test/Lower/OpenMP/optional-argument-map-3.f90 b/flang/test/Lower/OpenMP/optional-argument-map-3.f90
index 2a0c78d50af96..a7b7b06f21bfd 100644
--- a/flang/test/Lower/OpenMP/optional-argument-map-3.f90
+++ b/flang/test/Lower/OpenMP/optional-argument-map-3.f90
@@ -33,7 +33,7 @@ end subroutine foo
! CHECK: }
! CHECK: %[[VAL_3:.*]] = fir.box_offset %[[VAL_0]] base_addr : (!fir.ref<!fir.box<!fir.array<?xf32>>>) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>
! CHECK: %[[VAL_4:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref<!fir.box<!fir.array<?xf32>>>, !fir.box<!fir.array<?xf32>>) map_clauses(implicit, tofrom) capture(ByRef) var_ptr_ptr(%[[VAL_3]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>, f32) bounds(%{{.*}}) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>> {name = ""}
-! CHECK: %[[VAL_5:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref<!fir.box<!fir.array<?xf32>>>, !fir.box<!fir.array<?xf32>>) map_clauses(always, implicit, to) capture(ByRef) members(%[[VAL_4]] : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>) -> !fir.ref<!fir.array<?xf32>> {name = "dt"}
+! CHECK: %[[VAL_5:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref<!fir.box<!fir.array<?xf32>>>, !fir.box<!fir.array<?xf32>>) map_clauses(implicit, target_param, private, attach) capture(ByRef) var_ptr_ptr(%[[VAL_3]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>, f32) members(%[[VAL_4]] : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>) -> !fir.ref<!fir.array<?xf32>> {name = "dt"}
! CHECK: omp.target kernel_type(spmd) host_eval({{.*}}) map_entries({{.*}}%[[VAL_5]] -> {{.*}}, %[[VAL_4]] -> {{.*}} : {{.*}}) {
! CHECK: } else {
! CHECK: %[[VAL_6:.*]] = fir.is_present %[[VAL_1]]#1 : (!fir.box<!fir.array<?xf32>>) -> i1
@@ -42,5 +42,5 @@ end subroutine foo
! CHECK: }
! CHECK: %[[VAL_7:.*]] = fir.box_offset %[[VAL_0]] base_addr : (!fir.ref<!fir.box<!fir.array<?xf32>>>) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>
! CHECK: %[[VAL_8:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref<!fir.box<!fir.array<?xf32>>>, !fir.box<!fir.array<?xf32>>) map_clauses(implicit, tofrom) capture(ByRef) var_ptr_ptr(%[[VAL_7]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>, f32) bounds(%{{.*}}) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>> {name = ""}
-! CHECK: %[[VAL_9:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref<!fir.box<!fir.array<?xf32>>>, !fir.box<!fir.array<?xf32>>) map_clauses(always, implicit, to) capture(ByRef) members(%[[VAL_8]] : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>) -> !fir.ref<!fir.array<?xf32>> {name = "dt"}
+! CHECK: %[[VAL_9:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !fir.ref<!fir.box<!fir.array<?xf32>>>, !fir.box<!fir.array<?xf32>>) map_clauses(implicit, target_param, private, attach) capture(ByRef) var_ptr_ptr(%[[VAL_7]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>, f32) members(%[[VAL_8]] : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>) -> !fir.ref<!fir.array<?xf32>> {name = "dt"}
! CHECK: omp.target kernel_type(spmd) host_eval({{.*}}) map_entries({{.*}}, %[[VAL_9]] ->{{.*}}, %[[VAL_8]] -> {{.*}} : {{.*}}) {
diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPEnums.td b/mlir/include/...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/212336
More information about the flang-commits
mailing list