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

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Mon May 11 14:48:55 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 80d133b24f77d1b9d351251315606441c971ef9b
      https://github.com/llvm/llvm-project/commit/80d133b24f77d1b9d351251315606441c971ef9b
  Author: Nicolas Vasilache <ntv at google.com>
  Date:   2020-05-11 (Mon, 11 May 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
    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.

Summary:
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.

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.

Reviewers: ftynse, mravishankar, antiagainst, rriddle!, andydavis1, timshen, asaadaldien, stellaraccident

Reviewed By: mravishankar

Subscribers: aartbik, bondhugula, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, bader, grosul1, frgossen, Kayjukh, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list