[all-commits] [llvm/llvm-project] 0daf20: [mlir][vector] transpose(broadcast) -> broadcast c...

James Newling via All-commits all-commits at lists.llvm.org
Wed Apr 16 10:08:58 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0daf20b3605f19271af7afa4175e7d62194e5578
      https://github.com/llvm/llvm-project/commit/0daf20b3605f19271af7afa4175e7d62194e5578
  Author: James Newling <james.newling at gmail.com>
  Date:   2025-04-16 (Wed, 16 Apr 2025)

  Changed paths:
    M mlir/lib/Dialect/Vector/IR/VectorOps.cpp
    M mlir/test/Dialect/Vector/canonicalize.mlir
    A mlir/test/Dialect/Vector/canonicalize/vector-transpose.mlir

  Log Message:
  -----------
  [mlir][vector] transpose(broadcast) -> broadcast canonicalization (#135096)

Example seen in the 'real world':
 
 ```
 %0 = vector.broadcast %arg0 : vector<1xi8> to vector<1x8xi8>
 %1 = vector.transpose %0, [1, 0] : vector<1x8xi8> to vector<8x1xi8>
 ```
 
 This PR adds a canonicalizer that rewrites the above as
 
```
  %1 = vector.broadcast %arg0 : vector<1xi8> to vector<8x1xi8>
```

It works by determining if a transpose is only shuffling contiguous
broadcast dimensions.



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