[Mlir-commits] [mlir] [mlir][sparse] Use vector.step for index vector generation (PR #97692)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Jul 4 01:25:06 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-sparse
Author: Cullen Rhodes (c-rhodes)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/97692.diff
1 Files Affected:
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp (+1-12)
``````````diff
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp
index 2b81d6cdc1eab..7a2400b41b045 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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/97692
More information about the Mlir-commits
mailing list