Skip to content

Commit 17d28df

Browse files
committed
Add the necesary OpTraits to hoist the DeclareMapperOp to the ModuleOp's region.
1 parent 0e532b3 commit 17d28df

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
@@ -1752,7 +1752,14 @@ def ScanOp : OpenMP_Op<"scan", [
17521752
//===----------------------------------------------------------------------===//
17531753
// 2.19.7.3 Declare Mapper Directive
17541754
//===----------------------------------------------------------------------===//
1755-
def DeclareMapperOp : OpenMP_Op<"declare_mapper", singleRegion = 1> {
1755+
def DeclareMapperOp : OpenMP_Op<"declare_mapper", [
1756+
AffineScope,
1757+
AutomaticAllocationScope,
1758+
IsolatedFromAbove,
1759+
OutlineableOpenMPOpInterface,
1760+
RecipeInterface,
1761+
Symbol
1762+
]> {
17561763
let summary = "declare mapper directive";
17571764
let description = [{
17581765
The declare mapper directive declares a user-defined mapper for a given
@@ -1762,12 +1769,16 @@ def DeclareMapperOp : OpenMP_Op<"declare_mapper", singleRegion = 1> {
17621769
let arguments = (ins SymbolNameAttr:$sym_name,
17631770
TypeAttr:$var_type);
17641771

1765-
let assemblyFormat = "$sym_name `:` $var_type $region attr-dict";
1772+
let regions = (region AnyRegion:$body);
1773+
1774+
let assemblyFormat = "$sym_name `:` $var_type $body attr-dict";
17661775
}
17671776

1768-
def DeclareMapperInfoOp : OpenMP_Op<"declare_mapper_info", clauses = [
1777+
def DeclareMapperInfoOp : OpenMP_Op<"declare_mapper_info", [
1778+
Terminator
1779+
], clauses = [
17691780
OpenMP_MapClause
1770-
]> {
1781+
]> {
17711782
let summary = "declare mapper info";
17721783
let description = [{
17731784
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)