[all-commits] [llvm/llvm-project] 63c0e7: [mlir] Revisit std.subview handling of static info...

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Tue May 12 17:08:21 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 63c0e72b2f828db778135d3bdc4e0df03341a3a9
      https://github.com/llvm/llvm-project/commit/63c0e72b2f828db778135d3bdc4e0df03341a3a9
  Author: Nicolas Vasilache <ntv at google.com>
  Date:   2020-05-12 (Tue, 12 May 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
    M mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
    M mlir/lib/Dialect/StandardOps/IR/Ops.cpp
    M mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir
    M mlir/test/Conversion/StandardToLLVM/invalid.mlir
    M mlir/test/Conversion/StandardToSPIRV/legalization.mlir
    M mlir/test/Conversion/StandardToSPIRV/subview-to-spirv.mlir
    M mlir/test/Dialect/Affine/ops.mlir
    M mlir/test/Dialect/Linalg/promote.mlir
    M mlir/test/IR/core-ops.mlir
    M mlir/test/IR/invalid-ops.mlir
    M mlir/test/Transforms/canonicalize.mlir

  Log Message:
  -----------
  [mlir] Revisit std.subview handling of static information.

The main objective of this revision is to change the way static information is represented, propagated and canonicalized in the SubViewOp.

In the current implementation the issue is that canonicalization may strictly lose information because static offsets are combined in irrecoverable ways into the result type, in order to fit the strided memref representation.

The core semantics of the op do not change but the parser and printer do: the op always requires `rank` offsets, sizes and strides. These quantities can now be either SSA values or static integer attributes.

The result type is automatically deduced from the static information and more powerful canonicalizations (as powerful as the representation with sentinel `?` values allows). Previously static information was inferred on a best-effort basis from looking at the source and destination type.

Relevant tests are rewritten to use the idiomatic `offset: x, strides : [...]`-form. Bugs are corrected along the way that were not trivially visible in flattened strided memref form.

Lowering to LLVM is updated, simplified and now supports all cases.
A mixed static-dynamic mode test that wouldn't previously lower is added.

It is an open question, and a longer discussion, whether a better result type representation would be a nicer alternative. For now, the subview op carries the required semantic.

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




More information about the All-commits mailing list