[Mlir-commits] [mlir] [MLIR][XeGPU] Scattered ops sg-to-wi distribution (PR #154949)

Charitha Saumya llvmlistbot at llvm.org
Mon Aug 25 10:19:12 PDT 2025


charithaintc wrote:

Final result (after lowering remaining warpop) :
```
  memref.global "private" @__shared_32xf32 : memref<32xf32, 3>
  func.func @lane_dependent_warp_propagate_read(%arg0: memref<1024xf32>, %arg1: memref<1024xf32>) {
    %0 = ub.poison : f32
    %c0 = arith.constant 0 : index
    %cst = arith.constant dense<[0.000000e+00, 1.000000e+00, 3.000000e+00, 4.000000e+00, 0.000000e+00, 1.000000e+00, 3.000000e+00, 4.000000e+00, 0.000000e+00, 1.000000e+00, 3.000000e+00, 4.000000e+00, 0.000000e+00, 1.000000e+00, 3.000000e+00, 4.000000e+00, 0.000000e+00, 1.000000e+00, 3.000000e+00, 4.000000e+00, 0.000000e+00, 1.000000e+00, 3.000000e+00, 4.000000e+00, 0.000000e+00, 1.000000e+00, 3.000000e+00, 4.000000e+00, 0.000000e+00, 1.000000e+00, 3.000000e+00, 4.000000e+00]> : vector<32xf32>
    %1 = gpu.lane_id
    %2 = arith.cmpi eq, %1, %c0 : index
    %3 = memref.get_global @__shared_32xf32 : memref<32xf32, 3>
    scf.if %2 {
      vector.transfer_write %cst, %3[%c0] {in_bounds = [true]} : vector<32xf32>, memref<32xf32, 3>
    }
    gpu.barrier
    %4 = vector.transfer_read %3[%1], %0 {in_bounds = [true]} : memref<32xf32, 3>, vector<1xf32>
    vector.transfer_write %4, %arg1[%1] : vector<1xf32>, memref<1024xf32>
    return
  }
```
As you can see if the offsets are "weird" it will go though SLM. My point is gather/scatter distribution should not care about it. It is separation of concerns. 

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


More information about the Mlir-commits mailing list