-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[TTI][RISCV] Remove deduplicate type-based VP costing of VPReduction.NFC #117708
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
Conversation
@llvm/pr-subscribers-backend-risc-v Author: LiqinWeng (LiqinWeng) ChangesRefered to: #115983 Full diff: https://github.com/llvm/llvm-project/pull/117708.diff 2 Files Affected:
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 98cbb4886642bf..21c1f98c78fe7c 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -1647,6 +1647,38 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
UI->getPredicate(), CostKind);
}
}
+ if (VPReductionIntrinsic::isVPReduction(ICA.getID())) {
+ std::optional<Intrinsic::ID> RedID =
+ VPIntrinsic::getFunctionalIntrinsicIDForVP(ICA.getID());
+ assert(RedID.has_value());
+ switch (ICA.getID()) {
+ case Intrinsic::vp_reduce_add:
+ case Intrinsic::vp_reduce_fadd:
+ case Intrinsic::vp_reduce_mul:
+ case Intrinsic::vp_reduce_fmul:
+ case Intrinsic::vp_reduce_and:
+ case Intrinsic::vp_reduce_or:
+ case Intrinsic::vp_reduce_xor: {
+ unsigned RedOp = getArithmeticReductionInstruction(*RedID);
+ return thisT()->getArithmeticReductionCost(
+ RedOp, cast<VectorType>(ICA.getArgTypes()[1]), ICA.getFlags(),
+ CostKind);
+ }
+ case Intrinsic::vp_reduce_smax:
+ case Intrinsic::vp_reduce_smin:
+ case Intrinsic::vp_reduce_umax:
+ case Intrinsic::vp_reduce_umin:
+ case Intrinsic::vp_reduce_fmax:
+ case Intrinsic::vp_reduce_fmaximum:
+ case Intrinsic::vp_reduce_fmin:
+ case Intrinsic::vp_reduce_fminimum: {
+ Intrinsic::ID MinMaxID = getMinMaxReductionIntrinsicOp(*RedID);
+ return thisT()->getMinMaxReductionCost(
+ MinMaxID, cast<VectorType>(ICA.getArgTypes()[1]),
+ ICA.getFlags(), CostKind);
+ }
+ }
+ }
}
std::optional<Intrinsic::ID> FID =
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 8f0ef69258b165..bbded57bb92ab0 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -1144,37 +1144,6 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
: RISCV::VMV_V_X,
LT.second, CostKind);
}
- case Intrinsic::vp_reduce_add:
- case Intrinsic::vp_reduce_fadd:
- case Intrinsic::vp_reduce_mul:
- case Intrinsic::vp_reduce_fmul:
- case Intrinsic::vp_reduce_and:
- case Intrinsic::vp_reduce_or:
- case Intrinsic::vp_reduce_xor: {
- std::optional<Intrinsic::ID> RedID =
- VPIntrinsic::getFunctionalIntrinsicIDForVP(ICA.getID());
- assert(RedID.has_value());
- unsigned RedOp = getArithmeticReductionInstruction(*RedID);
- return getArithmeticReductionCost(RedOp,
- cast<VectorType>(ICA.getArgTypes()[1]),
- ICA.getFlags(), CostKind);
- }
- case Intrinsic::vp_reduce_smax:
- case Intrinsic::vp_reduce_smin:
- case Intrinsic::vp_reduce_umax:
- case Intrinsic::vp_reduce_umin:
- case Intrinsic::vp_reduce_fmax:
- case Intrinsic::vp_reduce_fmaximum:
- case Intrinsic::vp_reduce_fmin:
- case Intrinsic::vp_reduce_fminimum: {
- std::optional<Intrinsic::ID> RedID =
- VPIntrinsic::getFunctionalIntrinsicIDForVP(ICA.getID());
- assert(RedID.has_value());
- Intrinsic::ID MinMaxID = getMinMaxReductionIntrinsicOp(*RedID);
- return getMinMaxReductionCost(MinMaxID,
- cast<VectorType>(ICA.getArgTypes()[1]),
- ICA.getFlags(), CostKind);
- }
}
if (ST->hasVInstructions() && RetTy->isVectorTy()) {
|
case Intrinsic::vp_reduce_xor: { | ||
unsigned RedOp = getArithmeticReductionInstruction(*RedID); | ||
return thisT()->getArithmeticReductionCost( | ||
RedOp, cast<VectorType>(ICA.getArgTypes()[1]), ICA.getFlags(), |
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.
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.
sorry, fixed
08a6201
to
bb33f53
Compare
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.
LGTM, thanks!
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/30/builds/11230 Here is the relevant piece of the build log for the reference
|
Refered to: #115983