[PATCH] D79662: [mlir] Revisit std.subview handling of static information.

Nicolas Vasilache via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 21:30:19 PDT 2020


nicolasvasilache created this revision.
nicolasvasilache added a reviewer: ftynse.
Herald added subscribers: llvm-commits, Kayjukh, frgossen, grosul1, bader, Joonsoo, stephenneuendorffer, liufengdb, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini.
Herald added a reviewer: mravishankar.
Herald added a reviewer: antiagainst.
Herald added a reviewer: rriddle.
Herald added a project: LLVM.
nicolasvasilache added reviewers: andydavis1, timshen.
nicolasvasilache added reviewers: asaadaldien, stellaraccident.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79662

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79662.262991.patch
Type: text/x-patch
Size: 80442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200509/d0204ce6/attachment-0001.bin>


More information about the llvm-commits mailing list