[Mlir-commits] [mlir] ed68282 - Revert "[mlir][memref] NFC - Move utility function declaration from IR/MemRef.h to Utils/MemRefUtils.h"
Nicolas Vasilache
llvmlistbot at llvm.org
Fri Jul 14 07:31:59 PDT 2023
Author: Nicolas Vasilache
Date: 2023-07-14T16:31:54+02:00
New Revision: ed682829422559cf3196b46f2469a2a638602956
URL: https://github.com/llvm/llvm-project/commit/ed682829422559cf3196b46f2469a2a638602956
DIFF: https://github.com/llvm/llvm-project/commit/ed682829422559cf3196b46f2469a2a638602956.diff
LOG: Revert "[mlir][memref] NFC - Move utility function declaration from IR/MemRef.h to Utils/MemRefUtils.h"
This reverts commit 8b161e977298ea8207ae4bdcee8483ce47601f31.
This creates cyclic dependencies that cannot be easily untangled for now.
Added:
Modified:
mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
mlir/include/mlir/Dialect/MemRef/Utils/MemRefUtils.h
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h b/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
index c93f0452f0a9b7..72463dca715ca3 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
@@ -9,10 +9,12 @@
#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"
@@ -30,6 +32,48 @@ 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
//===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/Dialect/MemRef/Utils/MemRefUtils.h b/mlir/include/mlir/Dialect/MemRef/Utils/MemRefUtils.h
index 143a6b58bfd1a3..e1504f030defa6 100644
--- a/mlir/include/mlir/Dialect/MemRef/Utils/MemRefUtils.h
+++ b/mlir/include/mlir/Dialect/MemRef/Utils/MemRefUtils.h
@@ -16,55 +16,13 @@
#ifndef MLIR_DIALECT_MEMREF_UTILS_MEMREFUTILS_H
#define MLIR_DIALECT_MEMREF_UTILS_MEMREFUTILS_H
-#include "mlir/Interfaces/ViewLikeInterface.h"
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Dialect/MemRef/IR/MemRef.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.
More information about the Mlir-commits
mailing list