Skip to content

vector.dotf

← vector dialect

Compute a same-element floating-point dot product with an explicit scalar accumulator. Semantics are equivalent to accumulating scalar.fmaf(lhs_lane, rhs_lane, acc) over lanes in logical lane order; use vector.mulf followed by vector.reduce when separately rounded products and additions are required. The source vectors must have the same shape and element type, and the init/result scalar type matches that element type. Zero-lane inputs return init. Optional fastmath flags carry the same floating-point permissions as scalar arithmetic, including reassociation of the fused dot terms.

Operation contract

Property Value
Semantic phase —
Traits Pure
Target contracts vector.contraction

Signature

Kind Name Type Cardinality Description
Operand lhs vector required Floating-point source lanes.
Operand rhs vector required Floating-point source lanes.
Operand init scalar required Scalar accumulator seed.
Result result scalar required Scalar dot-product accumulator result.
Attribute fastmath flags FastMathFlags optional —

Verification constraints

  • HasFloatElement(lhs)
  • SameShape(lhs, rhs)
  • SameType(init, result)
  • SameElementType(lhs, rhs, init)

Examples

%r = vector.dotf %lhs, %rhs, %acc : vector<16xf32>, vector<16xf32>, f32
%r = vector.dotf<reassoc|contract> %lhs, %rhs, %acc : vector<16xf32>, vector<16xf32>, f32