[Mlir-commits] [mlir] [MLIR][VectorToLLVM] Handle scalable dim in createVectorLengthValue() (PR #93361)

Zhaoshi Zheng llvmlistbot at llvm.org
Wed May 29 12:59:10 PDT 2024


================
@@ -532,9 +532,19 @@ static Value createVectorLengthValue(ConversionPatternRewriter &rewriter,
   auto vShape = vType.getShape();
   assert(vShape.size() == 1 && "Unexpected multi-dim vector type");
 
-  return rewriter.create<LLVM::ConstantOp>(
+  Value vLen = rewriter.create<LLVM::ConstantOp>(
       loc, rewriter.getI32Type(),
       rewriter.getIntegerAttr(rewriter.getI32Type(), vShape[0]));
+
+  if (!vType.getScalableDims()[0])
+    return vLen;
+
+  // Create VScale*vShape[0] and return it as vector length.
----------------
zhaoshiz wrote:

I feel duplicating all tests is a bit redundant.. the triton test case is using 'add', other vector.mask %mask {vector.reduction <op> ...} tests don't offer additional coverage on code path in mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp, i.e., the part maps vector.reduction <op> to llvm.intr.vp.reduce.<op> is not changed. I've dup-ed some tests

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


More information about the Mlir-commits mailing list