[Mlir-commits] [mlir] [mlir] Check if the stride tensor is empty. (PR #76428)

Balaji V. Iyer. llvmlistbot at llvm.org
Tue Dec 26 22:38:14 PST 2023


https://github.com/bviyer created https://github.com/llvm/llvm-project/pull/76428

Added a check to see if the stride tensor is empty. If so then return false for isContiguousSlice function.

Possible fix for #74463

>From dd5d9f8fdf36e26b16b48297a8810068f81a2583 Mon Sep 17 00:00:00 2001
From: "Balaji V. Iyer." <43187390+bviyer at users.noreply.github.com>
Date: Wed, 27 Dec 2023 06:34:28 +0000
Subject: [PATCH] [mlir] Check if the stride tensor is empty.

Added a check to see if the stride tensor is empty. If so then
return false for isContiguousSlice function.

Possible fix for #74463
---
 mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp b/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
index 2ad992af989c96..c1c0f5483a6af5 100644
--- a/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
+++ b/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
@@ -271,7 +271,7 @@ bool vector::isContiguousSlice(MemRefType memrefType, VectorType vectorType) {
     return false;
 
   // Cond 1: A contiguous memref will always have a unit trailing stride.
-  if (strides.back() != 1)
+  if (strides.empty() || strides.back() != 1)
     return false;
 
   // Cond 2: Strides of a contiguous memref have to match the flattened dims.



More information about the Mlir-commits mailing list