-
Notifications
You must be signed in to change notification settings - Fork 14.6k
[LV] Account for vp_merge in out of loop EVL reductions in legacy cost model #115903
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
Merged
lukel97
merged 4 commits into
llvm:main
from
lukel97:evl-tail-folding/out-of-loop-legacy-cost-model
Nov 14, 2024
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-reduction-cost.ll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,34 @@ | ||||||
; RUN: opt -passes=loop-vectorize -debug-only=loop-vectorize \ | ||||||
; RUN: -force-tail-folding-style=data-with-evl \ | ||||||
; RUN: -prefer-predicate-over-epilogue=predicate-dont-vectorize \ | ||||||
; RUN: -mtriple=riscv64 -mattr=+v -S < %s 2>&1 | FileCheck %s \ | ||||||
; RUN: --check-prefix=EVL | ||||||
|
||||||
; RUN: opt -passes=loop-vectorize -debug-only=loop-vectorize \ | ||||||
; RUN: -prefer-predicate-over-epilogue=predicate-dont-vectorize \ | ||||||
; RUN: -mtriple=riscv64 -mattr=+v -S < %s 2>&1 | FileCheck %s \ | ||||||
; RUN: --check-prefix=NO-EVL | ||||||
|
||||||
; EVL: Cost of 2 for VF vscale x 4: WIDEN-INTRINSIC vp<%{{.+}}> = call llvm.vp.merge(ir<true>, ir<%add>, ir<%rdx>, vp<%{{.+}}>) | ||||||
; EVL: LV: Found an estimated cost of 2 for VF vscale x 4 For instruction: %rdx = phi i32 [ %start, %entry ], [ %add, %for.body ] | ||||||
|
||||||
; NO-EVL: Cost of 0 for VF vscale x 4: EMIT vp<%{{.+}}> = select vp<%active.lane.mask>, ir<%add>, ir<%rdx> | ||||||
; NO-EVL: LV: Found an estimated cost of 0 for VF vscale x 4 For instruction: %rdx = phi i32 [ %start, %entry ], [ %add, %for.body ] | ||||||
|
||||||
define i32 @add(ptr %a, i64 %n, i32 %start) { | ||||||
entry: | ||||||
br label %for.body | ||||||
|
||||||
for.body: | ||||||
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.
Suggested change
nit: slightly shorter name |
||||||
%iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] | ||||||
%rdx = phi i32 [ %start, %entry ], [ %add, %for.body ] | ||||||
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %iv | ||||||
%0 = load i32, ptr %arrayidx, align 4 | ||||||
%add = add nsw i32 %0, %rdx | ||||||
%iv.next = add nuw nsw i64 %iv, 1 | ||||||
%exitcond.not = icmp eq i64 %iv.next, %n | ||||||
br i1 %exitcond.not, label %for.end, label %for.body | ||||||
|
||||||
for.end: | ||||||
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.
Suggested change
slightly shorter name |
||||||
ret i32 %add | ||||||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just testing the EVL cost here, no need to have this second run line?