-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mlir][Vector] Improve support for 0-d vectors in vector dialect lowerings #112913
Comments
Hi! This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below. |
@llvm/issue-subscribers-good-first-issue Author: Kunwar Grover (Groverkss)
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: https://github.com//pull/112907
Some example issues:
|
Hi @Groverkss, do you mean a draft like this? #112937, to merge AnyVector and AnyVectorOfAnyRank type constraints? |
Probably not. It would involve supporting 0-d vectors natively for most vector dialect operations and then merging them. My understanding is that these two type constraints exist because 0-d vector support wasn't plumbed through properly. I think an easier, and more useful patch would be to rename them: AnyVector -> AnyNonZeroRankVector, AnyVectorOfAnyRank -> AnyVector . The current naming is very confusing, and this would be a good first step. The next step would probably involve supporting 0-d vectors in vector.multi_reduction, vector.contract and then other ops. |
Thanks, I will consiconsider it! :) |
Since this issue hasn't gotten much activity in 2 months, I've begun working on it here #121454 |
0-d vectors are supported now and so these patterns are no longer required. This covers a part of this issue #112913 . Additionally this removes %arg2 in mlir/test/Conversion/GPUCommon/transfer_write.mlir and renames %arg3 to %arg2 as %arg2 was originally not required.
…ng (#121454) 0-d vectors are supported now and so these patterns are no longer required. This covers a part of this issue llvm/llvm-project#112913 . Additionally this removes %arg2 in mlir/test/Conversion/GPUCommon/transfer_write.mlir and renames %arg3 to %arg2 as %arg2 was originally not required.
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:
llvm-project/mlir/lib/Dialect/Vector/Transforms/LowerVectorTransfer.cpp
Line 524 in 0a3347d
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
llvm-project/mlir/include/mlir/IR/CommonTypeConstraints.td
Line 661 in 721b796
The text was updated successfully, but these errors were encountered: