SortVpu#
Fully qualified name: pvaApl::SortVpu
Defined in public/src/primitive/pvaAplSortVpu.hpp
-
template<typename DataType, int Size>
class SortVpu# Sort primitive template class.
- Template Parameters:
DataType – Data Type of the input array. Must be one of: uint16_t, int16_t, uint32_t, int32_t.
Size – Number of elements to sort. For 16-bit data type, must be one of: 1024, 2048, 4096, 8192, 16384. For 32-bit data type, must be one of: 256, 512, 1024, 2048, 4096, 8192.
Public Functions
-
inline SortVpu()#
- inline size_t Init( )#
Initialize the Sort algorithm parameters, setup agens for the Execute method.
The Sort primitive only supports ascending sort.
Taking the two buffers separately lets the caller place them in different VMEM superbanks. Use the SortContext overload when a single combined allocation is acceptable.
- Parameters:
src – Pointer to the src buffer which contains the input data. The input data should be consecutively stored in a 1D array with no pitch. Input buffer size should be at least MIN_INPUT_BUFFER_SIZE.
dst – Pointer to the dst buffer where the result is written to. The output data will be stored in a 2D array with for 16-bit data type: width = Size / 32, height = 32, pitch = Size / 32 + 1 for 32-bit data type: width = Size / 16, height = 16, pitch = Size / 16 + 1 Output buffer size should be at least MIN_OUTPUT_BUFFER_SIZE.
cfgs – Caller-owned storage for at least CFG_COUNT address-generator configurations.
scratch – Caller-owned scratch buffer of at least SCRATCH_SIZE bytes.
- Returns:
Number of configurations written, which always equals CFG_COUNT.
-
inline void Init(DataType *src, DataType *dst, SortContext *context)#
Initialize using the primitive’s combined context storage.
- Parameters:
src – Pointer to the src buffer. Same requirements as in the overload taking separate buffers.
dst – Pointer to the dst buffer. Same requirements as in the overload taking separate buffers.
context – Pointer to the SortContext that provides the configuration and scratch storage.
-
inline void Execute(AgenCFG *cfgs)#
Execute the Sort algorithm using caller-owned address-generator configurations.
- Parameters:
cfgs – The same configuration storage that was passed to Init().
-
inline void Execute(SortContext *context)#
Execute using the primitive’s combined context storage.
- Parameters:
context – The same context that was passed to Init().
Public Static Attributes
-
static constexpr size_t CFG_COUNT = {detail::SortInitCfgCount(pva_elementsof(DVTYPEX), Size / pva_elementsof(DVTYPEX))}#
Number of address-generator configurations Init() writes for this instantiation.
Can be used to allocate appropriately sized configuration buffers or verify buffer sizes with static_assert.
-
static constexpr size_t CFGS_SIZE = {CFG_COUNT * sizeof(AgenCFG)}#
Minimum required size in bytes for the address-generator configuration buffer.
-
static constexpr size_t SCRATCH_SIZE{(pva_elementsof(DVTYPEX) + 1) * (Size / pva_elementsof(DVTYPEX)) * sizeof(DataType)}#
Minimum required size in bytes for the scratch buffer.
Can be used to allocate appropriately sized scratch buffers or verify buffer sizes with static_assert.