[PATCH] D76414: [mlir][Linalg] Introduce linalg.pooling op.

Han-Chung Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 18 23:25:40 PDT 2020


hanchung created this revision.
hanchung added reviewers: mravishankar, nicolasvasilache, antiagainst, asaadaldien.
Herald added subscribers: llvm-commits, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, shauheen, burmako, jpienaar, rriddle, mehdi_amini.
Herald added a project: LLVM.
hanchung edited the summary of this revision.

linalg.pooling applies a pooling function to all elements in each window of the
input multi-dimensional array, producing an output multi-dimensional array with
the same number of elements as the number of valid positions of the window.

To work around with current lowering path, linalg.pooling takes an fake memref,
windowDims, to determine the size of window loops.

linalg.pooling takes a region (like generic op) as the pooling function. The
signature of the block must be:

  ^bb0([input view element type], [output view element type])
              -> ([output view element type])

Example:

  mlir
    linalg.pooling { strides = [2, 1, 2] } %arg0, %arg1, %arg2 {
      ^bb(%a: f32, %b: f32) :
        %0 = addf %a, %b : f32
        linalg.yield %0 : f32
    }: memref<?x?x?xf32>, memref<?x?x?xi32>, memref<?x?x?xf32>

Depends On D76413 <https://reviews.llvm.org/D76413>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76414

Files:
  mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.h
  mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
  mlir/include/mlir/Dialect/Utils/StructuredOpsUtils.h
  mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
  mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
  mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
  mlir/test/Dialect/Linalg/invalid.mlir
  mlir/test/Dialect/Linalg/loops.mlir
  mlir/test/Dialect/Linalg/roundtrip.mlir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76414.251285.patch
Type: text/x-patch
Size: 24970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200319/949b7850/attachment-0001.bin>


More information about the llvm-commits mailing list