Return the cost of a partial reduction to a narrower vector.
Declared in <llvm/CodeGen/BasicTTIImpl.h>
InstructionCost
getPartialReductionCost(
unsigned int Opcode,
Type* InputTypeA,
Type* InputTypeB,
Type* AccumType,
ElementCount VF,
TTI::PartialReductionExtendKind OpAExtend,
TTI::PartialReductionExtendKind OpBExtend,
std::optional<unsigned int> BinOp,
TTI::TargetCostKind CostKind,
std::optional<FastMathFlags> FMF) const override;
Partial reductions use llvm.vector.partial.reduce.* intrinsics that accumulate into AccumType from a second vector with element count VF. BinOp and the extend kinds describe optional extends or a binary operation on extends.
The cost of a partial reduction to a narrower vector.
| Name | Description |
|---|---|
| Opcode | Reduction opcode. |
| InputTypeA | Type of the first input before any extend. |
| InputTypeB | Type of the second input before any extend, or null. |
| AccumType | Accumulator vector element/result type. |
| VF | Element count of the vector being reduced into the accumulator. |
| OpAExtend | Extend kind applied to the first input, if any. |
| OpBExtend | Extend kind applied to the second input, if any. |
| BinOp | Optional binary opcode on extended inputs. |
| CostKind | Kind of cost to compute. |
| FMF | Fast-math flags for FP partial reductions, else nullopt. |