[Mlir-commits] [mlir] [mlir][XeGPU][Transform] Add gather/scatter coalescing analysis. (PR #201684)
Jianhui Li
llvmlistbot at llvm.org
Thu Jun 18 21:47:26 PDT 2026
================
@@ -0,0 +1,1177 @@
+//===- XeGPUCoalesceGatherScatter.cpp - Coalesce scatter accesses --------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the gather/scatter coalescing analysis. It decides
+// whether an `xegpu.load` / `xegpu.store` gather/scatter accesses `N`
+// contiguous elements per lane along the innermost dimension, and, if so,
+// stamps a `xegpu.coalesce_hint<factor = N>` attribute recording the chosen
+// factor. The decision is driven by a small XeGPU-local axis-info dataflow
+// analysis tracking per-axis `contiguity`, `constancy`, and `divisibility`.
+//
+// The analysis performs no rewrite. The hint it stamps is turned into a
+// `lane_data` layout by `coalesceGatherScatter` (used by the test pass) or
+// read directly by layout propagation; the actual memory-message rewrite is
+// left to the downstream WG-to-SG / SG-to-Lane distribution passes, which
+// interpret `lane_data`.
+//
+// The analysis tracks per-axis information for vectors of integer / index
+// type at any rank. The coalescing decision is computed against the
+// innermost dimension. 2-D offsets vectors with a leading unit dimension
+// (e.g. `vector<1x32xindex>`) are handled by treating the inner dim as the
+// lane dim.
+//
+// All-equal offsets ("uniform inner dim") are detected by the analysis
+// but the pass currently leaves such ops alone — there is no layout-only
+// encoding for "all lanes load the same scalar", and the previous
+// length-1-load + `vector.broadcast` rewrite was removed because it
----------------
Jianhui-Li wrote:
no need to document the previous implementation.
https://github.com/llvm/llvm-project/pull/201684
More information about the Mlir-commits
mailing list