[all-commits] [llvm/llvm-project] f245b7: [mlir][Linalg] Generalize the definition of a Lina...

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Wed Feb 3 23:55:21 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f245b7ad36ff8bd85cddbe9784f7efe6dee577c0
      https://github.com/llvm/llvm-project/commit/f245b7ad36ff8bd85cddbe9784f7efe6dee577c0
  Author: Nicolas Vasilache <nicolas.vasilache at gmail.com>
  Date:   2021-02-04 (Thu, 04 Feb 2021)

  Changed paths:
    M mlir/integration_test/Dialect/Linalg/CPU/benchmark_matmul.mlir
    M mlir/integration_test/Dialect/Linalg/CPU/benchmark_matmul_column_major.mlir
    M mlir/integration_test/Dialect/Linalg/CPU/benchmark_matmul_column_major_as_row_major.mlir
    M mlir/integration_test/Dialect/Linalg/CPU/benchmark_matmul_i8_i8_i32.mlir
    M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
    M mlir/test/Conversion/LinalgToVector/linalg-to-vector.mlir
    M mlir/test/Dialect/Linalg/vectorization.mlir
    M mlir/test/lib/Transforms/TestLinalgTransforms.cpp

  Log Message:
  -----------
  [mlir][Linalg] Generalize the definition of a Linalg contraction.

This revision defines a Linalg contraction in general terms:

  1. Has 2 input and 1 output shapes.
  2. Has at least one reduction dimension.
  3. Has only projected permutation indexing maps.
  4. its body computes `u5(u1(c) + u2(u3(a) * u4(b)))` on some field
    (AddOpType, MulOpType), where u1, u2, u3, u4 and u5 represent scalar unary
    operations that may change the type (e.g. for mixed-precision).

As a consequence, when vectorization of such an op occurs, the only special
behavior is that the (unique) MulOpType is vectorized into a
`vector.contract`. All other ops are handled in a generic fashion.

 In the future, we may wish to allow more input arguments and elementwise and
 constant operations that do not involve the reduction dimension(s).

A test is added to demonstrate the proper vectorization of matmul_i8_i8_i32.

Differential revision: https://reviews.llvm.org/D95939




More information about the All-commits mailing list