[Mlir-commits] [mlir] [mlir][vector] Restrict DropInnerMostUnitDimsTransferRead (PR #94904)

Han-Chung Wang llvmlistbot at llvm.org
Mon Jun 10 10:18:28 PDT 2024


================
@@ -1293,6 +1293,21 @@ class DropInnerMostUnitDimsTransferRead
     if (dimsToDrop == 0)
       return failure();
 
+    // Make sure that the indixes to be dropped are equal 0.
+    // TODO: Deal with cases when the indices are not 0.
+    auto isZeroIdx = [](Value idx) {
+      Attribute attr;
+      APInt value;
+      if (!matchPattern(idx, m_Constant(&attr)))
+        return false;
+      if (matchPattern(attr, m_ConstantInt(&value)))
+        if (!value.isZero())
+          return false;
+      return true;
+    };
----------------
hanhanW wrote:

Can we use the `isZeroIndex`, which is from `StaticValueUtils.h`?

https://github.com/llvm/llvm-project/blob/1d96e4bc2d09bc085e7c1b303d930684756b94a7/mlir/include/mlir/Dialect/Utils/StaticValueUtils.h#L27-L29

https://github.com/llvm/llvm-project/pull/94904


More information about the Mlir-commits mailing list