[all-commits] [llvm/llvm-project] a65fb1: Add a "kind" attribute to ContractionOp and OuterP...

Mehdi Amini via All-commits all-commits at lists.llvm.org
Fri Feb 12 12:24:25 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a65fb1916cb49b2f1ab3e7016fa54c04b2b048b4
      https://github.com/llvm/llvm-project/commit/a65fb1916cb49b2f1ab3e7016fa54c04b2b048b4
  Author: Praveen Narayanan <pravnar at google.com>
  Date:   2021-02-12 (Fri, 12 Feb 2021)

  Changed paths:
    M mlir/include/mlir/Dialect/Vector/CMakeLists.txt
    M mlir/include/mlir/Dialect/Vector/VectorOps.h
    M mlir/include/mlir/Dialect/Vector/VectorOps.td
    M mlir/include/mlir/IR/OpBase.td
    M mlir/lib/Dialect/Vector/CMakeLists.txt
    M mlir/lib/Dialect/Vector/VectorOps.cpp
    M mlir/lib/Dialect/Vector/VectorTransforms.cpp
    M mlir/test/Dialect/Linalg/vectorization.mlir
    M mlir/test/Dialect/Vector/ops.mlir
    M mlir/test/Dialect/Vector/vector-contract-matvec-transforms.mlir
    M mlir/test/Dialect/Vector/vector-transforms.mlir
    M mlir/tools/mlir-tblgen/EnumsGen.cpp

  Log Message:
  -----------
  Add a "kind" attribute to ContractionOp and OuterProductOp.

Currently, vector.contract joins the intermediate result and the accumulator
argument (of ranks K) using summation. We desire more joining operations ---
such as max --- to help vector.contract express reductions. This change extends
Vector_ContractionOp to take an optional attribute (called "kind", of enum type
CombiningKind) specifying the joining operation to be add/mul/min/max for int/fp
, and and/or/xor for int only. By default this attribute has value "add".

To implement this we also need to extend vector.outerproduct, since
vector.contract gets transformed to vector.outerproduct (and that to
vector.fma). The extension for vector.outerproduct is also an optional kind
attribute that uses the same enum type and possible values. The default is
"add". In case of max/min we transform vector.outerproduct to a combination of
compare and select.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D93280




More information about the All-commits mailing list