-
Notifications
You must be signed in to change notification settings - Fork 15k
[VPlan] Handle live-in extend operands in partial reduction ::computeCost #163175
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
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 |
|---|---|---|
|
|
@@ -329,7 +329,12 @@ VPPartialReductionRecipe::computeCost(ElementCount VF, | |
| // recipe. | ||
| auto HandleWiden = [&](VPWidenRecipe *Widen) { | ||
| if (match(Widen, m_Sub(m_ZeroInt(), m_VPValue(Op)))) { | ||
| Widen = dyn_cast<VPWidenRecipe>(Op->getDefiningRecipe()); | ||
| Widen = dyn_cast<VPWidenRecipe>(Op); | ||
| if (!Widen) { | ||
| assert(Op->isLiveIn() && | ||
| "Operand must either be a VPWidenRecipe or a live-in"); | ||
| return; | ||
|
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. What if 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. Currently it must always be a live-in I think. I added an assert for now, thanks |
||
| } | ||
| } | ||
| Opcode = Widen->getOpcode(); | ||
| VPRecipeBase *ExtAR = Widen->getOperand(0)->getDefiningRecipe(); | ||
|
|
@@ -355,14 +360,15 @@ VPPartialReductionRecipe::computeCost(ElementCount VF, | |
| ExtAType = GetExtendKind(OpR); | ||
| } else if (isa<VPReductionPHIRecipe>(OpR)) { | ||
| auto RedPhiOp1R = getOperand(1)->getDefiningRecipe(); | ||
| if (isa<VPWidenCastRecipe>(RedPhiOp1R)) { | ||
| if (isa_and_nonnull<VPWidenCastRecipe>(RedPhiOp1R)) { | ||
|
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 left a comment yesterday on @SamTebbs33' patch that took these changes: #147302 (comment) 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 realise I should probably have been a bit clearer here; I don't believe that |
||
| InputTypeA = Ctx.Types.inferScalarType(RedPhiOp1R->getOperand(0)); | ||
| ExtAType = GetExtendKind(RedPhiOp1R); | ||
| } else if (auto Widen = dyn_cast<VPWidenRecipe>(RedPhiOp1R)) | ||
| } else if (auto Widen = dyn_cast_if_present<VPWidenRecipe>(RedPhiOp1R)) | ||
| HandleWiden(Widen); | ||
| } else if (auto Widen = dyn_cast<VPWidenRecipe>(OpR)) { | ||
| } else if (auto Widen = dyn_cast_if_present<VPWidenRecipe>(OpR)) { | ||
| HandleWiden(Widen); | ||
| } else if (auto Reduction = dyn_cast<VPPartialReductionRecipe>(OpR)) { | ||
| } else if (auto Reduction = | ||
| dyn_cast_if_present<VPPartialReductionRecipe>(OpR)) { | ||
| return Reduction->computeCost(VF, Ctx); | ||
| } | ||
| auto *PhiType = Ctx.Types.inferScalarType(getOperand(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.
I left a comment yesterday on @SamTebbs33' patch that took these changes: #147302 (comment)
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 to clarify what I meant, I don't think there's ever a case where this wouldn't be a WidenRecipe. For the case where
Opwould be a constant, then-Opwould also have been a constant.It probably makes sense to keep the assert though.