-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[VPlan] Use BlockFrequencyInfo in getPredBlockCostDivisor #158690
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
base: main
Are you sure you want to change the base?
Changes from all commits
994ac69
319b4e7
0b4a76e
bf4d92f
7718fe6
6ee702b
0c92696
fb50e0f
134bff3
7723bd9
f2b5fce
32fbff4
16c4b21
e09d1b3
602fdfa
9c00e81
bb66d78
95e55ef
0b5f3c5
1022c7f
296797f
7a29373
09340fe
55cb35b
42e3c38
70298e4
e0b6b94
c4b3104
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 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -57,8 +57,8 @@ define i64 @same_exit_block_pre_inc_use1_nosve() { | |||||||||||||||||||
| ; CHECK-NEXT: Cost of 48 for VF 16: EMIT vp<{{.*}}> = first-active-lane ir<%cmp3> | ||||||||||||||||||||
| ; CHECK-NEXT: Cost of 0 for VF 16: EMIT vp<{{.*}}> = add | ||||||||||||||||||||
| ; CHECK-NEXT: Cost of 0 for VF 16: vp<{{.*}}> = DERIVED-IV | ||||||||||||||||||||
| ; CHECK: LV: Minimum required TC for runtime checks to be profitable:160 | ||||||||||||||||||||
| ; CHECK-NEXT: LV: Vectorization is not beneficial: expected trip count < minimum profitable VF (64 < 160) | ||||||||||||||||||||
| ; CHECK: LV: Minimum required TC for runtime checks to be profitable:128 | ||||||||||||||||||||
| ; CHECK-NEXT: LV: Vectorization is not beneficial: expected trip count < minimum profitable VF (64 < 128) | ||||||||||||||||||||
| ; CHECK-NEXT: LV: Too many memory checks needed. | ||||||||||||||||||||
| entry: | ||||||||||||||||||||
| %p1 = alloca [1024 x i8] | ||||||||||||||||||||
|
|
@@ -105,7 +105,7 @@ loop.header: | |||||||||||||||||||
| %gep.src = getelementptr inbounds i64, ptr %src, i64 %iv | ||||||||||||||||||||
| %l = load i64, ptr %gep.src, align 1 | ||||||||||||||||||||
| %t = trunc i64 %l to i1 | ||||||||||||||||||||
| br i1 %t, label %exit.0, label %loop.latch | ||||||||||||||||||||
| br i1 %t, label %exit.0, label %loop.latch, !prof !0 | ||||||||||||||||||||
|
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. Added to retain the old branch probability. With BFI, the probability of exit.0 being taken is computed as 3% (why that is, I'm not sure) and the IV increment isn't discounted in the VF=1 plan.
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. That is weird. I'd expect trunc i64 to i1 to give a probability of 50% given it's essentially asking for the likelihood of loading an odd-numbered value!
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. Oh it looks like it's because this is branching to the loop exit, and BPI scales the weight down of the exiting branch by the trip count as a heuristic, which I guess makes sense: llvm-project/llvm/lib/Analysis/BranchProbabilityInfo.cpp Lines 895 to 903 in 07ad928
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| loop.latch: | ||||||||||||||||||||
| %iv.next = add i64 %iv, 1 | ||||||||||||||||||||
|
|
@@ -120,4 +120,6 @@ exit.1: | |||||||||||||||||||
| ret i64 0 | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| !0 = !{!"branch_weights", i32 1, i32 1} | ||||||||||||||||||||
|
|
||||||||||||||||||||
| attributes #1 = { "target-features"="+sve" vscale_range(1,16) } | ||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.