[Mlir-commits] [mlir] 4f183b1 - [mlir][sparse] remove obsoleted output methods from runtime (#70523)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Oct 27 16:58:45 PDT 2023
Author: Aart Bik
Date: 2023-10-27T16:58:41-07:00
New Revision: 4f183b1f6e17e5c9acd42d5c0608391533540eff
URL: https://github.com/llvm/llvm-project/commit/4f183b1f6e17e5c9acd42d5c0608391533540eff
DIFF: https://github.com/llvm/llvm-project/commit/4f183b1f6e17e5c9acd42d5c0608391533540eff.diff
LOG: [mlir][sparse] remove obsoleted output methods from runtime (#70523)
Our CODE and LIB are more unified every day!
Added:
Modified:
mlir/include/mlir/ExecutionEngine/SparseTensor/File.h
mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h
mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/ExecutionEngine/SparseTensor/File.h b/mlir/include/mlir/ExecutionEngine/SparseTensor/File.h
index 1b5f0553a3af959..85bbfe06a86a020 100644
--- a/mlir/include/mlir/ExecutionEngine/SparseTensor/File.h
+++ b/mlir/include/mlir/ExecutionEngine/SparseTensor/File.h
@@ -1,4 +1,4 @@
-//===- File.h - Reading/writing sparse tensors from/to files ----*- C++ -*-===//
+//===- File.h - Reading sparse tensors from files --------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements reading and writing sparse tensor files in one of the
+// This file implements reading sparse tensor from files in one of the
// following external formats:
//
// (1) Matrix Market Exchange (MME): *.mtx
@@ -358,33 +358,6 @@ bool SparseTensorReader::readToBuffersLoop(const MapRef &map, C *lvlCoordinates,
return isSorted;
}
-/// Writes the sparse tensor to `filename` in extended FROSTT format.
-template <typename V>
-inline void writeExtFROSTT(const SparseTensorCOO<V> &coo,
- const char *filename) {
- assert(filename && "Got nullptr for filename");
- const auto &dimSizes = coo.getDimSizes();
- const auto &elements = coo.getElements();
- const uint64_t dimRank = coo.getRank();
- const uint64_t nse = elements.size();
- std::fstream file;
- file.open(filename, std::ios_base::out | std::ios_base::trunc);
- assert(file.is_open());
- file << "; extended FROSTT format\n" << dimRank << " " << nse << std::endl;
- for (uint64_t d = 0; d < dimRank - 1; ++d)
- file << dimSizes[d] << " ";
- file << dimSizes[dimRank - 1] << std::endl;
- for (uint64_t i = 0; i < nse; ++i) {
- const auto &coords = elements[i].coords;
- for (uint64_t d = 0; d < dimRank; ++d)
- file << (coords[d] + 1) << " ";
- file << elements[i].value << std::endl;
- }
- file.flush();
- file.close();
- assert(file.good());
-}
-
} // namespace sparse_tensor
} // namespace mlir
diff --git a/mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h b/mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h
index bbfe6ed19e70da3..0eb0590ac7e5747 100644
--- a/mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h
+++ b/mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h
@@ -166,13 +166,6 @@ MLIR_CRUNNERUTILS_EXPORT void endForwardingInsert(void *tensor);
/// Tensor-storage method to finalize lexicographic insertions.
MLIR_CRUNNERUTILS_EXPORT void endLexInsert(void *tensor);
-/// Coordinate-scheme method to write to file in extended FROSTT format.
-#define DECL_OUTSPARSETENSOR(VNAME, V) \
- MLIR_CRUNNERUTILS_EXPORT void outSparseTensor##VNAME(void *coo, void *dest, \
- bool sort);
-MLIR_SPARSETENSOR_FOREVERY_V(DECL_OUTSPARSETENSOR)
-#undef DECL_OUTSPARSETENSOR
-
/// Releases the memory for the tensor-storage object.
MLIR_CRUNNERUTILS_EXPORT void delSparseTensor(void *tensor);
diff --git a/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp b/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
index 441a6094eddf06a..f84fdd3964c14f1 100644
--- a/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
+++ b/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
@@ -496,17 +496,6 @@ void endLexInsert(void *tensor) {
return static_cast<SparseTensorStorageBase *>(tensor)->endLexInsert();
}
-#define IMPL_OUTSPARSETENSOR(VNAME, V) \
- void outSparseTensor##VNAME(void *coo, void *dest, bool sort) { \
- assert(coo); \
- auto &coo_ = *static_cast<SparseTensorCOO<V> *>(coo); \
- if (sort) \
- coo_.sort(); \
- return writeExtFROSTT(coo_, static_cast<char *>(dest)); \
- }
-MLIR_SPARSETENSOR_FOREVERY_V(IMPL_OUTSPARSETENSOR)
-#undef IMPL_OUTSPARSETENSOR
-
void delSparseTensor(void *tensor) {
delete static_cast<SparseTensorStorageBase *>(tensor);
}
More information about the Mlir-commits
mailing list