hipSPARSELt API reference#
hipsparseLtGetVersion()#
-
hipsparseStatus_t hipsparseLtGetVersion(const hipsparseLtHandle_t *handle, int *version)#
Retrieve the version number of the hipSPARSELt library.
hipsparseLtGetVersionreturns the version number of the hipSPARSELt library.- Parameters:
handle – [in] hipsparselt library handle.
version – [out] the version number of the library.
- Return values:
HIPSPARSE_STATUS_SUCCESS –
HIPSPARSE_STATUS_INVALID_VALUE – the
handleis invalid.
hipsparseLtGetProperty()#
-
hipsparseStatus_t hipsparseLtGetProperty(hipLibraryPropertyType propertyType, int *value)#
Retrieve the value of the requested property.
hipsparseLtGetPropertyreturns the value of the requested property.- Parameters:
propertyType – [in] hipLibraryPropertyType property type (as defined in library_types.h).
value – [out] value of the requested property.
- Return values:
HIPSPARSE_STATUS_SUCCESS –
hipsparseLtInit()#
-
hipsparseStatus_t hipsparseLtInit(hipsparseLtHandle_t *handle)#
Create a hipSPARSELt handle.
hipsparseLtInitcreates the hipSPARSELt library context. It must be initialized before any other hipSPARSELt API function is invoked and must be passed to all subsequent library function calls. The handle should be destroyed at the end usinghipsparseLtDestroy_handle().- Parameters:
handle – [out] hipsparselt library handle.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the initialization succeeded.
HIPSPARSE_STATUS_INVALID_VALUE – the
handleis invalid.
hipsparseLtDestroy()#
-
hipsparseStatus_t hipsparseLtDestroy(const hipsparseLtHandle_t *handle)#
Destroy a hipSPARSELt handle.
hipsparseLtDestroydestroys the hipSPARSELt library context and releases all resources used by the hipSPARSELt library.- Parameters:
handle – [in] hipsparselt library handle
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_NOT_INITIALIZED – the
handleis invalid.
hipsparseLtDenseDescriptorInit()#
-
hipsparseStatus_t hipsparseLtDenseDescriptorInit(const hipsparseLtHandle_t *handle, hipsparseLtMatDescriptor_t *matDescr, int64_t rows, int64_t cols, int64_t ld, uint32_t alignment, hipDataType valueType, hipsparseOrder_t order)#
Create a descriptor for a dense matrix.
hipsparseLtDenseDescriptorInitcreates and initializes a matrix descriptor. It should be destroyed at the end using hipsparseLtMatDescriptorDestroy().- Parameters:
handle – [in] the hipsparselt handle.
matDescr – [out] the pointer to the dense matrix descriptor.
rows – [in] number of rows.
cols – [in] number of columns.
ld – [in] leading dimension.
alignment – [in] memory alignment in bytes (not used by the HIP backend).
valueType – [in] data type of the matrix. See hipDataType.
order – [in] memory layout:
HIPSPARSE_ORDER_COLorHIPSPARSE_ORDER_ROW.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,descr,rows,cols, orldis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED –
rows,cols,ld,alignment,valueType, ororderis not supported.
hipsparseLtStructuredDescriptorInit()#
-
hipsparseStatus_t hipsparseLtStructuredDescriptorInit(const hipsparseLtHandle_t *handle, hipsparseLtMatDescriptor_t *matDescr, int64_t rows, int64_t cols, int64_t ld, uint32_t alignment, hipDataType valueType, hipsparseOrder_t order, hipsparseLtSparsity_t sparsity)#
Create a descriptor for a structured matrix.
hipsparseLtStructuredDescriptorInitcreates and initializes a matrix descriptor. It should be destroyed at the end using hipsparseLtMatDescriptorDestroy().- Parameters:
handle – [in] the hipsparselt handle.
matDescr – [out] the pointer to the dense matrix descriptor.
rows – [in] number of rows.
cols – [in] number of columns.
ld – [in] leading dimension.
alignment – [in] memory alignment in bytes (not used by the HIP backend).
valueType – [in] data type of the matrix. See hipDataType.
order – [in] memory layout:
HIPSPARSE_ORDER_COLorHIPSPARSE_ORDER_ROW.sparsity – [in] matrix sparsity ratio. See hipsparseLtSparsity_t.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,descr,rows,cols, orldis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED –
rows,cols,ld,alignment,valueType, ororderis not supported.
hipsparseLtMatDescriptorDestroy()#
-
hipsparseStatus_t hipsparseLtMatDescriptorDestroy(const hipsparseLtMatDescriptor_t *matDescr)#
Destroy a matrix descriptor.
hipsparseLtMatDescriptorDestroydestroys a matrix descriptor and releases all resources used by the descriptor.- Parameters:
matDescr – [in] the matrix descriptor.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
descris invalid.
hipsparseLtMatDescSetAttribute()#
-
hipsparseStatus_t hipsparseLtMatDescSetAttribute(const hipsparseLtHandle_t *handle, hipsparseLtMatDescriptor_t *matDescr, hipsparseLtMatDescAttribute_t matAttribute, const void *data, size_t dataSize)#
Specify the matrix attribute of a matrix descriptor.
hipsparseLtMatDescSetAttributesets the value of the specified attribute belonging to a matrix descriptor, such as number of batches and their stride.- Parameters:
handle – [in] the hipsparselt handle.
matDescr – [inout] the matrix descriptor.
matAttribute – [in] HIPSPARSELT_MAT_NUM_BATCHES or HIPSPARSELT_MAT_BATCH_STRIDE.
data – [in] pointer to the value to which the specified attribute will be set.
dataSize – [in] size in bytes of the attribute value used for verification.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,matmulDescr,data, ordataSizeis invalid.
hipsparseLtMatDescGetAttribute()#
-
hipsparseStatus_t hipsparseLtMatDescGetAttribute(const hipsparseLtHandle_t *handle, const hipsparseLtMatDescriptor_t *matDescr, hipsparseLtMatDescAttribute_t matAttribute, void *data, size_t dataSize)#
Get the matrix type of a matrix descriptor.
hipsparseLtMatDescGetAttributereturns the matrix attribute of a matrix descriptor.- Parameters:
handle – [in] the hipsparselt handle.
matDescr – [in] the matrix descriptor.
matAttribute – [in] HIPSPARSELT_MAT_NUM_BATCHES or HIPSPARSELT_MAT_BATCH_STRIDE.
data – [inout] the memory address containing the attribute value retrieved by this function.
dataSize – [in] size in bytes of the attribute value used for verification.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,descr,data, ordataSizeis invalid.
hipsparseLtMatmulDescriptorInit()#
-
hipsparseStatus_t hipsparseLtMatmulDescriptorInit(const hipsparseLtHandle_t *handle, hipsparseLtMatmulDescriptor_t *matmulDescr, hipsparseOperation_t opA, hipsparseOperation_t opB, const hipsparseLtMatDescriptor_t *matA, const hipsparseLtMatDescriptor_t *matB, const hipsparseLtMatDescriptor_t *matC, const hipsparseLtMatDescriptor_t *matD, hipsparseLtComputetype_t computeType)#
Initializes the matrix multiplication descriptor.
hipsparseLtMatmulDescriptorInitcreates a matrix multiplication descriptor.- Parameters:
handle – [in] the hipsparselt handle.
matmulDescr – [inout] the matrix multiplication descriptor.
opA – [in] hipsparse operation for Matrix A:
HIPSPARSE_OPERATION_NON_TRANSPOSEorHIPSPARSE_OPERATION_TRANSPOSE.opB – [in] hipsparse operation for Matrix B:
HIPSPARSE_OPERATION_NON_TRANSPOSEorHIPSPARSE_OPERATION_TRANSPOSE.matA – [in] the matrix descriptor (one and only one of matA or matB is a structured sparsity matrix).
matB – [in] the matrix descriptor (one and only one of matA or matB is a structured sparsity matrix).
matC – [in] the matrix descriptor (dense matrix).
matD – [in] the matrix descriptor (dense matrix).
computeType – [in] size in bytes of the attribute value used for verification.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,matmulDescr,opA,opB,matA,matB,matC,matD, orcomputeTypeis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED –
opA,opB, orcomputeTypeis invalid.
hipsparseLtMatmulDescSetAttribute()#
-
hipsparseStatus_t hipsparseLtMatmulDescSetAttribute(const hipsparseLtHandle_t *handle, hipsparseLtMatmulDescriptor_t *matmulDescr, hipsparseLtMatmulDescAttribute_t matmulAttribute, const void *data, size_t dataSize)#
Specify the matrix attribute of a matrix descriptor.
hipsparseLtMatmulDescSetAttributesets the value of the specified attribute belonging to a matrix descriptor, such as number of batches and their stride.- Parameters:
handle – [in] the hipsparselt handle.
matmulDescr – [inout] the matrix multiplication descriptor.
matmulAttribute – [in] see hipsparseLtMatmulDescAttribute_t.
data – [in] pointer to the value to which the specified attribute will be set.
dataSize – [in] size in bytes of the attribute value used for verification.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,matDescr,data, ordataSizeis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED –
hipsparseLtMatmulDescAttribute_tis not supported.
hipsparseLtMatmulDescGetAttribute()#
-
hipsparseStatus_t hipsparseLtMatmulDescGetAttribute(const hipsparseLtHandle_t *handle, const hipsparseLtMatmulDescriptor_t *matmulDescr, hipsparseLtMatmulDescAttribute_t matmulAttribute, void *data, size_t dataSize)#
Get the matrix type of a matrix descriptor.
hipsparseLtMatmulDescGetAttributereturns the matrix attribute of a matrix descriptor.- Parameters:
handle – [in] the hipsparselt handle.
matmulDescr – [in] the matrix multiplication descriptor.
matmulAttribute – [in] see hipsparseLtMatmulDescAttribute_t.
data – [inout] the memory address containing the attribute value retrieved by this function.
dataSize – [in] size in bytes of the attribute value used for verification.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,matDescr,data, ordataSizeis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED –
hipsparseLtMatmulDescAttribute_tis not supported.
hipsparseLtMatmulAlgSelectionInit()#
-
hipsparseStatus_t hipsparseLtMatmulAlgSelectionInit(const hipsparseLtHandle_t *handle, hipsparseLtMatmulAlgSelection_t *algSelection, const hipsparseLtMatmulDescriptor_t *matmulDescr, hipsparseLtMatmulAlg_t alg)#
Initializes the algorithm selection descriptor.
hipsparseLtMatmulAlgSelectionInitcreates a algorithm selection descriptor.- Parameters:
handle – [in] the hipsparselt handle.
algSelection – [out] the pointer to the algorithm selection descriptor.
matmulDescr – [in] the matrix multiplication descriptor.
alg – [in] the algorithm used to perform the matrix multiplication.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,matmulDescr, oralgSelectionis invalid.
hipsparseLtMatmulAlgSelectionDestroy()#
-
hipsparseStatus_t hipsparseLtMatmulAlgSelectionDestroy(const hipsparseLtMatmulAlgSelection_t *algSelection)#
Destroy the algorithm selection descriptor.
hipsparseLtMatmulAlgSelectionDestroyreleases the resources used by an instance of the algorithm selection. This function is the last call with a specific algorithm selection instance.- Parameters:
algSelection – [in] the algorithm selection descriptor
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
algSelectionis invalid.
hipsparseLtMatmulAlgSetAttribute()#
-
hipsparseStatus_t hipsparseLtMatmulAlgSetAttribute(const hipsparseLtHandle_t *handle, hipsparseLtMatmulAlgSelection_t *algSelection, hipsparseLtMatmulAlgAttribute_t attribute, const void *data, size_t dataSize)#
Specify the algorithm attribute of a algorithm selection descriptor.
hipsparseLtMatmulAlgSetAttributesets the value of the specified attribute belonging to a algorithm selection descriptor.- Parameters:
handle – [in] the hipsparselt handle.
algSelection – [inout] the algorithm selection descriptor.
attribute – [in] attributes are specified in hipsparseLtMatmulAlgAttribute_t.
data – [in] pointer to the value to which the specified attribute will be set.
dataSize – [in] size in bytes of the attribute value used for verification.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,algSelection,attribute,data, ordataSizeis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED –
attributeis not supported.
hipsparseLtMatmulAlgGetAttribute()#
-
hipsparseStatus_t hipsparseLtMatmulAlgGetAttribute(const hipsparseLtHandle_t *handle, const hipsparseLtMatmulAlgSelection_t *algSelection, hipsparseLtMatmulAlgAttribute_t attribute, void *data, size_t dataSize)#
Get the specific algorithm attribute from the algorithm selection descriptor.
hipsparseLtMatmulAlgGetAttributereturns the value of the queried attribute belonging to the algorithm selection descriptor.- Parameters:
handle – [in] the hipsparselt handle.
algSelection – [in] the algorithm selection descriptor.
attribute – [in] attributes are specified in hipsparseLtMatmulAlgAttribute_t.
data – [inout] the memory address containing the attribute value retrieved by this function.
dataSize – [in] size in bytes of the attribute value used for verification.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,algSelection,attribute,data, ordataSizeis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED –
attributeis not supported.
hipsparseLtMatmulGetWorkspace()#
-
hipsparseStatus_t hipsparseLtMatmulGetWorkspace(const hipsparseLtHandle_t *handle, const hipsparseLtMatmulPlan_t *plan, size_t *workspaceSize)#
Determines the required workspace size.
hipsparseLtMatmulGetWorkspacedetermines the required workspace size associated with the selected algorithm.- Parameters:
handle – [in] hipsparselt library handle.
plan – [in] the matrix multiplication plan descriptor.
workspaceSize – [out] workspace size in bytes.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,algSelection, orworkspaceSizeis invalid.
hipsparseLtMatmulPlanInit()#
-
hipsparseStatus_t hipsparseLtMatmulPlanInit(const hipsparseLtHandle_t *handle, hipsparseLtMatmulPlan_t *plan, const hipsparseLtMatmulDescriptor_t *matmulDescr, const hipsparseLtMatmulAlgSelection_t *algSelection)#
Initializes the matrix multiplication plan descriptor.
hipsparseLtMatmulPlanInitcreates a matrix multiplication plan descriptor. It should be destroyed at the end using hipsparseLtMatmulPlanDestroy.- Parameters:
handle – [in] hipsparselt library handle.
plan – [out] the matrix multiplication plan descriptor.
matmulDescr – [in] the matrix multiplication descriptor.
algSelection – [in] the algorithm selection descriptor.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,plan,matmulDescr,algSelection, orworkspaceSizeis invalid. HIPSPARSELT_MAT_NUM_BATCHES from matrix A to D are inconsistent.
hipsparseLtMatmulPlanDestroy()#
-
hipsparseStatus_t hipsparseLtMatmulPlanDestroy(const hipsparseLtMatmulPlan_t *plan)#
Destroy a matrix multiplication plan descriptor.
hipsparseLtMatmulPlanDestroyreleases the resources used by an instance of the matrix multiplication plan. This function is the last call with a specific plan instance.- Parameters:
plan – [in] the matrix multiplication plan descriptor.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
planis invalid.
hipsparseLtMatmul()#
-
hipsparseStatus_t hipsparseLtMatmul(const hipsparseLtHandle_t *handle, const hipsparseLtMatmulPlan_t *plan, const void *alpha, const void *d_A, const void *d_B, const void *beta, const void *d_C, void *d_D, void *workspace, hipStream_t *streams, int32_t numStreams)#
Sparse matrix and dense matrix multiplication.
hipsparseLtMatmulcomputes the matrix multiplication of matricesAandBto produce the output matrixD, according to the following operation:\[ D := Activation(\alpha \cdot op(A) \cdot op(B) + \beta \cdot C + bias) * scale \]Note
This function is non-blocking and executed asynchronously with respect to the host. It can return before the actual computation has finished.
Note
This function only supports the case where
Dhas the same shape ofC.- Parameters:
handle – [in] hipsparselt library handle.
plan – [in] matrix multiplication plan.
alpha – [in] scalar \(\alpha\) (float).
d_A – [in] Pointer to the structured matrix A.
d_B – [in] Pointer to the dense matrix B.
beta – [in] scalar \(\beta\) (float).
d_C – [in] Pointer to the dense matrix C.
d_D – [out] Pointer to the dense matrix D.
workspace – [in] Pointer to the workspace.
streams – [in] Pointer to HIP stream array for the computation.
numStreams – [in] Number of HIP streams in
streams.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_NOT_INITIALIZED –
handleorplanis invalid.HIPSPARSE_STATUS_INVALID_VALUE –
handle,plan,alpha,d_A,d_B,beta,d_C,d_D,workspace,streams, ornumStreamsis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED – the problem is not supported.
hipsparseLtMatmulSearch()#
-
hipsparseStatus_t hipsparseLtMatmulSearch(const hipsparseLtHandle_t *handle, hipsparseLtMatmulPlan_t *plan, const void *alpha, const void *d_A, const void *d_B, const void *beta, const void *d_C, void *d_D, void *workspace, hipStream_t *streams, int32_t numStreams)#
Sparse matrix and dense matrix multiplication.
hipsparseLtMatmulSearchevaluates all available algorithms for the matrix multiplication and automatically updates the plan by selecting the fastest one. The functionality is intended to be used for auto-tuning purposes when the same operation is repeated multiple times over different inputs.Note
The behavior of this function is the same as hipsparseLtMatmul.
Note
d_Candd_Dmust be two different memory buffers, otherwise the output will be incorrect.Note
This function is NOT asynchronous with respect to
streams[0](blocking call).Note
The number of iterations for the evaluation can be set by using
hipsparseLtMatmulAlgSetAttribute()withHIPSPARSELT_MATMUL_SEARCH_ITERATIONS.Note
The selected algorithm id can be retrieved by using
- Parameters:
handle – [in] hipsparselt library handle.
plan – [in] matrix multiplication plan.
alpha – [in] scalar \(\alpha\) (float).
d_A – [in] pointer to the structured matrix A.
d_B – [in] pointer to the dense matrix B.
beta – [in] scalar \(\beta\) (float).
d_C – [in] pointer to the dense matrix C.
d_D – [out] pointer to the dense matrix D.
workspace – [in] pointer to the worksapce.
streams – [in] pointer to HIP stream array for the computation.
numStreams – [in] number of HIP streams in
streams.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_NOT_INITIALIZED –
handleorplanis invalid.HIPSPARSE_STATUS_INVALID_VALUE –
handle,plan,alpha,d_A,d_B,beta,d_C,d_D,workspace,streams, ornumStreamsis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED – the problem is not supported.
hipsparseLtSpMMAPrune()#
-
hipsparseStatus_t hipsparseLtSpMMAPrune(const hipsparseLtHandle_t *handle, const hipsparseLtMatmulDescriptor_t *matmulDescr, const void *d_in, void *d_out, hipsparseLtPruneAlg_t pruneAlg, hipStream_t stream)#
Prune a dense matrix.
hipsparseLtSpMMAPruneprunes the dense matrixd_inaccording to the specified algorithmpruneAlg, which can beHIPSPARSELT_PRUNE_SPMMA_TILEorHIPSPARSELT_PRUNE_SPMMA_STRIP.Note
The function requires no extra storage. It supports asynchronous execution with respect to
stream.- Parameters:
handle – [in] hipsparselt library handle.
matmulDescr – [in] matrix multiplication descriptor.
d_in – [in] pointer to the dense matrix.
d_out – [out] pointer to the pruned matrix.
pruneAlg – [in] pruning algorithm.
stream – [in] HIP stream for the computation.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,matmulDescr,d_in, ord_outis invalid.
hipsparseLtSpMMAPruneCheck()#
-
hipsparseStatus_t hipsparseLtSpMMAPruneCheck(const hipsparseLtHandle_t *handle, const hipsparseLtMatmulDescriptor_t *matmulDescr, const void *d_in, int *d_valid, hipStream_t stream)#
Check the correctness of the pruning structure for a given matrix.
hipsparseLtSpMMAPruneCheckchecks the correctness of the pruning structure for a given matrix. Contents in the provided matrix must have a sparsity of 2:4.- Parameters:
handle – [in] hipsparselt library handle.
matmulDescr – [in] matrix multiplication descriptor.
d_in – [in] pointer to the matrix to check.
d_valid – [out] validation results (0 is correct, and 1 is incorrect).
stream – [in] HIP stream for the computation.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,matmulDescr,d_in, ord_validis invalid.
hipsparseLtSpMMAPrune2()#
-
hipsparseStatus_t hipsparseLtSpMMAPrune2(const hipsparseLtHandle_t *handle, const hipsparseLtMatDescriptor_t *sparseMatDescr, int isSparseA, hipsparseOperation_t op, const void *d_in, void *d_out, hipsparseLtPruneAlg_t pruneAlg, hipStream_t stream)#
Prune a dense matrix.
hipsparseLtSpMMAPrune2prunes the dense matrixd_inaccording to the specified algorithmpruneAlg, which can beHIPSPARSELT_PRUNE_SPMMA_TILEorHIPSPARSELT_PRUNE_SPMMA_STRIP.Note
The function requires no extra storage. It supports asynchronous execution with respect to
stream.- Parameters:
handle – [in] hipsparselt library handle.
sparseMatDescr – [in] structured (sparse) matrix descriptor.
isSparseA – [in] specify if the structured (or sparse) matrix is in the first position (matA or matB). (It currently only supports matA.)
op – [in] operation that will be applied to the structured (or sparse) matrix in the multiplication.
d_in – [in] pointer to the dense matrix.
d_out – [out] pointer to the pruned matrix.
pruneAlg – [in] pruning algorithm.
stream – [in] HIP stream for the computation.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,sparseMatDescr,op,d_in, ord_outis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED – the problem is not supported.
hipsparseLtSpMMAPruneCheck2()#
-
hipsparseStatus_t hipsparseLtSpMMAPruneCheck2(const hipsparseLtHandle_t *handle, const hipsparseLtMatDescriptor_t *sparseMatDescr, int isSparseA, hipsparseOperation_t op, const void *d_in, int *d_valid, hipStream_t stream)#
Check the correctness of the pruning structure for a given matrix.
hipsparseLtSpMMAPruneCheck2checks the correctness of the pruning structure for a given matrix. Contents in the provided matrix must have a sparsity of 2:4.- Parameters:
handle – [in] hipsparselt library handle.
sparseMatDescr – [in] structured (sparse) matrix descriptor.
isSparseA – [in] specify if the structured (or sparse) matrix is in the first position (matA or matB). (The HIP backend only supports matA.)
op – [in] operation that will be applied to the structured (or sparse) matrix in the multiplication.
d_in – [in] pointer to the matrix to check.
d_valid – [out] validation results (0 is correct, and 1 is incorrect).
stream – [in] HIP stream for the computation.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,sparseMatDescr,op,d_in, ord_validis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED – the problem is not supported.
hipsparseLtSpMMACompressedSize()#
-
hipsparseStatus_t hipsparseLtSpMMACompressedSize(const hipsparseLtHandle_t *handle, const hipsparseLtMatmulPlan_t *plan, size_t *compressedSize, size_t *compressBufferSize)#
Provide the size of the compressed matrix.
hipsparseLtSpMMACompressedSizeprovides the size of the compressed matrix to be allocated before calling hipsparseLtSpMMACompress() or hipsparseLtSpMMACompress2().- Parameters:
handle – [in] hipsparselt library handle.
plan – [in] matrix multiplication plan descriptor.
compressedSize – [out] size in bytes of the compressed matrix.
compressBufferSize – [out] size in bytes for the buffer needed for the matrix compression.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,plan,compressedSize, orcompressBufferSizeis invalid.
hipsparseLtSpMMACompress()#
-
hipsparseStatus_t hipsparseLtSpMMACompress(const hipsparseLtHandle_t *handle, const hipsparseLtMatmulPlan_t *plan, const void *d_dense, void *d_compressed, void *d_compressBuffer, hipStream_t stream)#
Compress a dense matrix to structured matrix.
hipsparseLtSpMMACompresscompresses the dense matrixd_dense. The compressed matrix is intended to be used as the first/second operand A/B in the hipsparseLtMatmul() function.- Parameters:
handle – [in] handle to the hipsparselt library context queue.
plan – [in] matrix multiplication plan descriptor.
d_dense – [in] pointer to the dense matrix.
d_compressed – [out] compressed matrix and metadata.
d_compressBuffer – [out] temporary buffer for the compression.
stream – [in] HIP stream for the computation.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,plan,d_dense, ord_compressedis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED – the problem is not supported.
hipsparseLtSpMMACompressedSize2()#
-
hipsparseStatus_t hipsparseLtSpMMACompressedSize2(const hipsparseLtHandle_t *handle, const hipsparseLtMatDescriptor_t *sparseMatDescr, size_t *compressedSize, size_t *compressBufferSize)#
Provide the size of the compressed matrix.
hipsparseLtSpMMACompressedSize2provides the size of the compressed matrix to be allocated before calling hipsparseLtSpMMACompress or hipsparseLtSpMMACompress2.- Parameters:
handle – [in] hipsparselt library handle.
sparseMatDescr – [in] structured (sparse) matrix descriptor.
compressedSize – [out] size in bytes of the compressed matrix.
compressBufferSize – [out] size in bytes for the buffer needed for the matrix compression.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_NOT_INITIALIZED –
handle,sparseMatDescr,compressedSize, orcompressBufferSizeis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED – the problem is not supported.
hipsparseLtSpMMACompress2()#
-
hipsparseStatus_t hipsparseLtSpMMACompress2(const hipsparseLtHandle_t *handle, const hipsparseLtMatDescriptor_t *sparseMatDescr, int isSparseA, hipsparseOperation_t op, const void *d_dense, void *d_compressed, void *d_compressBuffer, hipStream_t stream)#
Compress a dense matrix to structured matrix.
hipsparseLtSpMMACompress2compresses the dense matrixd_dense. The compressed matrix is intended to be used as the first/second operand A/B in the hipsparseLtMatmul() function.- Parameters:
handle – [in] handle to the hipsparselt library context queue.
sparseMatDescr – [in] structured (sparse) matrix descriptor.
isSparseA – [in] specify whether the structured (or sparse) matrix is in the first position (matA or matB).
op – [in] operation that will be applied to the structured (or sparse) matrix in the multiplication.
d_dense – [in] pointer to the dense matrix.
d_compressed – [out] compressed matrix and metadata.
d_compressBuffer – [out] temporary buffer for the compression.
stream – [in] HIP stream for the computation.
- Return values:
HIPSPARSE_STATUS_SUCCESS – the operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUE –
handle,sparseMatDescr,op,d_dense, ord_compressedis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED – the problem is not supported.