8-Bit Vector API#

group vect_s8_api


void vect_s8_is_negative(int8_t a[], const int8_t b[], const unsigned length)#

Determine whether each element of a signed 8-bit input vector are negative.

Each element \(a_k\) of 8-bit output vector \(\bar a\) is set to 1 if the corresponding element \(b_k\) of 8-bit input vector \(\bar b\) is negative, and is set to 0 otherwise.

a[] represents the 8-bit output vector \(\bar a\), with the element a[k] representing \(a_k\).

b[] represents the 8-bit input vector \(\bar b\), with the element b[k] representing \(b_k\).

length is the number of elements in a[] and b[].

Operation Performed:

\[\begin{split}\begin{flalign*} & a_k \leftarrow \begin{cases} 1 & b_k < 0 \\ 0 & otherwise\end{cases} \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}\]

  • a[out] Output vector \(\bar a\)

  • b[in] Input vector \(\bar b\)

  • length[in] Number of elements in \(\bar a\) and \(\bar b\)


Raised if a or b is not word-aligned (See Note: Vector Alignment)

void mat_mul_s8_x_s8_yield_s32(split_acc_s32_t accumulators[], const int8_t matrix[], const int8_t input_vect[], const unsigned M_rows, const unsigned N_cols)#

Multiply-accumulate an 8-bit matrix by an 8-bit vector into 32-bit accumulators.

This function multiplies an 8-bit \(M \times N\) matrix \(\bar W\) by an 8-bit \(N\)-element column vector \(\bar v\) and adds it to the 32-bit accumulator vector \(\bar a\).

accumulators is the output vector \(\bar a\) to which the product \(\bar W\times\bar v\) is accumulated. Note that the accumulators are encoded in a format native to the xcore VPU. To initialize the accumulator vector to zeros, just zero the memory.

matrix is the matrix \(\bar W\).

input_vect is the vector \(\bar v\).

matrix and input_vect must both begin at a word-aligned offsets.

M_rows and N_rows are the dimensions \(M\) and \(N\) of matrix \(\bar W\). \(M\) must be a multiple of 16, and \(N\) must be a multiple of 32.

The result of this multiplication is exact, so long as saturation does not occur.

  • accumulators[inout] The accumulator vector \(\bar a\)

  • matrix[in] The weight matrix \(\bar W\)

  • input_vect[in] The input vector \(\bar v\)

  • M_rows[in] The number of rows \(M\) in matrix \(\bar W\)

  • N_cols[in] The number of columns \(N\) in matrix \(\bar W\)


Raised if matrix or input_vect is not word-aligned (See Note: Vector Alignment)