[Mlir-commits] [mlir] [MLIR][XeGPU] Promote memref.alloca to SLM in convert-vector-to-xegpu (PR #197978)

Igor Zamyatin llvmlistbot at llvm.org
Fri May 22 10:24:16 PDT 2026


================
@@ -613,3 +613,57 @@ gpu.func @load_1D_vector_addrspace3_unsupported(%source: memref<32xf32, 3>,
 // LOAD-GATHER: vector.transfer_read
 
 }
+
+// -----
+// memref.alloca with the default address space is promoted to SLM
+// (address space 3) so that the transfer_read can be lowered to
+// xegpu.load_matrix.
+gpu.module @xevm_module {
+gpu.func @load_2D_vector_alloca_promoted_to_slm(%offset: index)
+    -> vector<8x16xf32> {
+  %buf = memref.alloca() : memref<16x32xf32>
+  %c0 = arith.constant 0.0 : f32
+  %0 = vector.transfer_read %buf[%offset, %offset], %c0
+    {in_bounds = [true, true]} : memref<16x32xf32>, vector<8x16xf32>
+  gpu.return %0 : vector<8x16xf32>
+}
+
+// LOAD-ND-LABEL: @load_2D_vector_alloca_promoted_to_slm
+// LOAD-ND: %[[BUF:.+]] = memref.alloca() : memref<16x32xf32, 3>
+// LOAD-ND: %[[MEM_DESC:.+]] = xegpu.create_mem_desc %[[BUF]] : memref<16x32xf32, 3> -> !xegpu.mem_desc<16x32xf32>
+// LOAD-ND: xegpu.load_matrix %[[MEM_DESC]]
+
+// LOAD-GATHER-LABEL: @load_2D_vector_alloca_promoted_to_slm
+// LOAD-GATHER: %[[BUF:.+]] = memref.alloca() : memref<16x32xf32, 3>
+// LOAD-GATHER: %[[MEM_DESC:.+]] = xegpu.create_mem_desc %[[BUF]] : memref<16x32xf32, 3> -> !xegpu.mem_desc<16x32xf32>
+// LOAD-GATHER: xegpu.load_matrix %[[MEM_DESC]]
+
+}
+
+// -----
+// memref.alloca is unconditionally promoted to SLM (address space 3). A 1D
----------------
Garra1980 wrote:

can be affected by https://github.com/llvm/llvm-project/pull/198652 I think

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


More information about the Mlir-commits mailing list