[Mlir-commits] [mlir] 4896238 - [mlir][sparse] tiny cleanup making local 'using' explicit (#69740)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Oct 20 12:41:12 PDT 2023


Author: Aart Bik
Date: 2023-10-20T12:41:08-07:00
New Revision: 48962383ad1af36467c13c6ed33fd906df189cb2

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

LOG: [mlir][sparse] tiny cleanup making local 'using' explicit (#69740)

Added: 
    

Modified: 
    mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h
    mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h b/mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h
index 5a620807f15ff7e..bbfe6ed19e70da3 100644
--- a/mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h
+++ b/mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h
@@ -24,8 +24,6 @@
 
 using namespace mlir::sparse_tensor;
 
-using SparseTensorWriter = std::ostream;
-
 extern "C" {
 
 //===----------------------------------------------------------------------===//
@@ -47,6 +45,7 @@ extern "C" {
 /// kEmpty          -               STS, empty
 /// kEmptyForward   -               STS, empty, with forwarding COO
 /// kFromCOO        COO             STS, copied from the COO source
+/// kFromReader     reader          STS, input from reader
 /// kToCOO          STS             COO, copied from the STS source
 /// kPack           buffers         STS, from level buffers
 /// kSortCOOInPlace STS             STS, sorted in place

diff  --git a/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp b/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
index 7a6756e689b27be..1b4121e18b2c8da 100644
--- a/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
+++ b/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
@@ -449,9 +449,9 @@ void _mlir_ciface_outSparseTensorWriterMetaData(
   ASSERT_NO_STRIDE(dimSizesRef);
   assert(dimRank != 0);
   index_type *dimSizes = MEMREF_GET_PAYLOAD(dimSizesRef);
-  SparseTensorWriter &file = *static_cast<SparseTensorWriter *>(p);
+  std::ostream &file = *static_cast<std::ostream *>(p);
   file << dimRank << " " << nse << std::endl;
-  for (index_type d = 0; d < dimRank - 1; ++d)
+  for (index_type d = 0; d < dimRank - 1; d++)
     file << dimSizes[d] << " ";
   file << dimSizes[dimRank - 1] << std::endl;
 }
@@ -464,8 +464,8 @@ void _mlir_ciface_outSparseTensorWriterMetaData(
     assert(p &&vref);                                                          \
     ASSERT_NO_STRIDE(dimCoordsRef);                                            \
     const index_type *dimCoords = MEMREF_GET_PAYLOAD(dimCoordsRef);            \
-    SparseTensorWriter &file = *static_cast<SparseTensorWriter *>(p);          \
-    for (index_type d = 0; d < dimRank; ++d)                                   \
+    std::ostream &file = *static_cast<std::ostream *>(p);                      \
+    for (index_type d = 0; d < dimRank; d++)                                   \
       file << (dimCoords[d] + 1) << " ";                                       \
     V *value = MEMREF_GET_PAYLOAD(vref);                                       \
     file << *value << std::endl;                                               \
@@ -537,14 +537,14 @@ void delSparseTensorReader(void *p) {
 }
 
 void *createSparseTensorWriter(char *filename) {
-  SparseTensorWriter *file =
+  std::ostream *file =
       (filename[0] == 0) ? &std::cout : new std::ofstream(filename);
   *file << "# extended FROSTT format\n";
   return static_cast<void *>(file);
 }
 
 void delSparseTensorWriter(void *p) {
-  SparseTensorWriter *file = static_cast<SparseTensorWriter *>(p);
+  std::ostream *file = static_cast<std::ostream *>(p);
   file->flush();
   assert(file->good());
   if (file != &std::cout)


        


More information about the Mlir-commits mailing list