Overview - 2025.2 English

Vitis Libraries

Release Date
2025-12-17
Version
2025.2 English

cumsum is utility to apply a windowing (scaling) function such as Hamming to a frame of data samples.

These are the templates to configure the function.

Parameters:

TT_DATA

describes the type of individual data samples input to the function.

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

int16, cint16, int32, cint32, float, cfloat, bfloat16, cbfloat16. Type choice is restricted by aie variant.

TT_OUT_DATA

describes the type of individual data samples output from the function.

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

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

TP_DIM_A describes the number of samples in a vector or the first dimension in a 2D input.
TP_DIM_B describes the second dimension size. Set to 1 for vector operation.
TP_NUM_SAMPLES described the number of vectors or matrices to be operated on per call to the function (an iteration).
TP_MODE described the dimension to perform cumsum along. 0 accumulates along the first dimension. 1 accumulates along the second dimension. 2 is as for 0, but without shift and limited to the range of TT_OUT_DATA.
TP_SHIFT

described the number of bits to downshift after the scaling by the window value.

For example, for a TT_COEFF of int16 and a window value of 16384 meaning 1.000, a TP_SHIFT value of 14 is appropriate.

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 and AIE-MLv2 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,
    typename TT_OUT_DATA,
    unsigned int TP_DIM_A = 16,
    unsigned int TP_DIM_B = 1,
    unsigned int TP_NUM_FRAMES = 1,
    unsigned int TP_MODE = 0,
    unsigned int TP_SHIFT = 0,
    unsigned int TP_RND = 0,
    unsigned int TP_SAT = 1
    >
class cumsum_graph: public graph

// fields

static constexpr int TP_SSR
static constexpr int kmemAccWidth
static constexpr int kdimInGran
static constexpr int kdimInCeil
static constexpr int kKernelWindowVsize
port_array <input, TP_SSR> in
port_array <output, TP_SSR> out
kernel m_kernels[TP_SSR]