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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Dec 26 22:38:38 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-vector

Author: Balaji V. Iyer. (bviyer)

<details>
<summary>Changes</summary>

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

Possible fix for #<!-- -->74463

---
Full diff: https://github.com/llvm/llvm-project/pull/76428.diff


1 Files Affected:

- (modified) mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp (+1-1) 


``````````diff
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.

``````````

</details>


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


More information about the Mlir-commits mailing list