[Mlir-commits] [mlir] 3bf2ba3 - [mlir][sparse] Simplifying code in expInsert
wren romano
llvmlistbot at llvm.org
Mon Apr 4 12:53:56 PDT 2022
Author: wren romano
Date: 2022-04-04T12:53:42-07:00
New Revision: 3bf2ba3b9a58ee8c3199c9b75bb8416bebe25137
URL: https://github.com/llvm/llvm-project/commit/3bf2ba3b9a58ee8c3199c9b75bb8416bebe25137
DIFF: https://github.com/llvm/llvm-project/commit/3bf2ba3b9a58ee8c3199c9b75bb8416bebe25137.diff
LOG: [mlir][sparse] Simplifying code in expInsert
Just some minor cleanup
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D122934
Added:
Modified:
mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
Removed:
################################################################################
diff --git a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
index d1a08f10ca905..99e98de1e3047 100644
--- a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
+++ b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
@@ -336,9 +336,9 @@ class SparseTensorStorage : public SparseTensorStorageBase {
// Sort.
std::sort(added, added + count);
// Restore insertion path for first insert.
- uint64_t rank = getRank();
+ const uint64_t lastDim = getRank() - 1;
uint64_t index = added[0];
- cursor[rank - 1] = index;
+ cursor[lastDim] = index;
lexInsert(cursor, values[index]);
assert(filled[index]);
values[index] = 0;
@@ -347,10 +347,10 @@ class SparseTensorStorage : public SparseTensorStorageBase {
for (uint64_t i = 1; i < count; i++) {
assert(index < added[i] && "non-lexicographic insertion");
index = added[i];
- cursor[rank - 1] = index;
- insPath(cursor, rank - 1, added[i - 1] + 1, values[index]);
+ cursor[lastDim] = index;
+ insPath(cursor, lastDim, added[i - 1] + 1, values[index]);
assert(filled[index]);
- values[index] = 0.0;
+ values[index] = 0;
filled[index] = false;
}
}
More information about the Mlir-commits
mailing list