[flang-commits] [flang] [flang] Add reductions for CUF Kernels: Lowering (PR #95184)

Iman Hosseini via flang-commits flang-commits at lists.llvm.org
Tue Jun 11 18:01:22 PDT 2024


================
@@ -227,7 +227,9 @@ mlir::LogicalResult cuf::KernelOp::verify() {
       getLowerbound().size() != getStep().size())
     return emitOpError(
         "expect same number of values in lowerbound, upperbound and step");
-
+  if (getReduceOperands().size() != getReduceAttrs()->size())
+    return emitOpError("expect same number of values in reduce operands and "
+                       "reduce attributes");
----------------
ImanHosseini wrote:

Like this?
```
  if (getReduceAttrs()) {
    for (const auto &attr : getReduceAttrs().value()) {
      if (!mlir::isa<fir::ReduceAttr>(attr))
        return emitOpError("expect reduce attributes to be ReduceAttr");
    }
  }
```

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


More information about the flang-commits mailing list