[PATCH] D135736: [mlir][MemRef] Make reinterpret_cast(extract_strided_metadata) more robust

Nicolas Vasilache via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 08:16:55 PDT 2022


nicolasvasilache requested changes to this revision.
nicolasvasilache added a comment.
This revision now requires changes to proceed.

Discussed offline, the way to go here is to add helpers to each op that encode the best efforts mixed static/dynamic semantics and are op specific.



================
Comment at: mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp:1761
+/// \see sameValueOrConstant for more details.
+static bool sameValueOrConstantAtIdx(
+    ArrayRef<OpFoldResult> valuesA, ArrayRef<int64_t> constantsA,
----------------
if we use zip here, this function can go away


================
Comment at: mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp:1843
+    hasKnownStridesAndOffset = succeeded(
+        getStridesAndOffset(extractStridedMetadata.getSource().getType(),
+                            extractStrides, extractOffset));
----------------
can we add this to the op itself to return a vector of opfoldresult which best effort contains the Value or Attr extract from the type.


================
Comment at: mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp:1851
+    for (unsigned i = 0; i < rank; ++i) {
+      if (!sameValueOrConstantAtIdx(extractStridesOfr, extractStrides,
+                                    reinterpretStridesOfr, reinterpretStrides,
----------------
can we use a zip to drop the need for a vector in this complex API ?
Here and below 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135736



More information about the llvm-commits mailing list