-
Notifications
You must be signed in to change notification settings - Fork 16.8k
[LV] Restrict scalable vectorization to targets with power-of-2 vscale #183065
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -296,9 +296,9 @@ cl::opt<unsigned> llvm::ForceTargetInstructionCost( | |
|
|
||
| static cl::opt<bool> ForceTargetSupportsScalableVectors( | ||
| "force-target-supports-scalable-vectors", cl::init(false), cl::Hidden, | ||
| cl::desc( | ||
| "Pretend that scalable vectors are supported, even if the target does " | ||
| "not support them. This flag should only be used for testing.")); | ||
| cl::desc("Pretend that scalable vectors are supported and vscale is a " | ||
| "power of two, even if the target does " | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This adjusts the wording so that we can assume power-of-2 vscale in the target independent tests
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd probably revert this specific hunk, since the LangRef change has landed. |
||
| "not support them. This flag should only be used for testing.")); | ||
|
|
||
| static cl::opt<unsigned> SmallLoopCost( | ||
| "small-loop-cost", cl::init(20), cl::Hidden, | ||
|
|
@@ -3387,6 +3387,10 @@ bool LoopVectorizationCostModel::isScalableVectorizationAllowed() { | |
| if (!TTI.supportsScalableVectors() && !ForceTargetSupportsScalableVectors) | ||
| return false; | ||
|
|
||
| if (!TTI.isVScaleKnownToBeAPowerOfTwo() && | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it probably makes sense to now just remove this hook completely, right?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am working on PR to do this. I just wanted to land the LangRef change first to unblock other related work. |
||
| !ForceTargetSupportsScalableVectors) | ||
| return false; | ||
|
|
||
| if (Hints->isScalableVectorizationDisabled()) { | ||
| reportVectorizationInfo("Scalable vectorization is explicitly disabled", | ||
| "ScalableVectorizationDisabled", ORE, TheLoop); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
llvm/test/Transforms/LoopVectorize/RISCV/zvl32b.ll triggers this assert because we query isVScaleKnownToBeAPowerOfTwo earlier.