[PATCH] D73826: [mlir][Linalg] OpGen hooks

Nicolas Vasilache via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 21:01:07 PST 2020


nicolasvasilache created this revision.
nicolasvasilache added reviewers: rriddle, mehdi_amini, ftynse, jpienaar, antiagainst.
Herald added subscribers: llvm-commits, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, shauheen, burmako.
Herald added a project: LLVM.

This revision demonstrates some basic support for declaratively defining Linalg "named" ops. Such named ops form the backbone of operations that are ubiquitous in the ML application domain.

This is based on the (previously reverted) support for ODSDialectHooks, which is folded into this revision.

This revision closely related to the definition of a "Tensor Computation Primitives Dialect" and demonstrates that ops can be expressed as declarative configurations of the `linalg.generic` op.

For now, this only supports `linalg.matvec` (fixed-rank) and `linalg.fill` (rank-polymorphic) and replaces the manual implementations with a Tablegen'd equivalent.
These 2 ops are already enough to exhibit interesting behaviors, tradeoffs and open questions:

1. reference maps/iterators as static vs instance methods and requirements for rank-polymorphism
2. behavior in the presence / absence of maps/iterators
3. handling of other attributes than the ones from `linalg.generic`
4. ability to sugar the parsing/pretty-printing
5. (future) declarative specification of properties that will automate matchers and emitters to loop, scalar and vector form
6. (future) specification of mapping to library call / HW ISA


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73826

Files:
  mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.h
  mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
  mlir/include/mlir/Dialect/Linalg/IR/LinalgTraits.h
  mlir/include/mlir/TableGen/ODSDialectHook.h
  mlir/include/mlir/TableGen/Operator.h
  mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
  mlir/test/Dialect/Linalg/promote.mlir
  mlir/test/Dialect/Linalg/roundtrip.mlir
  mlir/test/Dialect/Linalg/tile.mlir
  mlir/test/Dialect/Linalg/tile_conv.mlir
  mlir/tools/mlir-tblgen/LinalgNamedOpsGen.cpp
  mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73826.241862.patch
Type: text/x-patch
Size: 73057 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200201/82405473/attachment.bin>


More information about the llvm-commits mailing list