[all-commits] [llvm/llvm-project] 47d237: [mlir][XeGPU] Add an SLM round-trip fallback for s...

Jianhui Li via All-commits all-commits at lists.llvm.org
Sat Oct 3 19:32:47 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 47d237ba0b8c8241d2fab80ba6709c4d5cbaaba7
      https://github.com/llvm/llvm-project/commit/47d237ba0b8c8241d2fab80ba6709c4d5cbaaba7
  Author: Jianhui Li <jian.hui.li at intel.com>
  Date:   2026-10-04 (Sun, 04 Oct 2026)

  Changed paths:
    M mlir/include/mlir/Dialect/XeGPU/Utils/XeGPUUtils.h
    M mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
    M mlir/lib/Dialect/XeGPU/Transforms/XeGPUSgToLaneDistribute.cpp
    M mlir/lib/Dialect/XeGPU/Utils/XeGPUUtils.cpp
    M mlir/test/Dialect/XeGPU/sg-to-lane-distribute-unit.mlir

  Log Message:
  -----------
  [mlir][XeGPU] Add an SLM round-trip fallback for sg-to-lane convert_layout (#227884)

This PR adds a general fallback lowering for xegpu.convert_layout in the
sg-to-lane distribution pass, which round-trips the value through shared
local memory.

The existing lane-level lowerings are all special cases: the layouts
fold into each other, or they differ in a way a xegpu.lane_shuffle or a
gpu.shuffle can express. Anything else failed to legalize and stopped
the pipeline — for instance a conversion that only moves the lane_data
of a dimension distributed over part of the subgroup:

```mlir
xegpu.convert_layout %src
  <{input_layout  = #xegpu.layout<lane_layout = [1, 2, 8], lane_data = [1, 1, 4]>,
    target_layout = #xegpu.layout<lane_layout = [1, 2, 8], lane_data = [1, 1, 1]>}>
  : vector<1x2x32xbf16>
```

Here dim 2 is distributed over 8 of the 16 lanes and dim 1 over the
other factor of 2, so the subgroup splits into two groups that each hold
a run of their own. A single xegpu.lane_shuffle round-robins with a
stride of the whole subgroup size and cannot express that.

The new pattern works for any pair of layouts which can both distribute
the value: each lane writes its fragment to SLM at the coordinates
input_layout assigns it, then reads it back from the ones target_layout
assigns. It mirrors what XeGPUWgToSgDistribute already does for a
workgroup-level convert_layout whose sg_layout changes, and is
registered at a lower pattern benefit than every specialized lowering,
so it only runs once they have all declined.

assisted-by-claude

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply at anthropic.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list