[Mlir-commits] [mlir] [mlir][vector] Add support for linearizing Insert VectorOp in VectorLinearize (PR #92370)

Ivan Butygin llvmlistbot at llvm.org
Thu May 16 06:14:59 PDT 2024


================
@@ -44,6 +44,22 @@ static bool isLessThanTargetBitWidth(Operation *op, unsigned targetBitWidth) {
   return true;
 }
 
+static bool isLessThanOrEqualTargetBitWidth(mlir::Type t,
+                                            unsigned targetBitWidth) {
+  VectorType vecType = dyn_cast<VectorType>(t);
+  // Reject index since getElementTypeBitWidth will abort for Index types.
+  if (!vecType || vecType.getElementType().isIndex())
+    return false;
+  // There are no dimension to fold if it is a 0-D vector.
+  if (vecType.getRank() == 0)
+    return false;
+  unsigned trailingVecDimBitWidth =
+      vecType.getShape().back() * vecType.getElementTypeBitWidth();
+  if (trailingVecDimBitWidth > targetBitWidth)
----------------
Hardcode84 wrote:

nit: `return trailingVecDimBitWidth <= targetBitWidth`

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


More information about the Mlir-commits mailing list