[Mlir-commits] [mlir] [mlir][OpenMP] Add optional alloc region to reduction decl (PR #102522)

Sergio Afonso llvmlistbot at llvm.org
Thu Aug 22 03:05:55 PDT 2024


================
@@ -1550,12 +1561,14 @@ def DeclareReductionOp : OpenMP_Op<"declare_reduction", [IsolatedFromAbove,
   let arguments = (ins SymbolNameAttr:$sym_name,
                        TypeAttr:$type);
 
-  let regions = (region AnyRegion:$initializerRegion,
+  let regions = (region MaxSizedRegion<1>:$allocRegion,
+                        AnyRegion:$initializerRegion,
                         AnyRegion:$reductionRegion,
                         AnyRegion:$atomicReductionRegion,
                         AnyRegion:$cleanupRegion);
 
   let assemblyFormat = "$sym_name `:` $type attr-dict-with-keyword "
+                       "custom<AllocReductionRegion>($allocRegion) "
----------------
skatrak wrote:

Nit: It seems a bit overkill defining all these custom printers/parsers just to define optional regions. Wouldn't something like this achieve the same? In any case, it was already done this way before this PR, so it can be addressed separately.
```suggestion
                       "( `alloc` $allocRegion^ )? "
```

https://github.com/llvm/llvm-project/pull/102522


More information about the Mlir-commits mailing list