[Mlir-commits] [mlir] [mlir][sparse] Use vector.step for index vector generation (PR #97692)
Cullen Rhodes
llvmlistbot at llvm.org
Thu Jul 4 01:24:40 PDT 2024
https://github.com/c-rhodes created https://github.com/llvm/llvm-project/pull/97692
None
>From 1d0c1fee82b0579f07afbb1c8e566cab3d84ed57 Mon Sep 17 00:00:00 2001
From: Cullen Rhodes <cullen.rhodes at arm.com>
Date: Wed, 3 Jul 2024 15:21:53 +0000
Subject: [PATCH] [mlir][sparse] Use vector.step for index vector generation
---
.../SparseTensor/Transforms/SparseVectorization.cpp | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp
index 2b81d6cdc1eabe..7a2400b41b0456 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp
@@ -381,18 +381,7 @@ static bool vectorizeExpr(PatternRewriter &rewriter, scf::ForOp forOp, VL vl,
if (codegen) {
VectorType vtp = vectorType(vl, arg.getType());
Value veci = rewriter.create<vector::BroadcastOp>(loc, vtp, arg);
- Value incr;
- if (vl.enableVLAVectorization) {
- Type stepvty = vectorType(vl, rewriter.getI64Type());
- Value stepv = rewriter.create<LLVM::StepVectorOp>(loc, stepvty);
- incr = rewriter.create<arith::IndexCastOp>(loc, vtp, stepv);
- } else {
- SmallVector<APInt> integers;
- for (unsigned i = 0, l = vl.vectorLength; i < l; i++)
- integers.push_back(APInt(/*width=*/64, i));
- auto values = DenseElementsAttr::get(vtp, integers);
- incr = rewriter.create<arith::ConstantOp>(loc, vtp, values);
- }
+ Value incr = rewriter.create<vector::StepOp>(loc, vtp);
vexp = rewriter.create<arith::AddIOp>(loc, veci, incr);
}
return true;
More information about the Mlir-commits
mailing list