[Mlir-commits] [mlir] fb98a62 - [mlir] NFC - move declaration of `Range` to StaticValueUtils.h

Christopher Bate llvmlistbot at llvm.org
Thu Sep 8 15:30:06 PDT 2022


Author: Christopher Bate
Date: 2022-09-08T16:29:56-06:00
New Revision: fb98a623fb06f2d557a88cbf1fa51377b38c64bd

URL: https://github.com/llvm/llvm-project/commit/fb98a623fb06f2d557a88cbf1fa51377b38c64bd
DIFF: https://github.com/llvm/llvm-project/commit/fb98a623fb06f2d557a88cbf1fa51377b38c64bd.diff

LOG: [mlir] NFC - move declaration of `Range` to StaticValueUtils.h

`ViewLikeInterface.h` defines a struct `Range`, and it also depends on
`StaticValueUtils.h/cpp`. This change moves the definition of `Range` to
`StaticValueUtils.h`, which should not violate any existing dependency
requirement. This is done to support adding utilities using `Range`
under `Dialect/Utils` without creating a circular dependency on
`ViewLikeInterface`. It is possible that some targets depend on
`ViewLikeInterface` just for the `Range` struct. These can be later
updated to depend on the `MLIRDialectUtils` target.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D133523

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Utils/StaticValueUtils.h
    mlir/include/mlir/Interfaces/ViewLikeInterface.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Utils/StaticValueUtils.h b/mlir/include/mlir/Dialect/Utils/StaticValueUtils.h
index bde7f476bde50..096ee94c0ba4e 100644
--- a/mlir/include/mlir/Dialect/Utils/StaticValueUtils.h
+++ b/mlir/include/mlir/Dialect/Utils/StaticValueUtils.h
@@ -21,6 +21,14 @@
 
 namespace mlir {
 
+/// Represents a range (offset, size, and stride) where each element of the
+/// triple may be dynamic or static.
+struct Range {
+  OpFoldResult offset;
+  OpFoldResult size;
+  OpFoldResult stride;
+};
+
 /// Helper function to dispatch an OpFoldResult into `staticVec` if:
 ///   a) it is an IntegerAttr
 /// In other cases, the OpFoldResult is dispached to the `dynamicVec`.

diff  --git a/mlir/include/mlir/Interfaces/ViewLikeInterface.h b/mlir/include/mlir/Interfaces/ViewLikeInterface.h
index 4bb13ce750607..05b34a730f6ea 100644
--- a/mlir/include/mlir/Interfaces/ViewLikeInterface.h
+++ b/mlir/include/mlir/Interfaces/ViewLikeInterface.h
@@ -21,15 +21,6 @@
 
 namespace mlir {
 
-/// Auxiliary range data structure to unpack the offset, size and stride
-/// operands into a list of triples. Such a list can be more convenient to
-/// manipulate.
-struct Range {
-  OpFoldResult offset;
-  OpFoldResult size;
-  OpFoldResult stride;
-};
-
 /// Return a vector of OpFoldResults given the special value
 /// that indicates whether of the value is dynamic or not.
 SmallVector<OpFoldResult, 4> getMixedValues(ArrayAttr staticValues,


        


More information about the Mlir-commits mailing list