[RandomIRBuilder] Remove use of getNonOpaquePointerElementType() (NFC)
authorNikita Popov <npopov@redhat.com>
Fri, 14 Jul 2023 08:54:38 +0000 (10:54 +0200)
committerNicolas Vasilache <nicolasvasilache@users.noreply.github.com>
Fri, 14 Jul 2023 09:09:01 +0000 (11:09 +0200)
mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
mlir/include/mlir/Dialect/MemRef/Utils/MemRefUtils.h

index 72463dc..c93f045 100644 (file)
@@ -9,12 +9,10 @@
 #ifndef MLIR_DIALECT_MEMREF_IR_MEMREF_H_
 #define MLIR_DIALECT_MEMREF_IR_MEMREF_H_
 
-#include "mlir/Bytecode/BytecodeOpInterface.h"
 #include "mlir/Dialect/Arith/IR/Arith.h"
+#include "mlir/Dialect/MemRef/Utils/MemRefUtils.h"
 #include "mlir/Dialect/Utils/ReshapeOpsUtils.h"
-#include "mlir/IR/Dialect.h"
 #include "mlir/Interfaces/CallInterfaces.h"
-#include "mlir/Interfaces/CastInterfaces.h"
 #include "mlir/Interfaces/ControlFlowInterfaces.h"
 #include "mlir/Interfaces/CopyOpInterface.h"
 #include "mlir/Interfaces/InferTypeOpInterface.h"
@@ -32,48 +30,6 @@ enum class AtomicRMWKind : uint64_t;
 class AtomicRMWKindAttr;
 } // namespace arith
 
-class Location;
-class OpBuilder;
-
-raw_ostream &operator<<(raw_ostream &os, const Range &range);
-
-/// Return the list of Range (i.e. offset, size, stride). Each Range
-/// entry contains either the dynamic value or a ConstantIndexOp constructed
-/// with `b` at location `loc`.
-SmallVector<Range, 8> getOrCreateRanges(OffsetSizeAndStrideOpInterface op,
-                                        OpBuilder &b, Location loc);
-
-namespace memref {
-
-/// This is a common utility used for patterns of the form
-/// "someop(memref.cast) -> someop". It folds the source of any memref.cast
-/// into the root operation directly.
-LogicalResult foldMemRefCast(Operation *op, Value inner = nullptr);
-
-/// Return an unranked/ranked tensor type for the given unranked/ranked memref
-/// type.
-Type getTensorTypeFromMemRefType(Type type);
-
-/// Finds a single dealloc operation for the given allocated value. If there
-/// are > 1 deallocates for `allocValue`, returns std::nullopt, else returns the
-/// single deallocate if it exists or nullptr.
-std::optional<Operation *> findDealloc(Value allocValue);
-
-/// Return the dimension of the given memref value.
-OpFoldResult getMixedSize(OpBuilder &builder, Location loc, Value value,
-                          int64_t dim);
-
-/// Return the dimensions of the given memref value.
-SmallVector<OpFoldResult> getMixedSizes(OpBuilder &builder, Location loc,
-                                        Value value);
-
-/// Create a rank-reducing SubViewOp @[0 .. 0] with strides [1 .. 1] and
-/// appropriate sizes (i.e. `memref.getSizes()`) to reduce the rank of `memref`
-/// to that of `targetShape`.
-Value createCanonicalRankReducingSubViewOp(OpBuilder &b, Location loc,
-                                           Value memref,
-                                           ArrayRef<int64_t> targetShape);
-} // namespace memref
 } // namespace mlir
 
 //===----------------------------------------------------------------------===//
index e1504f0..143a6b5 100644 (file)
 #ifndef MLIR_DIALECT_MEMREF_UTILS_MEMREFUTILS_H
 #define MLIR_DIALECT_MEMREF_UTILS_MEMREFUTILS_H
 
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
+#include "mlir/Interfaces/ViewLikeInterface.h"
+#include "mlir/Support/LogicalResult.h"
 
 namespace mlir {
 
+class Location;
 class MemRefType;
+class OpBuilder;
+class Operation;
+
+llvm::raw_ostream &operator<<(raw_ostream &os, const Range &range);
+
+/// Return the list of Range (i.e. offset, size, stride). Each Range
+/// entry contains either the dynamic value or a ConstantIndexOp constructed
+/// with `b` at location `loc`.
+SmallVector<Range, 8> getOrCreateRanges(OffsetSizeAndStrideOpInterface op,
+                                        OpBuilder &b, Location loc);
 
 namespace memref {
+class ExtractStridedMetadataOp;
+
+/// This is a common utility used for patterns of the form
+/// "someop(memref.cast) -> someop". It folds the source of any memref.cast
+/// into the root operation directly.
+LogicalResult foldMemRefCast(Operation *op, Value inner = nullptr);
+
+/// Return an unranked/ranked tensor type for the given unranked/ranked memref
+/// type.
+Type getTensorTypeFromMemRefType(Type type);
+
+/// Finds a single dealloc operation for the given allocated value. If there
+/// are > 1 deallocates for `allocValue`, returns std::nullopt, else returns
+/// the single deallocate if it exists or nullptr.
+std::optional<Operation *> findDealloc(Value allocValue);
+
+/// Return the dimension of the given memref value.
+OpFoldResult getMixedSize(OpBuilder &builder, Location loc, Value value,
+                          int64_t dim);
+
+/// Return the dimensions of the given memref value.
+SmallVector<OpFoldResult> getMixedSizes(OpBuilder &builder, Location loc,
+                                        Value value);
+
+/// Create a rank-reducing SubViewOp @[0 .. 0] with strides [1 .. 1] and
+/// appropriate sizes (i.e. `memref.getSizes()`) to reduce the rank of
+/// `memref` to that of `targetShape`.
+Value createCanonicalRankReducingSubViewOp(OpBuilder &b, Location loc,
+                                           Value memref,
+                                           ArrayRef<int64_t> targetShape);
 
 /// Returns true, if the memref type has static shapes and represents a
 /// contiguous chunk of memory.