-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[LV] Pre-committing tests for changing loop interleaving count computation #70272
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
nilanjana87
merged 5 commits into
llvm:main
from
nilanjana87:loop-interleaving-precommit-tests
Nov 18, 2023
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8ee31fc
[LV] Pre-committing tests for changing interleaving count computation
nilanjana87 55d3431
Addressed reviewer comments
nilanjana87 205335a
Changed test VFs to a more reasonable value, fixed comments
nilanjana87 7c3606a
Changed trip count for the added test cases to test the IC computatio…
nilanjana87 a389673
Disabled redundant output in tests
nilanjana87 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
107 changes: 107 additions & 0 deletions
107
llvm/test/Transforms/LoopVectorize/AArch64/interleave_count.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,107 @@ | ||
; RUN: opt < %s -tiny-trip-count-interleave-threshold=32 -p loop-vectorize -S -pass-remarks=loop-vectorize 2>&1 | FileCheck %s | ||
; TODO: remove -tiny-trip-count-interleave-threshold once the interleave threshold is removed | ||
|
||
target triple = "aarch64-linux-gnu" | ||
|
||
%pair = type { i8, i8 } | ||
|
||
; For this loop with known TC of 32, when the auto-vectorizer chooses VF 16, it should choose | ||
; IC 2 since there is no remainder loop run needed when the vector loop runs. | ||
; CHECK: remark: <unknown>:0:0: vectorized loop (vectorization width: 16, interleaved count: 2) | ||
define void @loop_with_tc_32(ptr noalias %p, ptr noalias %q) { | ||
entry: | ||
br label %for.body | ||
|
||
for.body: | ||
%i = phi i64 [ 0, %entry ], [ %i.next, %for.body ] | ||
%tmp0 = getelementptr %pair, ptr %p, i64 %i, i32 0 | ||
%tmp1 = load i8, ptr %tmp0, align 1 | ||
%tmp2 = getelementptr %pair, ptr %p, i64 %i, i32 1 | ||
%tmp3 = load i8, ptr %tmp2, align 1 | ||
%add = add i8 %tmp1, %tmp3 | ||
%qi = getelementptr i8, ptr %q, i64 %i | ||
store i8 %add, ptr %qi, align 1 | ||
%i.next = add nuw nsw i64 %i, 1 | ||
%cond = icmp eq i64 %i.next, 32 | ||
br i1 %cond, label %for.end, label %for.body | ||
|
||
for.end: | ||
ret void | ||
} | ||
|
||
; TODO: For this loop with known TC of 33, when the auto-vectorizer chooses VF 16, it should choose | ||
; IC 1 since there may be a remainder loop that needs to run after the vector loop. | ||
; CHECK: remark: <unknown>:0:0: vectorized loop (vectorization width: 16, interleaved count: 2) | ||
define void @loop_with_tc_33(ptr noalias %p, ptr noalias %q) { | ||
entry: | ||
br label %for.body | ||
|
||
for.body: | ||
%i = phi i64 [ 0, %entry ], [ %i.next, %for.body ] | ||
%tmp0 = getelementptr %pair, ptr %p, i64 %i, i32 0 | ||
%tmp1 = load i8, ptr %tmp0, align 1 | ||
%tmp2 = getelementptr %pair, ptr %p, i64 %i, i32 1 | ||
%tmp3 = load i8, ptr %tmp2, align 1 | ||
%add = add i8 %tmp1, %tmp3 | ||
%qi = getelementptr i8, ptr %q, i64 %i | ||
store i8 %add, ptr %qi, align 1 | ||
%i.next = add nuw nsw i64 %i, 1 | ||
%cond = icmp eq i64 %i.next, 33 | ||
br i1 %cond, label %for.end, label %for.body | ||
|
||
for.end: | ||
ret void | ||
} | ||
|
||
; For a loop with unknown trip count but a profile showing an approx TC estimate of 32, when the | ||
; auto-vectorizer chooses VF 16, it should choose IC 2 since chances are high that the remainder loop | ||
; won't need to run | ||
; CHECK: remark: <unknown>:0:0: vectorized loop (vectorization width: 16, interleaved count: 2) | ||
define void @loop_with_profile_tc_32(ptr noalias %p, ptr noalias %q, i64 %n) { | ||
entry: | ||
br label %for.body | ||
|
||
for.body: | ||
%i = phi i64 [ 0, %entry ], [ %i.next, %for.body ] | ||
%tmp0 = getelementptr %pair, ptr %p, i64 %i, i32 0 | ||
%tmp1 = load i8, ptr %tmp0, align 1 | ||
%tmp2 = getelementptr %pair, ptr %p, i64 %i, i32 1 | ||
%tmp3 = load i8, ptr %tmp2, align 1 | ||
%add = add i8 %tmp1, %tmp3 | ||
%qi = getelementptr i8, ptr %q, i64 %i | ||
store i8 %add, ptr %qi, align 1 | ||
%i.next = add nuw nsw i64 %i, 1 | ||
%cond = icmp eq i64 %i.next, %n | ||
br i1 %cond, label %for.end, label %for.body, !prof !0 | ||
|
||
for.end: | ||
ret void | ||
} | ||
|
||
; TODO: For a loop with unknown trip count but a profile showing an approx TC estimate of 33, | ||
; when the auto-vectorizer chooses VF 16, it should choose IC 1 since chances are high that the | ||
; remainder loop will need to run | ||
; CHECK: remark: <unknown>:0:0: vectorized loop (vectorization width: 16, interleaved count: 2) | ||
define void @loop_with_profile_tc_33(ptr noalias %p, ptr noalias %q, i64 %n) { | ||
entry: | ||
br label %for.body | ||
|
||
for.body: | ||
%i = phi i64 [ 0, %entry ], [ %i.next, %for.body ] | ||
%tmp0 = getelementptr %pair, ptr %p, i64 %i, i32 0 | ||
%tmp1 = load i8, ptr %tmp0, align 1 | ||
%tmp2 = getelementptr %pair, ptr %p, i64 %i, i32 1 | ||
%tmp3 = load i8, ptr %tmp2, align 1 | ||
%add = add i8 %tmp1, %tmp3 | ||
%qi = getelementptr i8, ptr %q, i64 %i | ||
store i8 %add, ptr %qi, align 1 | ||
%i.next = add nuw nsw i64 %i, 1 | ||
%cond = icmp eq i64 %i.next, %n | ||
br i1 %cond, label %for.end, label %for.body, !prof !1 | ||
|
||
for.end: | ||
ret void | ||
} | ||
|
||
!0 = !{!"branch_weights", i32 1, i32 31} | ||
!1 = !{!"branch_weights", i32 1, i32 32} |
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
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.
Uh oh!
There was an error while loading. Please reload this page.