[Mlir-commits] [mlir] [mlir][sparse] tiny cleanup making local 'using' explicit (PR #69740)
Aart Bik
llvmlistbot at llvm.org
Fri Oct 20 09:51:53 PDT 2023
https://github.com/aartbik created https://github.com/llvm/llvm-project/pull/69740
None
>From d1c4f76dc28b68314c7becd9c27f32cdf72f498f Mon Sep 17 00:00:00 2001
From: Aart Bik <ajcbik at google.com>
Date: Fri, 20 Oct 2023 09:46:24 -0700
Subject: [PATCH] [mlir][sparse] tiny cleanup making local 'using' explicit
---
.../mlir/ExecutionEngine/SparseTensorRuntime.h | 3 +--
mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp | 12 ++++++------
2 files changed, 7 insertions(+), 8 deletions(-)
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