Fix buildbot failure by explicitly disabling partial reductions in TTI. (#190165)

Partial reductions were previously disabled by default, but by
implementing a generic cost-model in BasicTTIImpl (#189905) this now
accidentally enables the use of those when vectorising loops for targets
that may not support this yet.
This commit is contained in:
Sander de Smalen 2026-04-03 16:33:39 +01:00 committed by GitHub
parent 1484e0f16a
commit 62bbe3fffc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 92 additions and 0 deletions

View File

@ -66,6 +66,15 @@ public:
unsigned Index, const Value *Op0, const Value *Op1,
TTI::VectorInstrContext VIC =
TTI::VectorInstrContext::None) const override;
InstructionCost getPartialReductionCost(
unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
TTI::TargetCostKind CostKind,
std::optional<FastMathFlags> FMF) const override {
return InstructionCost::getInvalid();
}
};
} // end namespace llvm

View File

@ -39,6 +39,15 @@ public:
unsigned ScalarOpdIdx) const override;
bool isTargetIntrinsicWithOverloadTypeAtArg(Intrinsic::ID ID,
int OpdIdx) const override;
InstructionCost getPartialReductionCost(
unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
TTI::TargetCostKind CostKind,
std::optional<FastMathFlags> FMF) const override {
return InstructionCost::getInvalid();
}
};
} // namespace llvm

View File

@ -169,6 +169,15 @@ public:
bool forceScalarizeMaskedScatter(VectorType *VTy,
Align Alignment) const override;
InstructionCost getPartialReductionCost(
unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
TTI::TargetCostKind CostKind,
std::optional<FastMathFlags> FMF) const override {
return InstructionCost::getInvalid();
}
/// @}
InstructionCost

View File

@ -57,6 +57,15 @@ public:
TTI::MemCmpExpansionOptions
enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const override;
InstructionCost getPartialReductionCost(
unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
TTI::TargetCostKind CostKind,
std::optional<FastMathFlags> FMF) const override {
return InstructionCost::getInvalid();
}
};
} // end namespace llvm

View File

@ -36,6 +36,15 @@ public:
bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1,
const TargetTransformInfo::LSRCost &C2) const override;
InstructionCost getPartialReductionCost(
unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
TTI::TargetCostKind CostKind,
std::optional<FastMathFlags> FMF) const override {
return InstructionCost::getInvalid();
}
};
} // end namespace llvm

View File

@ -222,6 +222,15 @@ public:
return false;
}
InstructionCost getPartialReductionCost(
unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
TTI::TargetCostKind CostKind,
std::optional<FastMathFlags> FMF) const override {
return InstructionCost::getInvalid();
}
ValueUniformity getValueUniformity(const Value *V) const override;
};

View File

@ -169,6 +169,15 @@ public:
getMemIntrinsicInstrCost(const MemIntrinsicCostAttributes &MICA,
TTI::TargetCostKind CostKind) const override;
InstructionCost getPartialReductionCost(
unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
TTI::TargetCostKind CostKind,
std::optional<FastMathFlags> FMF) const override {
return InstructionCost::getInvalid();
}
private:
// The following constant is used for estimating costs on power9.
static const InstructionCost::CostType P9PipelineFlushEstimate = 80;

View File

@ -64,6 +64,15 @@ public:
bool isLegalMaskedGather(Type *DataType, Align Alignment) const override;
bool isLegalMaskedScatter(Type *DataType, Align Alignment) const override;
InstructionCost getPartialReductionCost(
unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
TTI::TargetCostKind CostKind,
std::optional<FastMathFlags> FMF) const override {
return InstructionCost::getInvalid();
}
};
} // namespace llvm

View File

@ -51,6 +51,15 @@ public:
Type *Ty = nullptr) const override;
TypeSize
getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const override;
InstructionCost getPartialReductionCost(
unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
TTI::TargetCostKind CostKind,
std::optional<FastMathFlags> FMF) const override {
return InstructionCost::getInvalid();
}
/// @}
};

View File

@ -157,6 +157,17 @@ public:
return true;
return !isSupportedReduction(II->getIntrinsicID());
}
InstructionCost getPartialReductionCost(
unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
ElementCount VF,
TargetTransformInfo::PartialReductionExtendKind OpAExtend,
TargetTransformInfo::PartialReductionExtendKind OpBExtend,
std::optional<unsigned> BinOp,
TargetTransformInfo::TargetCostKind CostKind,
std::optional<FastMathFlags> FMF) const override {
return InstructionCost::getInvalid();
}
};
} // namespace llvm