Skip to content

vector.reduce

← vector dialect

Reduce all lanes of a vector into a scalar accumulator/result using the template combining kind. The init operand and result have the same scalar type, and the combining kind must be valid for the input element type. Optional fastmath flags carry the same floating-point permissions as scalar arithmetic; contraction may fuse producer products into FMA accumulation when the producer permits it too.

Operation contract

Property Value
Semantic phase executable
Traits Pure

Signature

Kind Name Type Cardinality Description
Operand input vector required —
Operand init scalar required —
Result result scalar required —
Attribute kind enum CombiningKind required —
Attribute fastmath flags FastMathFlags optional —

Verification constraints

  • SameType(init, result)
  • SameElementType(input, init, result)

Examples

%sum = vector.reduce<addf> %v, %zero : vector<16xf32>, f32