[all-commits] [llvm/llvm-project] 244ebe: Reapply [mlir][vector] Refactor WarpOpScfForOp to ...

Charitha Saumya via All-commits all-commits at lists.llvm.org
Mon Jul 14 15:42:18 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 244ebef1ddbc6a77f17c36562d4a4292654940a6
      https://github.com/llvm/llvm-project/commit/244ebef1ddbc6a77f17c36562d4a4292654940a6
  Author: Charitha Saumya <136391709+charithaintc at users.noreply.github.com>
  Date:   2025-07-14 (Mon, 14 Jul 2025)

  Changed paths:
    M mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp
    M mlir/lib/Dialect/XeGPU/Transforms/XeGPUSubgroupDistribute.cpp
    M mlir/test/Dialect/Vector/vector-warp-distribute.mlir

  Log Message:
  -----------
  Reapply [mlir][vector] Refactor WarpOpScfForOp to support unused or swapped forOp results. (#148313)

Reapply attempt for : https://github.com/llvm/llvm-project/pull/148291
Fix for the build failure reported in :
https://lab.llvm.org/buildbot/#/builders/116/builds/15477

-----

This crash is caused by mismatch of distributed type returned by
`getDistributedType` and intended distributed type for forOp results.

Solution diff:
https://github.com/llvm/llvm-project/commit/20c2cf67662c3b3fdecf95a0e280809f98d8db50

Example:
```
func.func @warp_scf_for_broadcasted_result(%arg0: index) -> vector<1xf32> {
  %c128 = arith.constant 128 : index
  %c1 = arith.constant 1 : index
  %c0 = arith.constant 0 : index
  %2 = gpu.warp_execute_on_lane_0(%arg0)[32] -> (vector<1xf32>) {
    %ini = "some_def"() : () -> (vector<1xf32>)
    %0 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini) -> (vector<1xf32>) {
      %1 = "some_op"(%arg4) : (vector<1xf32>) -> (vector<1xf32>)
      scf.yield %1 : vector<1xf32>
    }
    gpu.yield %0 : vector<1xf32>
  }
  return %2 : vector<1xf32>
}
``` 
In this case the distributed type for forOp result is `vector<1xf32>`
(result is not distributed and broadcasted to all lanes instead).
However, in this case `getDistributedType` will return NULL type.

Therefore, if the distributed type can be recovered from warpOp, we
should always do that first before using `getDistributedType`



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