[Mlir-commits] [mlir] [mlir] Introduce `trailingNDimsContiguous`	for MemRefs (PR #78247)
    Diego Caballero 
    llvmlistbot at llvm.org
       
    Tue Jan 23 08:31:21 PST 2024
    
    
  
================
@@ -967,3 +967,32 @@ bool mlir::isLastMemrefDimUnitStride(MemRefType type) {
   auto successStrides = getStridesAndOffset(type, strides, offset);
   return succeeded(successStrides) && (strides.empty() || strides.back() == 1);
 }
+
+bool mlir::trailingNDimsContiguous(MemRefType type, int64_t n) {
+  if (!isLastMemrefDimUnitStride(type))
+    return false;
+
+  auto memrefShape = type.getShape().take_back(n);
+  int64_t offset;
+  SmallVector<int64_t> stridesFull;
+  if (!succeeded(getStridesAndOffset(type, stridesFull, offset)))
----------------
dcaballe wrote:
Is the memref layout being taken into account anywhere? That's one of the differences between vector and memref. 
https://github.com/llvm/llvm-project/pull/78247
    
    
More information about the Mlir-commits
mailing list