[PATCH] D79658: [mlir][Affine] Introduce affine.vload and affine.vstore

Diego Caballero via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 18:49:17 PDT 2020


dcaballe created this revision.
dcaballe added reviewers: bondhugula, nicolasvasilache, mehdi_amini.
Herald added subscribers: llvm-commits, Kayjukh, frgossen, grosul1, Joonsoo, stephenneuendorffer, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, jpienaar, rriddle, mgorny.
Herald added a reviewer: aartbik.
Herald added a project: LLVM.
dcaballe marked 3 inline comments as done.
dcaballe added a comment.

A few things I found along the road...



================
Comment at: mlir/include/mlir/Conversion/Passes.td:18
 
 def ConvertAffineToStandard : FunctionPass<"lower-affine"> {
   let summary = "Lower Affine operations to a combination of Standard and Loop "
----------------
Should we rename this to `convert-affine-to-loops`?


================
Comment at: mlir/include/mlir/Dialect/Affine/IR/AffineOps.td:817
+  // extraClassDeclaration. Is there a way to add more declarations without
+  // overriding AffineLoadOpBase's.
+  // let extraClassDeclaration = [{
----------------
Not sure if it's feasible at all in tablegen but it would be great if we could make "code" variables (`extraClassDeclaration`, `builders`, etc.) "additive" in a hierarchy instead of overriding the variable with the value from the subclass.


================
Comment at: mlir/lib/Conversion/AffineToVector/AffineToVector.cpp:55
+        op, op.getVectorType(), op.getMemRef(), *resultOperands,
+        AffineMapAttr::get(permMap), padding);
+    return success();
----------------
I would be great if we could have a builder that sets `getMinorIdentityMap` as the default value of the permutation map for those cases where no permutation is needed.


This patch is the first of a short series that aims to extend Affine dialect
with vector memory semantics. Further context and details can be found here:
https://llvm.discourse.group/t/understanding-the-vector-abstraction-in-mlir/

In particular, this patch adds `affine.vload` and `affine.vstore` ops to
the Affine dialect and lowers them to `vector.transfer_read` and
`vector.transfer_write`, respectively, in the Vector dialect. The
`AffineToVector` conversion pass is introduced for this purpose.

Subsequent patches will add new interfaces for affine load-like and
store-like ops (already implemented locally), port affine fusion to
these interfaces as an example (already implemented locally), and
extend affine analyses to deal with vector semantics (WIP, may need
some help :)). Some refactoring may also be needed.

Thanks!
Diego


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79658

Files:
  mlir/include/mlir/Conversion/AffineToVector/AffineToVector.h
  mlir/include/mlir/Conversion/Passes.td
  mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
  mlir/include/mlir/Transforms/Passes.h
  mlir/lib/Conversion/AffineToVector/AffineToVector.cpp
  mlir/lib/Conversion/AffineToVector/CMakeLists.txt
  mlir/lib/Conversion/CMakeLists.txt
  mlir/lib/Dialect/Affine/IR/AffineOps.cpp
  mlir/test/Conversion/AffineToVector/affine-to-vector.mlir
  mlir/test/Dialect/Affine/load-store.mlir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79658.262985.patch
Type: text/x-patch
Size: 26300 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200509/e0d14703/attachment.bin>


More information about the llvm-commits mailing list