SetSparseIndex
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
x |
|
x |
|
x |
|
x |
Function
Sets the index matrix generated during the dense process of sparse matrices.
For details about the role of the index matrix in the dense process, see MmadWithSparse.
Prototype
1 | __aicore__ inline void SetSparseIndex(const GlobalTensor<uint8_t>& indexGlobal) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
indexGlobal |
Input |
First address of the index matrix in the global memory. The data type is GlobalTensor. If the data type of the index matrix is int2, you need to convert it to int8 and then pass it to this API. The index matrix supports only the NZ format. |
Returns
None
Restrictions
- The format of the index matrix must be NZ.
- This API is supported only in CUBE_ONLY mode and the MDL template scenario.
Example
1 2 3 4 5 6 7 | #define ASCENDC_CUBE_ONLY // Enable the CUBE_ONLY mode. REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling); mm.SetTensorA(gm_a); mm.SetTensorB(gm_b); mm.SetSparseIndex(gm_index); // Set the index matrix. mm.SetBias(gm_bias); mm.IterateAll(gm_c); |
Parent topic: Matmul Kernel APIs