llvm::BasicTTIImplBase::getPartialReductionCost

Return the cost of a partial reduction to a narrower vector.

Synopsis

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;

Description

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.

Return Value

The cost of a partial reduction to a narrower vector.

Parameters

NameDescription
OpcodeReduction opcode.
InputTypeAType of the first input before any extend.
InputTypeBType of the second input before any extend, or null.
AccumTypeAccumulator vector element/result type.
VFElement count of the vector being reduced into the accumulator.
OpAExtendExtend kind applied to the first input, if any.
OpBExtendExtend kind applied to the second input, if any.
BinOpOptional binary opcode on extended inputs.
CostKindKind of cost to compute.
FMFFast-math flags for FP partial reductions, else nullopt.