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) |
| Prune 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) |
| Check 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) |
| Prune 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) |
| Check 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) |
| Compress 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) |
| Compress 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 | ||
| ) |
Compress a dense matrix to structured matrix.
hipsparseLtSpMMACompress compresses the 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_dense, ord_compressedis 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.
hipsparseLtSpMMACompress2 compresses the 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 whether the structured (or sparse) matrix is in the first position (matA or matB). [in] op operation that will be applied to the structured (or 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_dense, ord_compressedis 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.
hipsparseLtSpMMACompressedSize 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,compressedSize, orcompressBufferSizeis 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,compressedSize, orcompressBufferSizeis 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.
hipsparseLtSpMMAPrune prunes the dense matrix d_in according to the specified algorithm pruneAlg, which can be HIPSPARSELT_PRUNE_SPMMA_TILE or HIPSPARSELT_PRUNE_SPMMA_STRIP.
- Note
- The function requires no extra storage. It 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_in, ord_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 | ||
| ) |
Prune a dense matrix.
hipsparseLtSpMMAPrune2 prunes the dense matrix d_in according to the specified algorithm pruneAlg, which can be HIPSPARSELT_PRUNE_SPMMA_TILE or HIPSPARSELT_PRUNE_SPMMA_STRIP.
- Note
- The function requires no extra storage. It 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 (or sparse) matrix is in the first position (matA or matB). (It currently only supports matA.) [in] op operation that will be applied to the structured (or 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_in, ord_outis invalid.HIPSPARSE_STATUS_NOT_SUPPORTED the problem is not supported.
◆ 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.
hipsparseLtSpMMAPruneCheck checks the correctness of the pruning structure for a given matrix. Contents in the provided matrix must have a sparsity of 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 is correct, and 1 is incorrect). [in] stream 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.
◆ 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.
hipsparseLtSpMMAPruneCheck2 checks the correctness of the pruning structure for a given matrix. Contents in the provided matrix must have a sparsity of 2:4.
- Parameters
-
[in] handle hipsparselt library handle. [in] sparseMatDescr structured (sparse) matrix descriptor. [in] isSparseA specify if the structured (or sparse) matrix is in the first position (matA or matB). (The HIP backend only supports matA.) [in] op operation that will be applied to the structured (or sparse) matrix in the multiplication. [in] d_in pointer to the matrix to check. [out] d_valid validation results (0 is correct, and 1 is incorrect). [in] stream 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.