diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensor.h b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensor.h --- a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensor.h +++ b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensor.h @@ -46,8 +46,7 @@ // And therefore all functions calling it cannot be constexpr either. // TODO: since Clang does allow these to be constexpr, perhaps we should // define a macro to abstract over `inline` vs `constexpr` annotations. -inline DimLevelType getDimLevelType(const SparseTensorEncodingAttr &enc, - uint64_t d) { +inline DimLevelType getDimLevelType(SparseTensorEncodingAttr enc, uint64_t d) { if (enc) { auto types = enc.getDimLevelType(); assert(d < types.size() && "Dimension out of bounds"); @@ -110,8 +109,8 @@ // Reordering. // -uint64_t toOrigDim(const SparseTensorEncodingAttr &enc, uint64_t d); -uint64_t toStoredDim(const SparseTensorEncodingAttr &enc, uint64_t d); +uint64_t toOrigDim(SparseTensorEncodingAttr enc, uint64_t d); +uint64_t toStoredDim(SparseTensorEncodingAttr enc, uint64_t d); /// Convenience method to translate the given stored dimension /// to the original dimension (0 <= d < rank). diff --git a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp --- a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp +++ b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp @@ -294,7 +294,7 @@ return isUniqueDim(tp, tp.getRank() - 1); } -uint64_t mlir::sparse_tensor::toOrigDim(const SparseTensorEncodingAttr &enc, +uint64_t mlir::sparse_tensor::toOrigDim(SparseTensorEncodingAttr enc, uint64_t d) { if (enc) { auto order = enc.getDimOrdering(); @@ -306,7 +306,7 @@ return d; } -uint64_t mlir::sparse_tensor::toStoredDim(const SparseTensorEncodingAttr &enc, +uint64_t mlir::sparse_tensor::toStoredDim(SparseTensorEncodingAttr enc, uint64_t d) { if (enc) { auto order = enc.getDimOrdering(); diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h b/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h --- a/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h +++ b/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h @@ -48,18 +48,18 @@ Type getOverheadType(Builder &builder, OverheadType ot); /// Returns the OverheadType for pointer overhead storage. -OverheadType pointerOverheadTypeEncoding(const SparseTensorEncodingAttr &enc); +OverheadType pointerOverheadTypeEncoding(SparseTensorEncodingAttr enc); /// Returns the OverheadType for index overhead storage. -OverheadType indexOverheadTypeEncoding(const SparseTensorEncodingAttr &enc); +OverheadType indexOverheadTypeEncoding(SparseTensorEncodingAttr enc); /// Returns the mlir::Type for pointer overhead storage. Type getPointerOverheadType(Builder &builder, - const SparseTensorEncodingAttr &enc); + SparseTensorEncodingAttr enc); /// Returns the mlir::Type for index overhead storage. Type getIndexOverheadType(Builder &builder, - const SparseTensorEncodingAttr &enc); + SparseTensorEncodingAttr enc); /// Convert OverheadType to its function-name suffix. StringRef overheadTypeFunctionSuffix(OverheadType ot); @@ -281,14 +281,14 @@ /// Generates a constant of the internal type-encoding for pointer /// overhead storage. inline Value constantPointerTypeEncoding(OpBuilder &builder, Location loc, - const SparseTensorEncodingAttr &enc) { + SparseTensorEncodingAttr enc) { return constantOverheadTypeEncoding(builder, loc, enc.getPointerBitWidth()); } /// Generates a constant of the internal type-encoding for index overhead /// storage. inline Value constantIndexTypeEncoding(OpBuilder &builder, Location loc, - const SparseTensorEncodingAttr &enc) { + SparseTensorEncodingAttr enc) { return constantOverheadTypeEncoding(builder, loc, enc.getIndexBitWidth()); } diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.cpp --- a/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.cpp @@ -881,22 +881,22 @@ } OverheadType mlir::sparse_tensor::pointerOverheadTypeEncoding( - const SparseTensorEncodingAttr &enc) { + SparseTensorEncodingAttr enc) { return overheadTypeEncoding(enc.getPointerBitWidth()); } OverheadType mlir::sparse_tensor::indexOverheadTypeEncoding( - const SparseTensorEncodingAttr &enc) { + SparseTensorEncodingAttr enc) { return overheadTypeEncoding(enc.getIndexBitWidth()); } Type mlir::sparse_tensor::getPointerOverheadType( - Builder &builder, const SparseTensorEncodingAttr &enc) { + Builder &builder, SparseTensorEncodingAttr enc) { return getOverheadType(builder, pointerOverheadTypeEncoding(enc)); } Type mlir::sparse_tensor::getIndexOverheadType( - Builder &builder, const SparseTensorEncodingAttr &enc) { + Builder &builder, SparseTensorEncodingAttr enc) { return getOverheadType(builder, indexOverheadTypeEncoding(enc)); }