[Mlir-commits] [mlir] [DRAFT] Generalize expand_shape to take shape as explicit input (PR #69267)

Gaurav Shukla llvmlistbot at llvm.org
Thu Oct 26 09:30:17 PDT 2023


================
@@ -167,9 +190,11 @@ static LogicalResult verifyReshapeLikeShapes(OpTy op, ShapedType collapsedType,
 /// Returns true iff the type is a MemRefType and has a non-identity layout.
 bool hasNonIdentityLayout(Type type);
 
+enum class ReshapeOpKind { kExpand, kCollapse };
+
 /// Pattern to collapse producer/consumer reshape ops that are both collapsing
 /// dimensions or are both expanding dimensions.
-template <typename ReshapeOpTy>
+template <typename ReshapeOpTy, ReshapeOpKind opKind>
----------------
Shukla-Gaurav wrote:

Yeah, we can get it by ReshapeOpTy itself.
I guess this extra template parameter maybe added to simplify the check as this utility can be used by reshape ops of many dialects(currently used by memref and tensor dialects). @ramiro050 may have more context on this. 
   

https://github.com/llvm/llvm-project/pull/69267


More information about the Mlir-commits mailing list