[Mlir-commits] [mlir] ae8b1a1 - [mlir][sparse] Minor code clean up (NFC).

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Jan 12 15:25:37 PST 2023


Author: bixia1
Date: 2023-01-12T15:25:33-08:00
New Revision: ae8b1a1e307b7c0cf694ba7a82443700b6a06467

URL: https://github.com/llvm/llvm-project/commit/ae8b1a1e307b7c0cf694ba7a82443700b6a06467
DIFF: https://github.com/llvm/llvm-project/commit/ae8b1a1e307b7c0cf694ba7a82443700b6a06467.diff

LOG: [mlir][sparse] Minor code clean up (NFC).

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D141554

Added: 
    

Modified: 
    mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp
index a9cc10006f4a..41a4c0599c62 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp
@@ -167,9 +167,7 @@ void LoopEmitter::initializeLoopEmit(OpBuilder &builder, Location loc,
     } else {
       // Annotated sparse tensors.
       // We also need the value buffer for annotated all dense `sparse` tensor.
-      auto dynShape = {ShapedType::kDynamic};
-      auto sparseTp = MemRefType::get(dynShape, elementType);
-      valBuffer[t] = builder.create<ToValuesOp>(loc, sparseTp, tensor);
+      valBuffer[t] = genToValues(builder, loc, tensor);
     }
     // NOTE: we can also prepare for 0 dim here in advance, this will hosit
     // some loop preparation from tensor iteration, but will also (undesirably)
@@ -180,9 +178,8 @@ void LoopEmitter::initializeLoopEmit(OpBuilder &builder, Location loc,
 void LoopEmitter::enterNewLoopSeq(OpBuilder &builder, Location loc,
                                   ArrayRef<size_t> tids,
                                   ArrayRef<size_t> dims) {
-  // Universal Index start from 0
   assert(loopSeqStack.size() == loopStack.size());
-  // Universal index starts from 0
+  // Universal Index starts from 0.
   loopSeqStack.emplace_back(constantIndex(builder, loc, 0));
   // Prepares for all the tensors used in the current loop sequence.
   for (auto [tid, dim] : llvm::zip(tids, dims))


        


More information about the Mlir-commits mailing list