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

Iman Hosseini via flang-commits flang-commits at lists.llvm.org
Wed Jun 12 03:07:16 PDT 2024


================
@@ -260,9 +263,28 @@ def cuf_KernelOp : cuf_Op<"kernel", [AttrSizedOperandSegments,
         ( `,` `stream` `=` $stream^ )? `>` `>` `>`
         custom<CUFKernelLoopControl>($region, $lowerbound, type($lowerbound),
             $upperbound, type($upperbound), $step, type($step))
+        ( `reduce` `(` $reduceOperands^ `:` type($reduceOperands) `)` )?
+        ( `reduce_attrs` `(` $reduceAttrs^ `)` )?
----------------
ImanHosseini wrote:

I think I found the nicest format. I moved it before region and removed the `reduce_attrs` keyword:
```
    cuf.kernel<<<*, *>>> reduce(%1, %12 : !fir.ref<i32>, !fir.ref<i32> : [#fir.reduce_attr<add>, #fir.reduce_attr<multiply>]) (%arg0 : index) = (%c1 : index) to (%c4 : index)  step (%c1 : index) {
```

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


More information about the flang-commits mailing list