[Mlir-commits] [mlir] 4065a0d - [mlir] [sparse] Rename getSparseMatrix to getMatrix
Aart Bik
llvmlistbot at llvm.org
Wed Oct 7 14:25:23 PDT 2020
Author: Aart Bik
Date: 2020-10-07T14:25:05-07:00
New Revision: 4065a0d98f675595cdf568bae9bbd872de51fcba
URL: https://github.com/llvm/llvm-project/commit/4065a0d98f675595cdf568bae9bbd872de51fcba
DIFF: https://github.com/llvm/llvm-project/commit/4065a0d98f675595cdf568bae9bbd872de51fcba.diff
LOG: [mlir] [sparse] Rename getSparseMatrix to getMatrix
Rationale:
More consistent with the other names. Also forward looking to reading
in other kinds of matrices. Also fixes lint issue on hard-coded %llu.
Reviewed By: penpornk
Differential Revision: https://reviews.llvm.org/D89005
Added:
Modified:
mlir/integration_test/Sparse/CPU/matrix-market-example.mlir
mlir/lib/ExecutionEngine/SparseUtils.cpp
Removed:
################################################################################
diff --git a/mlir/integration_test/Sparse/CPU/matrix-market-example.mlir b/mlir/integration_test/Sparse/CPU/matrix-market-example.mlir
index 31fb20fa11cc..56c392e8133b 100644
--- a/mlir/integration_test/Sparse/CPU/matrix-market-example.mlir
+++ b/mlir/integration_test/Sparse/CPU/matrix-market-example.mlir
@@ -1,7 +1,7 @@
// RUN: mlir-opt %s \
// RUN: -convert-scf-to-std -convert-vector-to-scf \
// RUN: -convert-linalg-to-llvm -convert-vector-to-llvm | \
-// RUN: SPARSE_MATRIX0="%mlir_integration_test_dir/data/test.mtx" \
+// RUN: MATRIX0="%mlir_integration_test_dir/data/test.mtx" \
// RUN: mlir-cpu-runner \
// RUN: -e entry -entry-point-result=void \
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
@@ -11,7 +11,7 @@ module {
func @openMatrix(!llvm.ptr<i8>, memref<index>, memref<index>, memref<index>) -> ()
func @readMatrixItem(memref<index>, memref<index>, memref<f64>) -> ()
func @closeMatrix() -> ()
- func @getSparseMatrix(index) -> (!llvm.ptr<i8>)
+ func @getMatrix(index) -> (!llvm.ptr<i8>)
func @entry() {
%d0 = constant 0.0 : f64
@@ -29,7 +29,7 @@ module {
// Read the header of a sparse matrix. This yields the
// size (m x n) and number of nonzero elements (nnz).
//
- %file = call @getSparseMatrix(%c0) : (index) -> (!llvm.ptr<i8>)
+ %file = call @getMatrix(%c0) : (index) -> (!llvm.ptr<i8>)
call @openMatrix(%file, %m, %n, %nnz)
: (!llvm.ptr<i8>, memref<index>,
memref<index>, memref<index>) -> ()
diff --git a/mlir/lib/ExecutionEngine/SparseUtils.cpp b/mlir/lib/ExecutionEngine/SparseUtils.cpp
index 6942a7b260c5..253a3f46e457 100644
--- a/mlir/lib/ExecutionEngine/SparseUtils.cpp
+++ b/mlir/lib/ExecutionEngine/SparseUtils.cpp
@@ -162,11 +162,11 @@ extern "C" void closeMatrix() {
sparseFilename = nullptr;
}
-// Helper method to read sparse matrix filenames from the environment, defined
-// with the naming convention ${SPARSE_MATRIX0}, ${SPARSE_MATRIX1}, etc.
-extern "C" char *getSparseMatrix(uint64_t id) {
+// Helper method to read matrix filenames from the environment, defined
+// with the naming convention ${MATRIX0}, ${MATRIX1}, etc.
+extern "C" char *getMatrix(uint64_t id) {
char var[80];
- sprintf(var, "SPARSE_MATRIX%lu", id);
+ sprintf(var, "MATRIX%" PRIu64, id);
char *env = getenv(var);
return env;
}
More information about the Mlir-commits
mailing list