Overview - 2024.2 English - XD160

Vitis Libraries

Document ID
XD160
Release Date
2024-11-29
Version
2024.2 English

Kronecker calculates Kronecker Matrix Product of the two matrices.

These are the templates to configure the function.

Parameters:

TT_DATA_A

describes the data type of input A to the function.

This is a typename and must be one of the following:

int16, int32, cint16, cint32, float, cfloat.

TT_DATA_B

describes the data type of input B to the function.

This is a typename and must be one of the following:

int16, int32, cint16, cint32, float, cfloat.

TP_DIM_A_ROWS describes number of rows of input Matrix A.
TP_DIM_A_COLS describes number of columns of input Matrix A.
TP_DIM_B_ROWS describes number of rows of input Matrix B.
TP_DIM_B_COLS describes number of columns of input Matrix B.
TP_NUM_FRAMES

describes number of input data frames to be processed per call to the function.

Each frame corresponds to a Kronecker matrix product.

TP_API describes whether to use streams (1) or windows (0) on output.
TP_SHIFT described the number of bits to downshift each sample prior to output.
TP_SSR describes the number of kernels to use in parallel.
TP_RND

describes the selection of rounding to be applied during the shift down stage of processing.

Although, TP_RND accepts unsigned integer values descriptive macros are recommended where:

  • rnd_floor = Truncate LSB, always round down (towards negative infinity).

  • rnd_ceil = Always round up (towards positive infinity).

  • rnd_sym_floor = Truncate LSB, always round towards 0.

  • rnd_sym_ceil = Always round up towards infinity.

  • rnd_pos_inf = Round halfway towards positive infinity.

  • rnd_neg_inf = Round halfway towards negative infinity.

  • rnd_sym_inf = Round halfway towards infinity (away from zero).

  • rnd_sym_zero = Round halfway towards zero (away from infinity).

  • rnd_conv_even = Round halfway towards nearest even number.

  • rnd_conv_odd = Round halfway towards nearest odd number.

    No rounding is performed on ceil or floor mode variants.

    Other modes round to the nearest integer. They differ only in how they round for values of 0.5.

    Note: Rounding modes rnd_sym_floor and rnd_sym_ceil are only supported on AIE-ML device.

TP_SAT

describes the selection of saturation to be applied during the shift down stage of processing.

TP_SAT accepts unsigned integer values, where:

  • 0: none = No saturation is performed and the value is truncated on the MSB side.
  • 1: saturate = Default. Saturation rounds an n-bit signed value in the range [- ( 2^(n-1) ) : +2^(n-1) - 1 ].
  • 3: symmetric = Controls symmetric saturation. Symmetric saturation rounds an n-bit signed value in the range [- ( 2^(n-1) -1 ) : +2^(n-1) - 1 ].
template <
    typename TT_DATA_A,
    typename TT_DATA_B,
    unsigned int TP_DIM_A_ROWS,
    unsigned int TP_DIM_A_COLS,
    unsigned int TP_DIM_B_ROWS,
    unsigned int TP_DIM_B_COLS,
    unsigned int TP_NUM_FRAMES,
    unsigned int TP_API,
    unsigned int TP_SHIFT,
    unsigned int TP_SSR = 1,
    unsigned int TP_RND = 0,
    unsigned int TP_SAT = 1
    >
class kronecker_graph: public graph

// fields

port_array <input, TP_SSR> inA
port_array <input, TP_SSR> inB
port_array <output, TP_SSR> out
kernel m_kernels[TP_SSR]