Vector API Quick Reference#

The tables below list the functions of the vector API. The “EW” column indicates whether the operation acts element-wise.

The “Signature” column is intended as a hint which quickly conveys the kind of the conceptual inputs to and outputs from the operation. The signatures are only intended to convey how many (conceptual) inputs and outputs there are, and their dimensionality.

The functions themselves will typically take more arguments than these signatures indicate. For example, most functions take vector lengths as input, and many take shift values which are used to control growth of element bit-depth. Check the function’s full documentation to get more detailed information.

The following symbols are used in the signatures:

Symbol

Description

\(\mathbb{S}\)

A scalar input or output value.

\(\mathbb{V}\)

A vector-valued input or output.

\(\mathbb{M}\)

A matrix-valued input or output.

\(\varnothing\)

Placeholder indicating no input or output.

For example, the operation signature \((\mathbb{V \times V \times S}) \to \mathbb{V}\) indicates the operation takes two vector inputs and a scalar input, and the output is a vector.

32-bit Vector Ops

Function

EW

Signature

vect_s32_copy()

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_s32_abs()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_s32_abs_sum()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s32_add()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_s32_add_scalar()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_s32_argmax()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s32_argmin()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s32_clip()

x

\((\mathbb{V \times S \times S})\) \(\to \mathbb{V}\)

vect_s32_dot()

\((\mathbb{V \times V})\) \(\to \mathbb{S}\)

vect_s32_energy()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s32_headroom()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s32_inverse()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_s32_max()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s32_max_elementwise()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_s32_min()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s32_min_elementwise()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_s32_mul()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_s32_macc()

x

\((\mathbb{V \times V \times V})\) \(\to \mathbb{V}\)

vect_s32_nmacc()

x

\((\mathbb{V \times V \times V})\) \(\to \mathbb{V}\)

vect_s32_rect()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_s32_scale()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_s32_set()

x

\(\mathbb{S}\) \(\to \mathbb{V}\)

vect_s32_shl()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_s32_shr()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_s32_sqrt()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_s32_sub()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_s32_sum()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s32_zip()

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_s32_unzip()

\(\mathbb{V}\) \(\to (\mathbb{V \times V})\)

vect_s32_convolve_valid()

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_s32_convolve_same()

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_s32_log_base()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_s32_log()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_s32_log2()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_s32_log10()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

chunk_s32_dot()

\((\mathbb{V \times V})\) \(\to \mathbb{S}\)

chunk_s32_log()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

16-bit Vector Ops

Function

EW

Signature

vect_s16_abs()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_s16_abs_sum()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s16_add()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_s16_add_scalar()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_s16_argmax()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s16_argmin()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s16_clip()

x

\((\mathbb{V \times S \times S})\) \(\to \mathbb{V}\)

vect_s16_dot()

\((\mathbb{V \times V})\) \(\to \mathbb{S}\)

vect_s16_energy()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s16_headroom()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s16_inverse()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_s16_max()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s16_max_elementwise()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_s16_min()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s16_min_elementwise()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_s16_mul()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_s16_macc()

x

\((\mathbb{V \times V \times V})\) \(\to \mathbb{V}\)

vect_s16_nmacc()

x

\((\mathbb{V \times V \times V})\) \(\to \mathbb{V}\)

vect_s16_rect()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_s16_scale()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_s16_set()

x

\(\mathbb{S}\) \(\to \mathbb{V}\)

vect_s16_shl()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_s16_shr()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_s16_sqrt()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_s16_sub()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_s16_sum()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_s16_extract_high_byte()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_s16_extract_low_byte()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

8-bit Vector Ops

Function

EW

Signature

Brief

vect_s8_is_negative()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

Identify negative elements

32-bit Complex Vector Ops

Function

EW

Signature

vect_complex_s32_add()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_complex_s32_add_scalar()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_complex_s32_conj_macc()

x

\((\mathbb{V \times V \times V})\) \(\to \mathbb{V}\)

vect_complex_s32_conj_mul()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_complex_s32_conj_nmacc()

x

\((\mathbb{V \times V \times V})\) \(\to \mathbb{V}\)

vect_complex_s32_conjugate()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_complex_s32_headroom()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_complex_s32_macc()

x

\((\mathbb{V \times V \times V})\) \(\to \mathbb{V}\)

vect_complex_s32_mag()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_complex_s32_mul()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_complex_s32_nmacc()

x

\((\mathbb{V \times V \times V})\) \(\to \mathbb{V}\)

vect_complex_s32_real_mul()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_complex_s32_real_scale()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_complex_s32_scale()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_complex_s32_set()

x

\(\mathbb{S}\) \(\to \mathbb{V}\)

vect_complex_s32_shl()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_complex_s32_shr()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_complex_s32_squared_mag()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_complex_s32_sub()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_complex_s32_sum()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_complex_s32_tail_reverse()

\(\mathbb{V}\) \(\to \mathbb{V}\)

16-bit Complex Vector Ops

Function

EW

Signature

vect_complex_s16_add()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_complex_s16_add_scalar()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_complex_s16_conj_mul()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_complex_s16_conj_macc()

x

\((\mathbb{V \times V \times V})\) \(\to \mathbb{V}\)

vect_complex_s16_conj_nmacc()

x

\((\mathbb{V \times V \times V})\) \(\to \mathbb{V}\)

vect_complex_s16_headroom()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_complex_s16_macc()

x

\((\mathbb{V \times V \times V})\) \(\to \mathbb{V}\)

vect_complex_s16_mag()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_complex_s16_mul()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_complex_s16_nmacc()

x

\((\mathbb{V \times V \times V})\) \(\to \mathbb{V}\)

vect_complex_s16_real_mul()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_complex_s16_real_scale()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_complex_s16_scale()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_complex_s16_set()

x

\(\mathbb{S}\) \(\to \mathbb{V}\)

vect_complex_s16_shl()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_complex_s16_shr()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_complex_s16_squared_mag()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_complex_s16_sub()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_complex_s16_sum()

\(\mathbb{V}\) \(\to \mathbb{S}\)

Fixed-Point Vector Ops

Function

EW

Signature

vect_q30_power_series()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

vect_q30_exp_small()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

chunk_q30_power_series()

x

\((\mathbb{V \times V})\) \(\to \mathbb{V}\)

chunk_q30_exp_small()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

Floating-Point Vector Ops

Function

EW

Signature

vect_f32_max_exponent()

\(\mathbb{V}\) \(\to \mathbb{S}\)

vect_f32_dot()

\((\mathbb{V \times V})\) \(\to \mathbb{S}\)

vect_f32_add()

x

\(\mathbb{V \times V}\) \(\to \mathbb{V}\)

vect_float_s32_log_base()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_float_s32_log()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_float_s32_log2()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_float_s32_log10()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

chunk_float_s32_log()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_complex_f32_add()

x

\(\mathbb{V \times V}\) \(\to \mathbb{V}\)

vect_complex_f32_mul()

x

\(\mathbb{V \times V}\) \(\to \mathbb{V}\)

vect_complex_f32_conj_mul()

x

\(\mathbb{V \times V}\) \(\to \mathbb{V}\)

vect_complex_f32_macc()

x

\(\mathbb{V \times V \times V}\) \(\to \mathbb{V}\)

vect_complex_f32_conj_macc()

x

\(\mathbb{V \times V \times V}\) \(\to \mathbb{V}\)

Note that several of the functions below take vectors of the split_acc_s32_t type. This is a 32-bit vector type used for accumulating results of 8- or 16-bit operations in a manner optimized for the XS3 VPU.

Other Vector Ops

Function

EW

Signature

vect_split_acc_s32_shr()

x

\((\mathbb{V \times S})\) \(\to \mathbb{V}\)

vect_s32_merge_accs()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

vect_s32_split_accs()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

chunk_s16_accumulate()

x

\(\mathbb{V}\) \(\to \mathbb{V}\)

mat_mul_s8_x_s8_yield_s32()

\((\mathbb{M \times V})\) \(\to \mathbb{V}\)

mat_mul_s8_x_s16_yield_s32()

\((\mathbb{M \times V})\) \(\to \mathbb{V}\)