[Mlir-commits] [mlir] [mlir][XeGPU][Transform] Add gather/scatter coalescing analysis. (PR #201684)

Jianhui Li llvmlistbot at llvm.org
Wed Jun 24 20:02:54 PDT 2026


================
@@ -113,6 +113,29 @@ isValidGatherScatterBufferParams(Type offsetsTy, Type maskTy,
   return success();
 }
 
+// Validates the `contiguous_chunk` attribute against the op's offsets type:
+// the inner offsets dimension is contiguous in runs of `size`, so `size` must
+// be in [2, innermost offsets dim].
+static LogicalResult
+isValidContiguousChunk(std::optional<uint64_t> chunk, Type offsetsTy,
+                       function_ref<InFlightDiagnostic()> emitError) {
+  if (!chunk)
+    return success();
+  auto offsetsVecTy = dyn_cast<VectorType>(offsetsTy);
+  if (!offsetsVecTy)
+    return emitError()
+           << "contiguous_chunk requires vector offsets (one per lane).";
+  int64_t size = static_cast<int64_t>(*chunk);
+  int64_t inner = offsetsVecTy.getShape().back();
+  if (size < 2)
+    return emitError() << "contiguous_chunk " << size << " must be >= 2";
+  if (size > inner)
----------------
Jianhui-Li wrote:

consider a stronger check like if(innerDim%contiguity)

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


More information about the Mlir-commits mailing list