-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[VPlan] Implement VPWidenLoad/StoreEVLRecipe::computeCost(). #109644
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 1 commit
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 |
|---|---|---|
|
|
@@ -2253,7 +2253,9 @@ InstructionCost VPWidenMemoryRecipe::computeCost(ElementCount VF, | |
| Cost += Ctx.TTI.getMemoryOpCost(Ingredient.getOpcode(), Ty, Alignment, AS, | ||
| CostKind, OpInfo, &Ingredient); | ||
| } | ||
| if (!Reverse) | ||
| // If the store value is a live-in scalar value which is uniform, we don't | ||
| // need to calculate the reverse cost. | ||
|
||
| if (!Reverse || (isa<StoreInst>(Ingredient) && getOperand(1)->isLiveIn())) | ||
| return Cost; | ||
|
|
||
| return Cost += Ctx.TTI.getShuffleCost(TargetTransformInfo::SK_Reverse, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,160 @@ | ||||||
| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 | ||||||
| ; RUN: opt < %s --prefer-predicate-over-epilogue=predicate-dont-vectorize --passes=loop-vectorize -mcpu=sifive-p470 -mattr=+v,+f -S| FileCheck %s | ||||||
| ; RUN: opt < %s --prefer-predicate-over-epilogue=predicate-dont-vectorize --passes=loop-vectorize -mcpu=sifive-p470 -mattr=+v,+f -force-tail-folding-style=data-with-evl -S| FileCheck %s --check-prefixes=EVL | ||||||
| ; COM: From issue #109468 | ||||||
|
||||||
| target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128" | ||||||
| target triple = "riscv64-unknown-linux-gnu" | ||||||
|
|
||||||
| define void @lshift_significand(i32 %n, ptr nocapture writeonly %0) local_unnamed_addr #0 { | ||||||
|
||||||
| define void @lshift_significand(i32 %n, ptr nocapture writeonly %0) local_unnamed_addr #0 { | |
| define void @evl_store_cost(i32 %n, ptr nocapture writeonly %dst) { |
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.
Renamed and removed, thanks.
Outdated
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.
| for.body9: ; preds = %entry, %for.body9 | |
| loop: |
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.
Removed, thanks.
Outdated
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.
| %indvars.iv = phi i64 [ %spec.select, %entry ], [ %indvars.iv.next, %for.body9 ] | |
| %iv = phi i64 [ %spec.select, %entry ], [ %indvars.iv.next, %for.body9 ] |
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.
Renamed, thanks.
Outdated
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.
| %arrayidx13 = getelementptr [3 x i64], ptr %0, i64 0, i64 %1 | |
| %arrayidx13 = getelementptr i64, ptr %0, i64 %1 |
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.
Removed, thanks.
Outdated
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.
| for.end16: ; preds = %for.body9 | |
| exit: |
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.
Removed, thanks.
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.
isInvariant uses SCEV to determine loop-invariance, while isLiveIn only returns true for values defined outside the VPlan. This may introduce additional divergences, where the operand is invariant via SCEV but defined inside the loop
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.
You are right, using this implementation may introduce extra divergences.
I think the implementation in the legacy cost model is what we want but we cannot get the analysis in the VPlanRecipes.
Do you have other better methods to figure out if the value is loop invariant in the VPlanRecipes?