Skip to content

Commit 21178b0

Browse files
committed
Add mapper field to mapInfoOp.
1 parent 7e504c8 commit 21178b0

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,7 @@ def MapInfoOp : OpenMP_Op<"map.info", [AttrSizedOperandSegments]> {
10001000
OptionalAttr<IndexListArrayAttr>:$members_index,
10011001
Variadic<OpenMP_MapBoundsType>:$bounds, /* rank-0 to rank-{n-1} */
10021002
OptionalAttr<UI64Attr>:$map_type,
1003+
OptionalAttr<FlatSymbolRefAttr>:$mapper_id,
10031004
OptionalAttr<VariableCaptureKindAttr>:$map_capture_type,
10041005
OptionalAttr<StrAttr>:$name,
10051006
DefaultValuedAttr<BoolAttr, "false">:$partial_map);
@@ -1064,6 +1065,7 @@ def MapInfoOp : OpenMP_Op<"map.info", [AttrSizedOperandSegments]> {
10641065
`var_ptr` `(` $var_ptr `:` type($var_ptr) `,` $var_type `)`
10651066
oilist(
10661067
`var_ptr_ptr` `(` $var_ptr_ptr `:` type($var_ptr_ptr) `)`
1068+
| `mapper` `(` $mapper_id `)`
10671069
| `map_clauses` `(` custom<MapClause>($map_type) `)`
10681070
| `capture` `(` custom<CaptureType>($map_capture_type) `)`
10691071
| `members` `(` $members `:` custom<MembersIndex>($members_index) `:` type($members) `)`

mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,7 @@ static LogicalResult verifyMapClause(Operation *op, OperandRange mapVars) {
15921592

15931593
to ? updateToVars.insert(updateVar) : updateFromVars.insert(updateVar);
15941594
}
1595-
} else {
1595+
} else if (!isa<DeclareMapperInfoOp>(op)) {
15961596
emitError(op->getLoc(), "map argument is not a map entry operation");
15971597
}
15981598
}

mlir/test/Dialect/OpenMP/ops.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2523,13 +2523,13 @@ func.func @omp_targets_with_map_bounds(%arg0: !llvm.ptr, %arg1: !llvm.ptr) -> ()
25232523
// CHECK: %[[C_12:.*]] = llvm.mlir.constant(2 : index) : i64
25242524
// CHECK: %[[C_13:.*]] = llvm.mlir.constant(2 : index) : i64
25252525
// CHECK: %[[BOUNDS1:.*]] = omp.map.bounds lower_bound(%[[C_11]] : i64) upper_bound(%[[C_10]] : i64) stride(%[[C_12]] : i64) start_idx(%[[C_13]] : i64)
2526-
// CHECK: %[[MAP1:.*]] = omp.map.info var_ptr(%[[ARG1]] : !llvm.ptr, !llvm.array<10 x i32>) map_clauses(exit_release_or_enter_alloc) capture(ByCopy) bounds(%[[BOUNDS1]]) -> !llvm.ptr {name = ""}
2526+
// CHECK: %[[MAP1:.*]] = omp.map.info var_ptr(%[[ARG1]] : !llvm.ptr, !llvm.array<10 x i32>) mapper(@my_mapper) map_clauses(exit_release_or_enter_alloc) capture(ByCopy) bounds(%[[BOUNDS1]]) -> !llvm.ptr {name = ""}
25272527
%6 = llvm.mlir.constant(9 : index) : i64
25282528
%7 = llvm.mlir.constant(1 : index) : i64
25292529
%8 = llvm.mlir.constant(2 : index) : i64
25302530
%9 = llvm.mlir.constant(2 : index) : i64
25312531
%10 = omp.map.bounds lower_bound(%7 : i64) upper_bound(%6 : i64) stride(%8 : i64) start_idx(%9 : i64)
2532-
%mapv2 = omp.map.info var_ptr(%arg1 : !llvm.ptr, !llvm.array<10 x i32>) map_clauses(exit_release_or_enter_alloc) capture(ByCopy) bounds(%10) -> !llvm.ptr {name = ""}
2532+
%mapv2 = omp.map.info var_ptr(%arg1 : !llvm.ptr, !llvm.array<10 x i32>) mapper(@my_mapper) map_clauses(exit_release_or_enter_alloc) capture(ByCopy) bounds(%10) -> !llvm.ptr {name = ""}
25332533

25342534
// CHECK: omp.target map_entries(%[[MAP0]] -> {{.*}}, %[[MAP1]] -> {{.*}} : !llvm.ptr, !llvm.ptr)
25352535
omp.target map_entries(%mapv1 -> %arg2, %mapv2 -> %arg3 : !llvm.ptr, !llvm.ptr) {

0 commit comments

Comments
 (0)