LoadDataWithSparse
Supported Products
|
Product |
Supported (√/x) |
|---|---|
|
|
√ |
|
|
√ |
|
|
x |
|
|
x |
|
|
x |
|
|
x |
Function Usage
Moves the 512-byte dense weight matrix stored in B1 to B2, and reads the 128-byte index matrix for sparseness of the dense matrix. The data type of the index matrix is int2, which needs to be combined into the int8 data type before the index matrix is passed to the API.
The index matrix is arranged in a reverse order in an int8 address. For example, the index matrix 1 2 0 1 0 2 1 0 is arranged as 1 0 2 1 0 1 2 0 in the address, where 1 0 2 1 (corresponding to the first 4 bits 1 2 0 1 of the index matrix) is an int8, and 0 1 2 0 (corresponding to the last 4 bits 0 2 1 0 of the index matrix) is an int8.
For details about the functions of the index matrix, see MmadWithSparse.
Prototype
1 2 |
template <typename T = int8_t, typename U = uint8_t, typename Std::enable_if<Std::is_same<PrimT<T>, int8_t>::value, bool>::type = true, typename Std::enable_if<Std::is_same<PrimT<U>, uint8_t>::value, bool>::type = true> __aicore__ inline void LoadDataWithSparse(const LocalTensor<T>& dst, const LocalTensor<T>& src, const LocalTensor<U>& idx, const LoadData2dParams& loadDataParam) |
Parameters
|
Parameter |
Description |
|---|---|
|
T |
Data types of dst and src. |
|
U |
Data type of idx.
The last two template parameters are used only for checking the preceding data types. |
Restrictions
- For details about the operand address alignment requirements, see General Address Alignment Restrictions.
- If repeat is set to 0, no operation is performed.
- The value of startIndex in each iteration must not be less than 0.
- The transpose function is not supported.
Returns
None
Example
For details, see MmadWithSparse.