[Mlir-commits] [mlir] [mlir][xegpu] Lower 1D vector transfers to scattered load/store (PR #213469)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Aug 1 15:55:12 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- mlir/lib/Dialect/XeGPU/Transforms/XeGPUSgToLaneDistribute.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUSgToLaneDistribute.cpp b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUSgToLaneDistribute.cpp
index 13b7fe52a..bc85140f9 100644
--- a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUSgToLaneDistribute.cpp
+++ b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUSgToLaneDistribute.cpp
@@ -1672,9 +1672,10 @@ shuffleDataAsLaneLayoutChange(ConversionPatternRewriter &rewriter, Location loc,
 /// `inputData`/`targetData` are the `repackDim` `lane_data` of the input and
 /// target layouts; exactly one must be 1 (round-robin) and the other `k`
 /// (contiguous). Returns failure if that does not hold.
-static FailureOr<Value>
-repackLaneData(ConversionPatternRewriter &rewriter, Location loc, Value src,
-               int64_t repackDim, int64_t inputData, int64_t targetData) {
+static FailureOr<Value> repackLaneData(ConversionPatternRewriter &rewriter,
+                                       Location loc, Value src,
+                                       int64_t repackDim, int64_t inputData,
+                                       int64_t targetData) {
   auto srcTy = dyn_cast<VectorType>(src.getType());
   if (!srcTy)
     return failure();
@@ -1698,8 +1699,8 @@ repackLaneData(ConversionPatternRewriter &rewriter, Location loc, Value src,
   // `repackDim` is unit), so collapse it to 1D, shuffle once, and restore it.
   if (srcTy.getNumElements() == k) {
     if (rank == 1)
-      return Value(xegpu::LaneShuffleOp::create(rewriter, loc, runTy, src,
-                                                mode));
+      return Value(
+          xegpu::LaneShuffleOp::create(rewriter, loc, runTy, src, mode));
     Value flat = vector::ShapeCastOp::create(rewriter, loc, runTy, src);
     Value shuffled =
         xegpu::LaneShuffleOp::create(rewriter, loc, runTy, flat, mode);
@@ -1844,18 +1845,16 @@ struct SgToLaneConvertLayout
       // `repackDim` must be the distributed dim (lane_layout != 1) and the
       // other innermost dim non-distributed (lane_layout == 1).
       int64_t otherDim = repackDim == rank - 1 ? rank - 2 : rank - 1;
-      bool laneLayoutOk =
-          repackDim != -1 && laneLayout[repackDim] != 1 &&
-          (rank < 2 || laneLayout[otherDim] == 1);
+      bool laneLayoutOk = repackDim != -1 && laneLayout[repackDim] != 1 &&
+                          (rank < 2 || laneLayout[otherDim] == 1);
 
       // Exactly one dimension must change, and it must be one of the two
       // innermost (>= rank - 2).
       if (repackDim != -1 && repackDim >= rank - 2 && !multipleChanged &&
           laneLayoutOk) {
-        FailureOr<Value> res =
-            repackLaneData(rewriter, op.getLoc(), adaptor.getSource(),
-                           repackDim, laneData[repackDim],
-                           targetLaneData[repackDim]);
+        FailureOr<Value> res = repackLaneData(
+            rewriter, op.getLoc(), adaptor.getSource(), repackDim,
+            laneData[repackDim], targetLaneData[repackDim]);
         if (succeeded(res)) {
           rewriter.replaceOp(op, *res);
           return success();

``````````

</details>


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


More information about the Mlir-commits mailing list