[all-commits] [llvm/llvm-project] 1dd00d: [mlir][Vector] Fix a propagation bug with broadcast
qcolombet via All-commits
all-commits at lists.llvm.org
Tue Jun 6 07:53:49 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1dd00d39037b14e06555a79a397ee1e85d787db9
https://github.com/llvm/llvm-project/commit/1dd00d39037b14e06555a79a397ee1e85d787db9
Author: Quentin Colombet <quentin.colombet at gmail.com>
Date: 2023-06-06 (Tue, 06 Jun 2023)
Changed paths:
M mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp
M mlir/test/Dialect/Vector/vector-warp-distribute.mlir
Log Message:
-----------
[mlir][Vector] Fix a propagation bug with broadcast
In the vector distribute patterns, we used to move
`vector.broadcast`s out of `vector.warp_execute_on_lane0`s
irrespectively of how they were defined.
This could create broadcast operations with invalid semantic.
E.g.,
```
%r = warop ...[32] ... -> vector<1x2xf32> {
%val = broadcast %in : vector<64xf32> to vetor<1x64xf32>
vector.yield %val : vector<1x64xf32>
}
```
=>
```
%r = warop ...[32] ... -> vector<64xf32> {
vector.yield %in : vector<64xf32>
}
// Broadcasting to a narrower type!
broadcast %r : vector<64xf32> to vector<1x2xf32>
```
The root issue is we are trying to broadcast something that is not the same
for each thread, so there is actually nothing to propagate here.
The fix checks that the broadcast we want to create actually makes sense.
Differential Revision: https://reviews.llvm.org/D152154
More information about the All-commits
mailing list