[Mlir-commits] [mlir] [MLIR][XeGPU] Add lowering from transfer_read/transfer_write to load_gather/store_scatter (PR #152429)

Jianhui Li llvmlistbot at llvm.org
Wed Aug 13 14:26:06 PDT 2025


================
@@ -121,11 +121,23 @@ isValidGatherScatterBufferParams(Type maskTy, VectorType valueTy,
   auto maskShape = getShapeOf(maskTy);
   auto valueShape = getShapeOf(valueTy);
 
-  // a valid shape for SIMT case
   if (valueTy.getRank() == 1) {
-    if (valueTy.getNumElements() != chunkSize)
-      return emitError() << "value elements must match chunk size " << chunkSize
-                         << " for SIMT code.";
+    auto maskVecTy = dyn_cast<VectorType>(maskTy);
+    if (!maskVecTy)
+      return emitError() << "Expecting a vector type mask.";
+    int64_t maskSize = maskVecTy.getNumElements();
+
+    auto valueSize = valueTy.getNumElements();
+    if (chunkSize == 1) {
+      if (maskSize != valueSize)
+        return emitError()
+               << "Mask should match value except the chunk size dim.";
+    } else {
+      if (chunkSize != valueSize)
----------------
Jianhui-Li wrote:

refactored. For SIMT case, the only dimension is for valueSize == chunksize

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


More information about the Mlir-commits mailing list