Helper functions#
Functions | |
| hipsparseStatus_t | hipsparseLtSpMMAPrune (const hipsparseLtHandle_t *handle, const hipsparseLtMatmulDescriptor_t *matmulDescr, const void *d_in, void *d_out, hipsparseLtPruneAlg_t pruneAlg, hipStream_t stream) |
| Purnes a dense matrix. More... | |
| hipsparseStatus_t | hipsparseLtSpMMAPruneCheck (const hipsparseLtHandle_t *handle, const hipsparseLtMatmulDescriptor_t *matmulDescr, const void *d_in, int *d_valid, hipStream_t stream) |
| checks the correctness of the pruning structure for a given matrix. More... | |
| 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) |
| Purnes a dense matrix. More... | |
| 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) |
| checks the correctness of the pruning structure for a given matrix. More... | |
| hipsparseStatus_t | hipsparseLtSpMMACompressedSize (const hipsparseLtHandle_t *handle, const hipsparseLtMatmulPlan_t *plan, size_t *compressedSize, size_t *compressBufferSize) |
| provide the size of the compressed matrix. More... | |
| hipsparseStatus_t | hipsparseLtSpMMACompress (const hipsparseLtHandle_t *handle, const hipsparseLtMatmulPlan_t *plan, const void *d_dense, void *d_compressed, void *d_compressBuffer, hipStream_t stream) |
| compresses a dense matrix to structured matrix. More... | |
| hipsparseStatus_t | hipsparseLtSpMMACompressedSize2 (const hipsparseLtHandle_t *handle, const hipsparseLtMatDescriptor_t *sparseMatDescr, size_t *compressedSize, size_t *compressBufferSize) |
| provide the size of the compressed matrix. More... | |
| 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) |
| compresses a dense matrix to structured matrix. More... | |
Detailed Description
Required for subsequent library calls
Function Documentation
◆ 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 | ||
| ) |
compresses a dense matrix to structured matrix.
hipsparseLtSpMMACompress compresses a dense matrix d_dense. The compressed matrix is intended to be used as the first/second operand A/B in the hipsparseLtMatmul() function.
- Parameters
-
[in] handle handle to the hipsparselt library context queue. [in] plan matrix multiplication plan descriptor. [in] d_dense pointer to the dense matrix. [out] d_compressed compressed matrix and metadata. [out] d_compressBuffer temporary buffer for the compression. [in] stream HIP stream for the computation.
- Return values
-
HIPSPARSE_STATUS_SUCCESS the operation completed successfully. HIPSPARSE_STATUS_INVALID_VALUE handle,plan,d_denseord_compressedis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED the problem is not support
◆ 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 | ||
| ) |
compresses a dense matrix to structured matrix.
hipsparseLtSpMMACompress2 compresses a dense matrix d_dense. The compressed matrix is intended to be used as the first/second operand A/B in the hipsparseLtMatmul() function.
- Parameters
-
[in] handle handle to the hipsparselt library context queue. [in] sparseMatDescr structured(sparse) matrix descriptor. [in] isSparseA specify if the structured (sparse) matrix is in the first position (matA or matB) (HIP backend only support matA) [in] op operation that will be applied to the structured (sparse) matrix in the multiplication [in] d_dense pointer to the dense matrix. [out] d_compressed compressed matrix and metadata [out] d_compressBuffer temporary buffer for the compression. [in] stream HIP stream for the computation.
- Return values
-
HIPSPARSE_STATUS_SUCCESS the operation completed successfully. HIPSPARSE_STATUS_INVALID_VALUE handle,sparseMatDescr,op,d_denseord_compressedis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED the problem is not support
◆ 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.
HIPSPARSE_STATUS_INVALID_VALUE provides the size of the compressed matrix to be allocated before calling hipsparseLtSpMMACompress() or hipsparseLtSpMMACompress2().
- Parameters
-
[in] handle hipsparselt library handle [in] plan matrix multiplication plan descriptor. [out] compressedSize size in bytes of the compressed matrix. [out] compressBufferSize 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,compressedSizeorcompressBufferSizeis invalid.
◆ 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.
hipsparseLtSpMMACompressedSize2 provides the size of the compressed matrix to be allocated before calling hipsparseLtSpMMACompress or hipsparseLtSpMMACompress2
- Parameters
-
[in] handle hipsparselt library handle [in] sparseMatDescr structured(sparse) matrix descriptor. [out] compressedSize size in bytes of the compressed matrix. [out] compressBufferSize 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,compressedSizeorcompressBufferSizeis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED the problem is not support
◆ 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 | ||
| ) |
Purnes a dense matrix.
hipsparseLtSpMMAPrune prunes a dense matrix d_in according to the specified algorithm pruneAlg, HIPSPARSELT_PRUNE_SPMMA_TILE or HIPSPARSELT_PRUNE_SPMMA_STRIP.
- Note
- The function requires no extra storage.
- This function supports asynchronous execution with respect to stream.
- Parameters
-
[in] handle hipsparselt library handle [in] matmulDescr matrix multiplication descriptor. [in] d_in pointer to the dense matrix. [out] d_out pointer to the pruned matrix. [in] pruneAlg pruning algorithm. [in] stream HIP stream for the computation.
- Return values
-
HIPSPARSE_STATUS_SUCCESS the operation completed successfully. HIPSPARSE_STATUS_INVALID_VALUE handle,matmulDescr,d_inord_outis 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 | ||
| ) |
Purnes a dense matrix.
hipsparseLtSpMMAPrune2 prunes a dense matrix d_in according to the specified algorithm pruneAlg, HIPSPARSELT_PRUNE_SPMMA_TILE or HIPSPARSELT_PRUNE_SPMMA_STRIP.
- Note
- The function requires no extra storage.
- This function supports asynchronous execution with respect to stream.
- Parameters
-
[in] handle hipsparselt library handle [in] sparseMatDescr structured(sparse) matrix descriptor. [in] isSparseA specify if the structured (sparse) matrix is in the first position (matA or matB) (Currently, only support matA) [in] op operation that will be applied to the structured (sparse) matrix in the multiplication [in] d_in pointer to the dense matrix. [out] d_out pointer to the pruned matrix. [in] pruneAlg pruning algorithm. [in] stream HIP stream for the computation.
- Return values
-
HIPSPARSE_STATUS_SUCCESS the operation completed successfully. HIPSPARSE_STATUS_INVALID_VALUE handle,sparseMatDescr,op,d_inord_outis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED the problem is not support
◆ hipsparseLtSpMMAPruneCheck()
| hipsparseStatus_t hipsparseLtSpMMAPruneCheck | ( | const hipsparseLtHandle_t * | handle, |
| const hipsparseLtMatmulDescriptor_t * | matmulDescr, | ||
| const void * | d_in, | ||
| int * | d_valid, | ||
| hipStream_t | stream | ||
| ) |
checks the correctness of the pruning structure for a given matrix.
hipsparseLtSpMMAPruneCheck checks the correctness of the pruning structure for a given matrix. Contents in the given matrix must be sparsity 2:4.
- Parameters
-
[in] handle hipsparselt library handle [in] matmulDescr matrix multiplication descriptor. [in] d_in pointer to the matrix to check. [out] d_valid validation results (0 correct, 1 wrong). [in] stream HIP stream for the computation.
- Return values
-
HIPSPARSE_STATUS_SUCCESS the operation completed successfully. HIPSPARSE_STATUS_INVALID_VALUE handle,matmulDescr,d_inord_validis invalid.
◆ 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 | ||
| ) |
checks the correctness of the pruning structure for a given matrix.
hipsparseLtSpMMAPruneCheck2 checks the correctness of the pruning structure for a given matrix. Contents in the given matrix must be sparsity 2:4.
- Parameters
-
[in] handle hipsparselt library handle [in] sparseMatDescr structured(sparse) matrix descriptor. [in] isSparseA specify if the structured (sparse) matrix is in the first position (matA or matB) (HIP backend only support matA) [in] op operation that will be applied to the structured (sparse) matrix in the multiplication [in] d_in pointer to the matrix to check. [out] d_valid validation results (0 correct, 1 wrong). [in] stream HIP stream for the computation.
- Return values
-
HIPSPARSE_STATUS_SUCCESS the operation completed successfully. HIPSPARSE_STATUS_INVALID_VALUE handle,sparseMatDescr,op,d_inord_validis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED the problem is not support