Skip to content

Commit 4b5c92e

Browse files
committed
Add the necesary OpTraits to hoist the DeclareMapperOp to the ModuleOp's region.
1 parent d96aaa0 commit 4b5c92e

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,14 @@ def CancellationPointOp : OpenMP_Op<"cancellation_point", clauses = [
16921692
//===----------------------------------------------------------------------===//
16931693
// 2.19.7.3 Declare Mapper Directive
16941694
//===----------------------------------------------------------------------===//
1695-
def DeclareMapperOp : OpenMP_Op<"declare_mapper", singleRegion = 1> {
1695+
def DeclareMapperOp : OpenMP_Op<"declare_mapper", [
1696+
AffineScope,
1697+
AutomaticAllocationScope,
1698+
IsolatedFromAbove,
1699+
OutlineableOpenMPOpInterface,
1700+
RecipeInterface,
1701+
Symbol
1702+
]> {
16961703
let summary = "declare mapper directive";
16971704
let description = [{
16981705
The declare mapper directive declares a user-defined mapper for a given
@@ -1702,12 +1709,16 @@ def DeclareMapperOp : OpenMP_Op<"declare_mapper", singleRegion = 1> {
17021709
let arguments = (ins SymbolNameAttr:$sym_name,
17031710
TypeAttr:$var_type);
17041711

1705-
let assemblyFormat = "$sym_name `:` $var_type $region attr-dict";
1712+
let regions = (region AnyRegion:$body);
1713+
1714+
let assemblyFormat = "$sym_name `:` $var_type $body attr-dict";
17061715
}
17071716

1708-
def DeclareMapperInfoOp : OpenMP_Op<"declare_mapper_info", clauses = [
1717+
def DeclareMapperInfoOp : OpenMP_Op<"declare_mapper_info", [
1718+
Terminator
1719+
], clauses = [
17091720
OpenMP_MapClause
1710-
]> {
1721+
]> {
17111722
let summary = "declare mapper info";
17121723
let description = [{
17131724
This Op is used to capture the map information related to it's

mlir/test/Dialect/OpenMP/ops.mlir

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,6 @@ omp.declare_mapper @my_mapper : !llvm.struct<"my_type", (i32)> {
886886
%decl_map_info = omp.map.info var_ptr(%arg : !llvm.ptr, !llvm.struct<"my_type", (i32)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
887887
// CHECK: omp.declare_mapper_info map_entries(%[[DECL_MAP_INFO]] : !llvm.ptr)
888888
omp.declare_mapper_info map_entries(%decl_map_info : !llvm.ptr)
889-
omp.terminator
890889
}
891890

892891
// CHECK-LABEL: func @wsloop_reduction

0 commit comments

Comments
 (0)