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

Andrey Pavlenko llvmlistbot at llvm.org
Tue May 5 09:22:02 PDT 2026


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

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

>From f460474bbb31dcc84ed2fbd212585c5be2fdb102 Mon Sep 17 00:00:00 2001
From: Andrey Pavlenko <andrey.a.pavlenko at gmail.com>
Date: Tue, 5 May 2026 16:17:25 +0000
Subject: [PATCH] [MLIR][XeGPU] Minor fix for proper handling of 0D memrefs

It fixes the following case:

   vector.transfer_read %arg0[], %0 : memref<f16>, vector<f16>
---
 mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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");
 



More information about the Mlir-commits mailing list