[Mlir-commits] [mlir] 4369972 - [mlir][sparse] minor header ordering cleanup
Aart Bik
llvmlistbot at llvm.org
Thu Oct 6 13:56:15 PDT 2022
Author: Aart Bik
Date: 2022-10-06T13:56:03-07:00
New Revision: 4369972281db9187f697211b8466cbce3bfe87e7
URL: https://github.com/llvm/llvm-project/commit/4369972281db9187f697211b8466cbce3bfe87e7
DIFF: https://github.com/llvm/llvm-project/commit/4369972281db9187f697211b8466cbce3bfe87e7.diff
LOG: [mlir][sparse] minor header ordering cleanup
Order of methods was getting a bit out of sync with headers
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D135377
Added:
Modified:
mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h b/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h
index abac47070eb46..7e8c5eb36d880 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h
@@ -21,6 +21,7 @@
#include "mlir/IR/Builders.h"
namespace mlir {
+
class Location;
class Type;
class Value;
@@ -151,7 +152,7 @@ class SparseTensorLoopEmitter {
//===----------------------------------------------------------------------===//
// ExecutionEngine/SparseTensorUtils helper functions.
//===----------------------------------------------------------------------===//
-//
+
/// Converts an overhead storage bitwidth to its internal type-encoding.
OverheadType overheadTypeEncoding(unsigned width);
@@ -194,10 +195,7 @@ StringRef primaryTypeFunctionSuffix(Type elemTp);
DimLevelType dimLevelTypeEncoding(SparseTensorEncodingAttr::DimLevelType dlt);
//===----------------------------------------------------------------------===//
-// Misc code generators.
-//
-// TODO: both of these should move upstream to their respective classes.
-// Once RFCs have been created for those changes, list them here.
+// Misc code generators and utilities.
//===----------------------------------------------------------------------===//
/// Generates a 1-valued attribute of the given type. This supports
@@ -211,8 +209,24 @@ Attribute getOneAttr(Builder &builder, Type tp);
/// true if `v` is NaN).
Value genIsNonzero(OpBuilder &builder, Location loc, Value v);
+/// Computes the shape of destination tensor of a reshape operator. This is only
+/// used when operands have dynamic shape. The shape of the destination is
+/// stored into dstShape.
+void genReshapeDstShape(Location loc, PatternRewriter &rewriter,
+ SmallVector<Value, 4> &dstShape,
+ ArrayRef<Value> srcShape,
+ ArrayRef<int64_t> staticDstShape,
+ ArrayRef<ReassociationIndices> reassociation);
+
+/// Translate indices during a reshaping operation.
+void translateIndicesArray(OpBuilder &builder, Location loc,
+ ArrayRef<ReassociationIndices> reassociation,
+ ValueRange srcIndices, ArrayRef<Value> srcShape,
+ ArrayRef<Value> dstShape,
+ SmallVectorImpl<Value> &dstIndices);
+
//===----------------------------------------------------------------------===//
-// Constant generators.
+// Inlined constant generators.
//
// All these functions are just wrappers to improve code legibility;
// therefore, we mark them as `inline` to avoid introducing any additional
@@ -315,21 +329,6 @@ constantDimLevelTypeEncoding(OpBuilder &builder, Location loc,
static_cast<uint8_t>(dimLevelTypeEncoding(dlt)));
}
-/// Computes the shape of destination tensor of a reshape operator. This is only
-/// used when operands have dynamic shape. The shape of the destination is
-/// stored into dstShape.
-void genReshapeDstShape(Location loc, PatternRewriter &rewriter,
- SmallVector<Value, 4> &dstShape,
- ArrayRef<Value> srcShape,
- ArrayRef<int64_t> staticDstShape,
- ArrayRef<ReassociationIndices> reassociation);
-
-/// Helper method to translate indices during a reshaping operation.
-void translateIndicesArray(OpBuilder &builder, Location loc,
- ArrayRef<ReassociationIndices> reassociation,
- ValueRange srcIndices, ArrayRef<Value> srcShape,
- ArrayRef<Value> dstShape,
- SmallVectorImpl<Value> &dstIndices);
} // namespace sparse_tensor
} // namespace mlir
More information about the Mlir-commits
mailing list