| Issue |
242183
|
| Summary |
[mlir][vector] FlattenMultiReduction drops scalable dims from the mask of a masked multi_reduction
|
| Labels |
mlir
|
| Assignees |
|
| Reporter |
adit4443ya
|
For a masked `vector.multi_reduction` over a scalable vector, `FlattenMultiReduction` (`mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp`) reshapes the mask without its scalable dims, while the data is reshaped with them. Lowering then fails verification with either lowering strategy.
## Reproducer
Compiler Explorer (MLIR opt trunk, both strategies):- https://godbolt.org/z/11a4nesGb
```mlir
func.func @masked_multi_reduction(%src: vector<1x1x[4]xf32>, %acc: vector<1x1xf32>,
%mask: vector<1x1x[4]xi1>) -> vector<1x1xf32> {
%0 = vector.mask %mask {
vector.multi_reduction <add>, %src, %acc [2] : vector<1x1x[4]xf32> to vector<1x1xf32>
} : vector<1x1x[4]xi1> -> vector<1x1xf32>
return %0 : vector<1x1xf32>
}
```
`mlir-opt repro.mlir --lower-vector-multi-reduction=lowering-strategy=inner-parallel`:
```
error: 'vector.shape_cast' op has different number of scalable dims at source (1) and result (0)
note: see current operation: %0 = "vector.shape_cast"(%arg2) : (vector<1x1x[4]xi1>) -> vector<4x1xi1>
```
`mlir-opt repro.mlir --lower-vector-multi-reduction=lowering-strategy=inner-reduction`:
```
error: 'vector.extract' op inferred type(s) 'vector<[4]xi1>' are incompatible with return type(s) of operation 'vector<4xi1>'
error: 'vector.extract' op failed to infer returned types
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs