[PATCH] D133166: [mlir][MemRef] Canonicalize extract_strided_metadata(subview)

Nicolas Vasilache via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 09:09:56 PDT 2022


nicolasvasilache added inline comments.


================
Comment at: mlir/test/Dialect/MemRef/simplify-extract-strided-metadata.mlir:219
+//
+//  CHECK-DAG: %[[FINAL_OFFSET:.*]] = affine.apply #[[$OFFSET_MAP]]()[%[[DYN_OFFSET2]], %[[DYN_OFFSET1]], %[[OFFSET]], %[[DYN_OFFSET0]], %[[STRIDES]]#0, %[[DYN_STRIDE0]], %[[STRIDES]]#1, %[[DYN_STRIDE1]], %[[STRIDES]]#2, %[[DYN_STRIDE2]]]
+//
----------------
qcolombet wrote:
> Nit question: Is there a way to produce an affine map, with a nice ordering of the arguments?
> E.g., origOffset, stride0, subStride0, subOffset0, ...
> 
> Although the current map is correct, the arguments are all over the place :).
See my comment above, I believe it's because you compose AffineMaps iteratively.
You could create a flat list of AffineExpr with the proper expressions, match that to the proper value and thus better control the alignment of values.
This would also resist canonicalizations (e.g. if 2 values are the same the corresponding symbol gets dropped and the other ones shifted preserving the original alignment on the other values).



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133166/new/

https://reviews.llvm.org/D133166



More information about the llvm-commits mailing list