[Mlir-commits] [mlir] 6e0a76a - [MLIR][XeGPU][VectorToXeGPU] Minor fix for proper handling of 0D memrefs (#195877)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Jun 26 09:29:23 PDT 2026
Author: Andrey Pavlenko
Date: 2026-06-26T18:29:19+02:00
New Revision: 6e0a76a45d17f78a26cdd9c5d8e5ad4b2a505010
URL: https://github.com/llvm/llvm-project/commit/6e0a76a45d17f78a26cdd9c5d8e5ad4b2a505010
DIFF: https://github.com/llvm/llvm-project/commit/6e0a76a45d17f78a26cdd9c5d8e5ad4b2a505010.diff
LOG: [MLIR][XeGPU][VectorToXeGPU] Minor fix for proper handling of 0D memrefs (#195877)
It fixes the following case:
```
vector.transfer_read %arg0[], %0 : memref<f16>, vector<f16>
```
Added:
Modified:
mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp
mlir/test/Conversion/VectorToXeGPU/transfer-read-to-xegpu.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp b/mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp
index 9d92f966c126d..8dcc9771d8db4 100644
--- a/mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp
+++ b/mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp
@@ -86,7 +86,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");
diff --git a/mlir/test/Conversion/VectorToXeGPU/transfer-read-to-xegpu.mlir b/mlir/test/Conversion/VectorToXeGPU/transfer-read-to-xegpu.mlir
index daa53c0877c8f..f64bcc27940ea 100644
--- a/mlir/test/Conversion/VectorToXeGPU/transfer-read-to-xegpu.mlir
+++ b/mlir/test/Conversion/VectorToXeGPU/transfer-read-to-xegpu.mlir
@@ -667,3 +667,16 @@ gpu.func @load_1D_vector_alloca_promoted_unsupported(%offset: index)
// LOAD-GATHER-NOT: xegpu.load_matrix
}
+
+// -----
+gpu.module @xevm_module {
+gpu.func @load_0D_memref_unsupported(%source: memref<f16>) -> vector<f16> {
+ %c0 = arith.constant 0.0 : f16
+ %0 = vector.transfer_read %source[], %c0 : memref<f16>, vector<f16>
+ gpu.return %0 : vector<f16>
+}
+
+// CHECK-LABEL: @load_0D_memref_unsupported
+// CHECK: vector.transfer_read
+
+}
\ No newline at end of file
More information about the Mlir-commits
mailing list