[Mlir-commits] [mlir] [MLIR][XeGPU] Minor fix for proper handling of 0D memrefs (PR #195877)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue May 5 09:23:09 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Andrey Pavlenko (AndreyPavlenko)

<details>
<summary>Changes</summary>

It fixes the following case:
```
   vector.transfer_read %arg0[], %0 : memref<f16>, vector<f16>
```

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


1 Files Affected:

- (modified) mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp (+6-1) 


``````````diff
diff --git a/mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp b/mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp
index 36e1975017881..61585b6853b6e 100644
--- a/mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp
+++ b/mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp
@@ -85,7 +85,12 @@ static LogicalResult transferPreconditions(PatternRewriter &rewriter,
   // Validate further transfer op semantics.
   SmallVector<int64_t> strides;
   int64_t offset;
-  if (failed(srcTy.getStridesAndOffset(strides, offset)) || strides.back() != 1)
+  if (failed(srcTy.getStridesAndOffset(strides, offset)))
+    return rewriter.notifyMatchFailure(xferOp,
+                                       "The memref strides cannot be inferred");
+  if (strides.empty())
+    return rewriter.notifyMatchFailure(xferOp, "0D memref is not supported");
+  if (strides.back() != 1)
     return rewriter.notifyMatchFailure(
         xferOp, "Buffer must be contiguous in the innermost dimension");
 

``````````

</details>


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


More information about the Mlir-commits mailing list