[all-commits] [llvm/llvm-project] 38d230: [MLIR] Minor fixes to FoldTransposeBroadcast rewri...

Momchil Velikov via All-commits all-commits at lists.llvm.org
Mon May 19 01:46:02 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 38d2306b62d6b0b7cc0a1bc0d73a2f9c8323bd87
      https://github.com/llvm/llvm-project/commit/38d2306b62d6b0b7cc0a1bc0d73a2f9c8323bd87
  Author: Momchil Velikov <momchil.velikov at arm.com>
  Date:   2025-05-19 (Mon, 19 May 2025)

  Changed paths:
    M mlir/lib/Dialect/Vector/IR/VectorOps.cpp

  Log Message:
  -----------
  [MLIR] Minor fixes to FoldTransposeBroadcast rewrite (#140083)

This patch contains two minor changes, which I believe were the original
author's intent.

* when folding `transpose(broadcast(x))` emit `broadcast(x)` instead of
`broadcast(broadcast(x))`. The latter causes transient verifier
failures with `mlir-opt --debug` , e.g.
```
mlir-asm-printer: 'func.func' failed to verify and will be printed in generic form
"func.func"() <{function_type = (vector<4x1x1x7xi8>) -> vector<3x2x4x5x6x7xi8>, sym_name = "broadcast_transpose_mixed_example"}> ({
^bb0(%arg0: vector<4x1x1x7xi8>):
  %0 = "vector.broadcast"(%arg0) : (vector<4x1x1x7xi8>) -> vector<2x3x4x5x6x7xi8>
  %1 = "vector.broadcast"(%0) : (vector<2x3x4x5x6x7xi8>) -> vector<3x2x4x5x6x7xi8>
  "func.return"(%1) : (vector<3x2x4x5x6x7xi8>) -> ()
}) : () -> ()
```

* when checking permutation groups the variable `low` was set just once
to zero, thus checking was quadratic. It looks the intent was for `low`
to track the beginning of each dimension groups. (Nevertheless the check
was correct).



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