[all-commits] [llvm/llvm-project] f52d71: [mlir][Linalg] Update the semantics, verifier and ...

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Tue Jan 14 14:26:36 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f52d71736b10e87b1aa1880b777dc9462a0085ce
      https://github.com/llvm/llvm-project/commit/f52d71736b10e87b1aa1880b777dc9462a0085ce
  Author: Nicolas Vasilache <ntv at google.com>
  Date:   2020-01-14 (Tue, 14 Jan 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgTraits.h
    M mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
    M mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp
    M mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
    M mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
    M mlir/lib/Dialect/Linalg/Transforms/LinalgTransforms.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
    M mlir/test/Dialect/Linalg/invalid.mlir
    M mlir/test/Dialect/Linalg/roundtrip.mlir

  Log Message:
  -----------
  [mlir][Linalg] Update the semantics, verifier and test for Linalg with tensors.

Summary:
This diff fixes issues with the semantics of linalg.generic on tensors that appeared when converting directly from HLO to linalg.generic.
The changes are self-contained within MLIR and can be captured and tested independently of XLA.

The linalg.generic and indexed_generic are updated to:

To allow progressive lowering from the value world (a.k.a tensor values) to
the buffer world (a.k.a memref values), a linalg.generic op accepts
mixing input and output ranked tensor values with input and output memrefs.

```
%1 = linalg.generic #trait_attribute %A, %B {other-attributes} :
  tensor<?x?xf32>,
  memref<?x?xf32, stride_specification>
  -> (tensor<?x?xf32>)
```

In this case, the number of outputs (args_out) must match the sum of (1) the
number of output buffer operands and (2) the number of tensor return values.
The semantics is that the linalg.indexed_generic op produces (i.e.
allocates and fills) its return values.

Tensor values must be legalized by a buffer allocation pass before most
transformations can be applied. Such legalization moves tensor return values
into output buffer operands and updates the region argument accordingly.

Transformations that create control-flow around linalg.indexed_generic
operations are not expected to mix with tensors because SSA values do not
escape naturally. Still, transformations and rewrites that take advantage of
tensor SSA values are expected to be useful and will be added in the near
future.

Subscribers: bmahjour, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list