[Mlir-commits] [mlir] c03fd1e - [mlir][sparse] Marking cursor parameters const
wren romano
llvmlistbot at llvm.org
Wed Jan 5 16:14:09 PST 2022
Author: wren romano
Date: 2022-01-05T16:14:02-08:00
New Revision: c03fd1e61fee892aa0ead68d0f9271dd680b655f
URL: https://github.com/llvm/llvm-project/commit/c03fd1e61fee892aa0ead68d0f9271dd680b655f
DIFF: https://github.com/llvm/llvm-project/commit/c03fd1e61fee892aa0ead68d0f9271dd680b655f.diff
LOG: [mlir][sparse] Marking cursor parameters const
These parameters aren't modified, so we make that invariant explicit.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D116693
Added:
Modified:
mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
Removed:
################################################################################
diff --git a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
index 3681ca17674b4..3bd405738eebc 100644
--- a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
+++ b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
@@ -187,12 +187,12 @@ class SparseTensorStorageBase {
virtual void getValues(std::vector<int8_t> **) { fatal("vali8"); }
/// Element-wise insertion in lexicographic index order.
- virtual void lexInsert(uint64_t *, double) { fatal("insf64"); }
- virtual void lexInsert(uint64_t *, float) { fatal("insf32"); }
- virtual void lexInsert(uint64_t *, int64_t) { fatal("insi64"); }
- virtual void lexInsert(uint64_t *, int32_t) { fatal("insi32"); }
- virtual void lexInsert(uint64_t *, int16_t) { fatal("ins16"); }
- virtual void lexInsert(uint64_t *, int8_t) { fatal("insi8"); }
+ virtual void lexInsert(const uint64_t *, double) { fatal("insf64"); }
+ virtual void lexInsert(const uint64_t *, float) { fatal("insf32"); }
+ virtual void lexInsert(const uint64_t *, int64_t) { fatal("insi64"); }
+ virtual void lexInsert(const uint64_t *, int32_t) { fatal("insi32"); }
+ virtual void lexInsert(const uint64_t *, int16_t) { fatal("ins16"); }
+ virtual void lexInsert(const uint64_t *, int8_t) { fatal("insi8"); }
/// Expanded insertion.
virtual void expInsert(uint64_t *, double *, bool *, uint64_t *, uint64_t) {
@@ -300,7 +300,7 @@ class SparseTensorStorage : public SparseTensorStorageBase {
void getValues(std::vector<V> **out) override { *out = &values; }
/// Partially specialize lexicographical insertions based on template types.
- void lexInsert(uint64_t *cursor, V val) override {
+ void lexInsert(const uint64_t *cursor, V val) override {
// First, wrap up pending insertion path.
uint64_t
diff = 0;
uint64_t top = 0;
@@ -499,7 +499,7 @@ class SparseTensorStorage : public SparseTensorStorageBase {
}
/// Continues a single insertion path, outer to inner.
- void insPath(uint64_t *cursor, uint64_t
diff , uint64_t top, V val) {
+ void insPath(const uint64_t *cursor, uint64_t
diff , uint64_t top, V val) {
uint64_t rank = getRank();
assert(
diff < rank);
for (uint64_t d =
diff ; d < rank; d++) {
@@ -517,7 +517,7 @@ class SparseTensorStorage : public SparseTensorStorageBase {
}
/// Finds the lexicographic
diff ering dimension.
- uint64_t lexDiff(uint64_t *cursor) {
+ uint64_t lexDiff(const uint64_t *cursor) {
for (uint64_t r = 0, rank = getRank(); r < rank; r++)
if (cursor[r] > idx[r])
return r;
More information about the Mlir-commits
mailing list