[Mlir-commits] [mlir] 72e9447 - [MLIR][OpenMP] Allow the single operation to have a region
Kiran Chandramohan
llvmlistbot at llvm.org
Mon Oct 31 03:48:41 PDT 2022
Author: Kiran Chandramohan
Date: 2022-10-31T10:48:14Z
New Revision: 72e9447e29abf111c742da59afe4152150a2f8e7
URL: https://github.com/llvm/llvm-project/commit/72e9447e29abf111c742da59afe4152150a2f8e7
DIFF: https://github.com/llvm/llvm-project/commit/72e9447e29abf111c742da59afe4152150a2f8e7.diff
LOG: [MLIR][OpenMP] Allow the single operation to have a region
The OpenMP standard specifies the region inside to be a structured
block. This means that branches into or out of the region is not
permitted but branches are permitted inside the OpenMP single region.
This is currently modeled by having a region of kind `AnyRegion` for
all the OpenMP ops. In future we can have a more strictly defined
region.
Fixes #58396.
Reviewed By: peixin
Differential Revision: https://reviews.llvm.org/D137023
Added:
Modified:
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
mlir/test/Dialect/OpenMP/ops.mlir
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
index 800da7c1e4448..e6fde2d786469 100644
--- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
+++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
@@ -229,7 +229,7 @@ def SingleOp : OpenMP_Op<"single", [AttrSizedOperandSegments]> {
Variadic<AnyType>:$allocators_vars,
UnitAttr:$nowait);
- let regions = (region SizedRegion<1>:$region);
+ let regions = (region AnyRegion:$region);
let assemblyFormat = [{
oilist(`allocate` `(`
diff --git a/mlir/test/Dialect/OpenMP/ops.mlir b/mlir/test/Dialect/OpenMP/ops.mlir
index 51b7dbacaef79..74dc12e86175d 100644
--- a/mlir/test/Dialect/OpenMP/ops.mlir
+++ b/mlir/test/Dialect/OpenMP/ops.mlir
@@ -1349,6 +1349,18 @@ func.func @omp_single_allocate_nowait(%data_var: memref<i32>) {
return
}
+// CHECK-LABEL: func @omp_single_multiple_blocks
+func.func @omp_single_multiple_blocks() {
+ // CHECK: omp.single {
+ omp.single {
+ cf.br ^bb2
+ ^bb2:
+ // CHECK: omp.terminator
+ omp.terminator
+ }
+ return
+}
+
// CHECK-LABEL: @omp_task
// CHECK-SAME: (%[[bool_var:.*]]: i1, %[[i64_var:.*]]: i64, %[[i32_var:.*]]: i32, %[[data_var:.*]]: memref<i32>)
func.func @omp_task(%bool_var: i1, %i64_var: i64, %i32_var: i32, %data_var: memref<i32>) {
More information about the Mlir-commits
mailing list