[Mlir-commits] [mlir] [mlir][xegpu] Remove chunk_size attribute; infer from types (PR #205122)

Jianhui Li llvmlistbot at llvm.org
Mon Sep 14 22:22:02 PDT 2026


================
@@ -770,6 +787,33 @@ class LoadStoreToXeVMPattern : public OpConversionPattern<OpType> {
                                           basePtrI64);
     }
     Value mask = adaptor.getMask();
+
+    // Coalesce a chunked access into one contiguous block access.
+    //
+    // Distribution gives every element its own offset and mask bit. A lane
+    // whose `lane_data` is wider than one element therefore arrives here with
+    // `vector<D>` offsets and mask beside a `vector<D>` value, and those D
+    // offsets are one ascending run: `lane_data` is by definition the number of
+    // neighbouring elements the lane takes, and `inst_data` blocks the op so
+    // that no lane is given more. A single element converts to a scalar offset
+    // instead, so a surviving vector offset always means a contiguous run.
+    //
+    // A block access needs one base offset and one mask bit, so take both from
+    // element 0. The values come from the converted operands, so no casts are
+    // needed. The mask is still checked: a tail mask can leave a lane with a
+    // partial run, and one bit cannot stand for D different bits. That case
+    // fails to match below, as before.
+    auto origOffsetsTy = dyn_cast<VectorType>(op.getOffsets().getType());
+    if (isa<VectorType>(offset.getType()) && origOffsetsTy && valOrResVecTy &&
+        origOffsetsTy.getNumElements() == valOrResVecTy.getNumElements() &&
+        isUniformMask(op.getMask())) {
----------------
Jianhui-Li wrote:

What if the shape is dynamic, and the mask can't be determined at compile-time? I guess it should be handled at the xegpu blocking pass which only allows lane_data = contiguous_block_size for static shape.  

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


More information about the Mlir-commits mailing list