Description
A number of patterns in vector dialect lowerings predate 0-d vector support and side step from 0-d vectors by converting them to scalars and then broadcasting them. An example patch fixing this: #112907
Some example issues:
- https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Vector/Transforms/LowerVectorTransfer.cpp has patterns that convert vector.load/vector.store on 0-d vectors to memref.load/memref.store on scalars: .
I have tested removing these, and the llvm ir generated from llvm.store with 0-d vectors is correct. (Good first issue)
-
vector.multi_reduction (https://mlir.llvm.org/docs/Dialects/Vector/#vectormulti_reduction-vectormultidimreductionop) requires the result to be a scalar when all dimensions are reduced. This causes additional corner case handling for scalars in vector.multi_reduction patterns. A better solution would be to allow 0-d vectors as result of vector.multi_reduction. (Not a good first issue, requires more understanding of vector dialect)
-
Merge AnyVector and AnyVectorOfAnyRank type constraints
(needs work before this can be done)