From 82330e2b07a39b39cf0827248f55a906243183ff Mon Sep 17 00:00:00 2001 From: Akash Banerjee Date: Wed, 20 Nov 2024 20:44:23 +0000 Subject: [PATCH 1/9] [MLIR][OpenMP] Add OMP Declare Mapper MLIR Op definition This patch adds the OMP.DeclareMapperOp to MLIR. --- mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | 28 +++++++++++++++++++ mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | 8 ++++++ mlir/test/Dialect/OpenMP/ops.mlir | 8 ++++++ 3 files changed, 44 insertions(+) diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td index 983627027ac9c..2d2a33ccc9ec8 100644 --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -1749,6 +1749,34 @@ def ScanOp : OpenMP_Op<"scan", [ let hasVerifier = 1; } +//===----------------------------------------------------------------------===// +// 2.19.7.3 Declare Mapper Directive +//===----------------------------------------------------------------------===// +def DeclareMapperOp : OpenMP_Op<"declare_mapper", traits = [ + Symbol], clauses = [ + OpenMP_MapClause + ]> { + let summary = "declare mapper directive"; + let description = [{ + The declare mapper directive declares a user-defined mapper for a given + type, and may define a mapper-identifier that can be used in a map clause. + }] # clausesDescription; + + let arguments = !con((ins SymbolNameAttr:$sym_name, + OpenMP_PointerLikeType:$var_ptr, + TypeAttr:$var_type), clausesArgs); + + let builders = [ + OpBuilder<(ins CArg<"const DeclareMapperOperands &">:$clauses)> + ]; + + // Override clause-based assemblyFormat. + let assemblyFormat = "$sym_name `:` $var_ptr `:` type($var_ptr) `:` $var_type" # " oilist(" # + clausesOptAssemblyFormat # ") attr-dict"; + + let hasVerifier = 1; +} + //===----------------------------------------------------------------------===// // 2.19.5.7 declare reduction Directive //===----------------------------------------------------------------------===// diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp index 5ec840e7fef81..41e9bc6196539 100644 --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -2432,6 +2432,14 @@ LogicalResult DistributeOp::verifyRegions() { return success(); } +//===----------------------------------------------------------------------===// +// DeclareMapperOp +//===----------------------------------------------------------------------===// + +LogicalResult DeclareMapperOp::verify() { + return verifyMapClause(*this, getMapVars()); +} + //===----------------------------------------------------------------------===// // DeclareReductionOp //===----------------------------------------------------------------------===// diff --git a/mlir/test/Dialect/OpenMP/ops.mlir b/mlir/test/Dialect/OpenMP/ops.mlir index aca63600876aa..a41d005e1caaf 100644 --- a/mlir/test/Dialect/OpenMP/ops.mlir +++ b/mlir/test/Dialect/OpenMP/ops.mlir @@ -879,6 +879,14 @@ cleanup { omp.yield } +// CHECK: %[[DECL_VAR:.*]] = llvm.alloca %{{.*}} +// CHECK: %[[DECL_MAP_INFO:.*]] = omp.map.info var_ptr(%[[DECL_VAR]] : !llvm.ptr, !llvm.struct<"my_type", (i32)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""} +// CHECK: omp.declare_mapper @my_mapper : %[[DECL_VAR]] : !llvm.ptr : !llvm.struct<"my_type", (i32)> map_entries(%[[DECL_MAP_INFO]] : !llvm.ptr) +%decl_c1 = arith.constant 1 : i64 +%decl_var = llvm.alloca %decl_c1 x !llvm.struct<"my_type", (i32)> : (i64) -> !llvm.ptr +%decl_map_info = omp.map.info var_ptr(%decl_var : !llvm.ptr, !llvm.struct<"my_type", (i32)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""} +omp.declare_mapper @my_mapper : %decl_var : !llvm.ptr : !llvm.struct<"my_type", (i32)> map_entries(%decl_map_info : !llvm.ptr) + // CHECK-LABEL: func @wsloop_reduction func.func @wsloop_reduction(%lb : index, %ub : index, %step : index) { %c1 = arith.constant 1 : i32 From 50eb188180b4c8d58078bedc02dba6067a9753af Mon Sep 17 00:00:00 2001 From: Akash Banerjee Date: Fri, 22 Nov 2024 12:06:29 +0000 Subject: [PATCH 2/9] Updated description. --- mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td index 2d2a33ccc9ec8..bd2f62f3dbf91 100644 --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -1759,7 +1759,7 @@ def DeclareMapperOp : OpenMP_Op<"declare_mapper", traits = [ let summary = "declare mapper directive"; let description = [{ The declare mapper directive declares a user-defined mapper for a given - type, and may define a mapper-identifier that can be used in a map clause. + type, and defines a mapper-identifier that can be used in a map clause. }] # clausesDescription; let arguments = !con((ins SymbolNameAttr:$sym_name, From 0e532b3d53c63a8b8e5616024224ab94a407bd27 Mon Sep 17 00:00:00 2001 From: Akash Banerjee Date: Wed, 27 Nov 2024 19:05:26 +0000 Subject: [PATCH 3/9] Add region to DeclMapperOp. Move map clause to new DeclMapperInfoOp. --- mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | 32 +++++++++++-------- mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | 4 +-- mlir/test/Dialect/OpenMP/ops.mlir | 16 ++++++---- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td index bd2f62f3dbf91..3f2d961e700b8 100644 --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -653,7 +653,7 @@ def DistributeOp : OpenMP_Op<"distribute", traits = [ will be executed in parallel by threads in the current context. These iterations are spread across threads that already exist in the enclosing region. - + The body region can only contain a single block which must contain a single operation. This operation must be another compatible loop wrapper or an `omp.loop_nest`. @@ -1752,28 +1752,32 @@ def ScanOp : OpenMP_Op<"scan", [ //===----------------------------------------------------------------------===// // 2.19.7.3 Declare Mapper Directive //===----------------------------------------------------------------------===// -def DeclareMapperOp : OpenMP_Op<"declare_mapper", traits = [ - Symbol], clauses = [ - OpenMP_MapClause - ]> { +def DeclareMapperOp : OpenMP_Op<"declare_mapper", singleRegion = 1> { let summary = "declare mapper directive"; let description = [{ The declare mapper directive declares a user-defined mapper for a given type, and defines a mapper-identifier that can be used in a map clause. }] # clausesDescription; - let arguments = !con((ins SymbolNameAttr:$sym_name, - OpenMP_PointerLikeType:$var_ptr, - TypeAttr:$var_type), clausesArgs); + let arguments = (ins SymbolNameAttr:$sym_name, + TypeAttr:$var_type); + + let assemblyFormat = "$sym_name `:` $var_type $region attr-dict"; +} + +def DeclareMapperInfoOp : OpenMP_Op<"declare_mapper_info", clauses = [ + OpenMP_MapClause + ]> { + let summary = "declare mapper info"; + let description = [{ + This Op is used to capture the map information related to it's + parent DeclareMapperOp.]> + }] # clausesDescription; let builders = [ - OpBuilder<(ins CArg<"const DeclareMapperOperands &">:$clauses)> + OpBuilder<(ins CArg<"const DeclareMapperInfoOperands &">:$clauses)> ]; - // Override clause-based assemblyFormat. - let assemblyFormat = "$sym_name `:` $var_ptr `:` type($var_ptr) `:` $var_type" # " oilist(" # - clausesOptAssemblyFormat # ") attr-dict"; - let hasVerifier = 1; } @@ -1889,7 +1893,7 @@ def MaskedOp : OpenMP_Op<"masked", clauses = [ ], singleRegion = 1> { let summary = "masked construct"; let description = [{ - Masked construct allows to specify a structured block to be executed by a subset of + Masked construct allows to specify a structured block to be executed by a subset of threads of the current team. }] # clausesDescription; diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp index 41e9bc6196539..dbf3221ce2072 100644 --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -2433,10 +2433,10 @@ LogicalResult DistributeOp::verifyRegions() { } //===----------------------------------------------------------------------===// -// DeclareMapperOp +// DeclareMapperInfoOp //===----------------------------------------------------------------------===// -LogicalResult DeclareMapperOp::verify() { +LogicalResult DeclareMapperInfoOp::verify() { return verifyMapClause(*this, getMapVars()); } diff --git a/mlir/test/Dialect/OpenMP/ops.mlir b/mlir/test/Dialect/OpenMP/ops.mlir index a41d005e1caaf..a78fc9de5e4c0 100644 --- a/mlir/test/Dialect/OpenMP/ops.mlir +++ b/mlir/test/Dialect/OpenMP/ops.mlir @@ -879,13 +879,15 @@ cleanup { omp.yield } -// CHECK: %[[DECL_VAR:.*]] = llvm.alloca %{{.*}} -// CHECK: %[[DECL_MAP_INFO:.*]] = omp.map.info var_ptr(%[[DECL_VAR]] : !llvm.ptr, !llvm.struct<"my_type", (i32)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""} -// CHECK: omp.declare_mapper @my_mapper : %[[DECL_VAR]] : !llvm.ptr : !llvm.struct<"my_type", (i32)> map_entries(%[[DECL_MAP_INFO]] : !llvm.ptr) -%decl_c1 = arith.constant 1 : i64 -%decl_var = llvm.alloca %decl_c1 x !llvm.struct<"my_type", (i32)> : (i64) -> !llvm.ptr -%decl_map_info = omp.map.info var_ptr(%decl_var : !llvm.ptr, !llvm.struct<"my_type", (i32)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""} -omp.declare_mapper @my_mapper : %decl_var : !llvm.ptr : !llvm.struct<"my_type", (i32)> map_entries(%decl_map_info : !llvm.ptr) +// CHECK: omp.declare_mapper @my_mapper : !llvm.struct<"my_type", (i32)> +omp.declare_mapper @my_mapper : !llvm.struct<"my_type", (i32)> { +^bb0(%arg: !llvm.ptr): + // CHECK: %[[DECL_MAP_INFO:.*]] = omp.map.info var_ptr(%{{.*}} : !llvm.ptr, !llvm.struct<"my_type", (i32)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""} + %decl_map_info = omp.map.info var_ptr(%arg : !llvm.ptr, !llvm.struct<"my_type", (i32)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""} + // CHECK: omp.declare_mapper_info map_entries(%[[DECL_MAP_INFO]] : !llvm.ptr) + omp.declare_mapper_info map_entries(%decl_map_info : !llvm.ptr) + omp.terminator +} // CHECK-LABEL: func @wsloop_reduction func.func @wsloop_reduction(%lb : index, %ub : index, %step : index) { From 17d28df319c8f25f918def0f41a21a6907d0cfe9 Mon Sep 17 00:00:00 2001 From: Akash Banerjee Date: Mon, 23 Dec 2024 14:59:02 +0000 Subject: [PATCH 4/9] Add the necesary OpTraits to hoist the DeclareMapperOp to the ModuleOp's region. --- mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | 19 +++++++++++++++---- mlir/test/Dialect/OpenMP/ops.mlir | 1 - 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td index 3f2d961e700b8..553971ba973ce 100644 --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -1752,7 +1752,14 @@ def ScanOp : OpenMP_Op<"scan", [ //===----------------------------------------------------------------------===// // 2.19.7.3 Declare Mapper Directive //===----------------------------------------------------------------------===// -def DeclareMapperOp : OpenMP_Op<"declare_mapper", singleRegion = 1> { +def DeclareMapperOp : OpenMP_Op<"declare_mapper", [ + AffineScope, + AutomaticAllocationScope, + IsolatedFromAbove, + OutlineableOpenMPOpInterface, + RecipeInterface, + Symbol + ]> { let summary = "declare mapper directive"; let description = [{ The declare mapper directive declares a user-defined mapper for a given @@ -1762,12 +1769,16 @@ def DeclareMapperOp : OpenMP_Op<"declare_mapper", singleRegion = 1> { let arguments = (ins SymbolNameAttr:$sym_name, TypeAttr:$var_type); - let assemblyFormat = "$sym_name `:` $var_type $region attr-dict"; + let regions = (region AnyRegion:$body); + + let assemblyFormat = "$sym_name `:` $var_type $body attr-dict"; } -def DeclareMapperInfoOp : OpenMP_Op<"declare_mapper_info", clauses = [ +def DeclareMapperInfoOp : OpenMP_Op<"declare_mapper_info", [ + Terminator + ], clauses = [ OpenMP_MapClause - ]> { + ]> { let summary = "declare mapper info"; let description = [{ This Op is used to capture the map information related to it's diff --git a/mlir/test/Dialect/OpenMP/ops.mlir b/mlir/test/Dialect/OpenMP/ops.mlir index a78fc9de5e4c0..5727d5ffd2dbe 100644 --- a/mlir/test/Dialect/OpenMP/ops.mlir +++ b/mlir/test/Dialect/OpenMP/ops.mlir @@ -886,7 +886,6 @@ omp.declare_mapper @my_mapper : !llvm.struct<"my_type", (i32)> { %decl_map_info = omp.map.info var_ptr(%arg : !llvm.ptr, !llvm.struct<"my_type", (i32)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""} // CHECK: omp.declare_mapper_info map_entries(%[[DECL_MAP_INFO]] : !llvm.ptr) omp.declare_mapper_info map_entries(%decl_map_info : !llvm.ptr) - omp.terminator } // CHECK-LABEL: func @wsloop_reduction From 38ce5eb834bbb5f13176ba95dddf2b8295c121e3 Mon Sep 17 00:00:00 2001 From: Akash Banerjee Date: Fri, 7 Feb 2025 17:21:52 +0000 Subject: [PATCH 5/9] Address reviewer commits. --- mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | 13 ++++++------- mlir/test/Dialect/OpenMP/ops.mlir | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td index 553971ba973ce..406eac1015556 100644 --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -1753,11 +1753,9 @@ def ScanOp : OpenMP_Op<"scan", [ // 2.19.7.3 Declare Mapper Directive //===----------------------------------------------------------------------===// def DeclareMapperOp : OpenMP_Op<"declare_mapper", [ - AffineScope, - AutomaticAllocationScope, IsolatedFromAbove, - OutlineableOpenMPOpInterface, RecipeInterface, + SingleBlock, Symbol ]> { let summary = "declare mapper directive"; @@ -1767,14 +1765,15 @@ def DeclareMapperOp : OpenMP_Op<"declare_mapper", [ }] # clausesDescription; let arguments = (ins SymbolNameAttr:$sym_name, - TypeAttr:$var_type); + TypeAttr:$type); let regions = (region AnyRegion:$body); - let assemblyFormat = "$sym_name `:` $var_type $body attr-dict"; + let assemblyFormat = "$sym_name `:` $type $body attr-dict"; } -def DeclareMapperInfoOp : OpenMP_Op<"declare_mapper_info", [ +def DeclareMapperInfoOp : OpenMP_Op<"declare_mapper.info", [ + HasParent<"DeclareMapperOp">, Terminator ], clauses = [ OpenMP_MapClause @@ -1782,7 +1781,7 @@ def DeclareMapperInfoOp : OpenMP_Op<"declare_mapper_info", [ let summary = "declare mapper info"; let description = [{ This Op is used to capture the map information related to it's - parent DeclareMapperOp.]> + parent DeclareMapperOp. }] # clausesDescription; let builders = [ diff --git a/mlir/test/Dialect/OpenMP/ops.mlir b/mlir/test/Dialect/OpenMP/ops.mlir index 5727d5ffd2dbe..f00d3d3426631 100644 --- a/mlir/test/Dialect/OpenMP/ops.mlir +++ b/mlir/test/Dialect/OpenMP/ops.mlir @@ -884,8 +884,8 @@ omp.declare_mapper @my_mapper : !llvm.struct<"my_type", (i32)> { ^bb0(%arg: !llvm.ptr): // CHECK: %[[DECL_MAP_INFO:.*]] = omp.map.info var_ptr(%{{.*}} : !llvm.ptr, !llvm.struct<"my_type", (i32)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""} %decl_map_info = omp.map.info var_ptr(%arg : !llvm.ptr, !llvm.struct<"my_type", (i32)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""} - // CHECK: omp.declare_mapper_info map_entries(%[[DECL_MAP_INFO]] : !llvm.ptr) - omp.declare_mapper_info map_entries(%decl_map_info : !llvm.ptr) + // CHECK: omp.declare_mapper.info map_entries(%[[DECL_MAP_INFO]] : !llvm.ptr) + omp.declare_mapper.info map_entries(%decl_map_info : !llvm.ptr) } // CHECK-LABEL: func @wsloop_reduction From 4d0fff3b9c831c68eab1d483a95e6722f54e3058 Mon Sep 17 00:00:00 2001 From: Akash Banerjee Date: Mon, 10 Feb 2025 15:51:12 +0000 Subject: [PATCH 6/9] Add getDeclareMapperInfo helper function and verifier check for declareMapperOp terminator. --- mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | 9 +++++++++ mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | 10 +++++++++- mlir/test/Dialect/OpenMP/invalid.mlir | 7 +++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td index 406eac1015556..d9d8856f0b726 100644 --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -1770,6 +1770,15 @@ def DeclareMapperOp : OpenMP_Op<"declare_mapper", [ let regions = (region AnyRegion:$body); let assemblyFormat = "$sym_name `:` $type $body attr-dict"; + + let extraClassDeclaration = [{ + /// Get DeclareMapperInfoOp. + DeclareMapperInfoOp getDeclareMapperInfo(){ + return cast(getRegion().getBlocks().front().getTerminator()); + } + }]; + + let hasRegionVerifier = 1; } def DeclareMapperInfoOp : OpenMP_Op<"declare_mapper.info", [ diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp index dbf3221ce2072..283d9e269f8b4 100644 --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -2433,13 +2433,21 @@ LogicalResult DistributeOp::verifyRegions() { } //===----------------------------------------------------------------------===// -// DeclareMapperInfoOp +// DeclareMapperOp / DeclareMapperInfoOp //===----------------------------------------------------------------------===// LogicalResult DeclareMapperInfoOp::verify() { return verifyMapClause(*this, getMapVars()); } +LogicalResult DeclareMapperOp::verifyRegions() { + if (!isa( + getRegion().getBlocks().front().getTerminator())) + return emitOpError() << "expected terminator to be a DeclareMapperInfoOp"; + + return success(); +} + //===----------------------------------------------------------------------===// // DeclareReductionOp //===----------------------------------------------------------------------===// diff --git a/mlir/test/Dialect/OpenMP/invalid.mlir b/mlir/test/Dialect/OpenMP/invalid.mlir index 02b0af17564d4..a2d34a88d2ebe 100644 --- a/mlir/test/Dialect/OpenMP/invalid.mlir +++ b/mlir/test/Dialect/OpenMP/invalid.mlir @@ -2842,3 +2842,10 @@ func.func @missing_workshare(%idx : index) { } return } + +// ----- + // expected-error @below {{op expected terminator to be a DeclareMapperInfoOp}} + omp.declare_mapper @missing_declareMapperInfo : !llvm.struct<"mytype", (array<1024 x i32>)> { + ^bb0(%arg0: !llvm.ptr): + omp.terminator + } From ccf0f40cdccd419e7c173c6bc5e1bc6a4a2d1fc6 Mon Sep 17 00:00:00 2001 From: Akash Banerjee Date: Mon, 10 Feb 2025 19:51:06 +0000 Subject: [PATCH 7/9] Add getSymVal helper function. --- mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td index d9d8856f0b726..e1eef30c0dd06 100644 --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -1776,6 +1776,11 @@ def DeclareMapperOp : OpenMP_Op<"declare_mapper", [ DeclareMapperInfoOp getDeclareMapperInfo(){ return cast(getRegion().getBlocks().front().getTerminator()); } + + /// Get SymVal block argument + BlockArgument getSymVal(){ + return getRegion().getArgument(0); + } }]; let hasRegionVerifier = 1; From bc702ecbf8da365c2c5db635458178de50e7cc19 Mon Sep 17 00:00:00 2001 From: Akash Banerjee Date: Tue, 11 Feb 2025 15:46:48 +0000 Subject: [PATCH 8/9] Change isa to isa_and_present. --- mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp index 283d9e269f8b4..60cf4045344a6 100644 --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -32,6 +32,7 @@ #include "llvm/ADT/TypeSwitch.h" #include "llvm/Frontend/OpenMP/OMPConstants.h" #include "llvm/Frontend/OpenMP/OMPDeviceConstants.h" +#include "llvm/Support/Casting.h" #include #include #include @@ -2441,7 +2442,7 @@ LogicalResult DeclareMapperInfoOp::verify() { } LogicalResult DeclareMapperOp::verifyRegions() { - if (!isa( + if (!llvm::isa_and_present( getRegion().getBlocks().front().getTerminator())) return emitOpError() << "expected terminator to be a DeclareMapperInfoOp"; From 0c77525bfaea4613ae1ab06b9d3ac9471c9554d3 Mon Sep 17 00:00:00 2001 From: Akash Banerjee Date: Tue, 18 Feb 2025 16:10:23 +0000 Subject: [PATCH 9/9] Remove header file. --- mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp index 60cf4045344a6..c067c2d0a0255 100644 --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -32,7 +32,6 @@ #include "llvm/ADT/TypeSwitch.h" #include "llvm/Frontend/OpenMP/OMPConstants.h" #include "llvm/Frontend/OpenMP/OMPDeviceConstants.h" -#include "llvm/Support/Casting.h" #include #include #include