Helper functions

Helper functions#

hipSPARSELt: Helper functions
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.
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.
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.
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.
hipsparseStatus_t hipsparseLtSpMMACompressedSize (const hipsparseLtHandle_t *handle, const hipsparseLtMatmulPlan_t *plan, size_t *compressedSize, size_t *compressBufferSize)
 Provide the size of the compressed matrix.
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.
hipsparseStatus_t hipsparseLtSpMMACompressedSize2 (const hipsparseLtHandle_t *handle, const hipsparseLtMatDescriptor_t *sparseMatDescr, size_t *compressedSize, size_t *compressBufferSize)
 Provide the size of the compressed matrix.
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.

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]handlehandle to the hipsparselt library context queue.
[in]planmatrix multiplication plan descriptor.
[in]d_densepointer to the dense matrix.
[out]d_compressedcompressed matrix and metadata.
[out]d_compressBuffertemporary buffer for the compression.
[in]streamHIP stream for the computation.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, plan, d_dense, or d_compressed is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDthe 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]handlehandle to the hipsparselt library context queue.
[in]sparseMatDescrstructured (sparse) matrix descriptor.
[in]isSparseAspecify whether the structured (or sparse) matrix is in the first position (matA or matB).
[in]opoperation that will be applied to the structured (or sparse) matrix in the multiplication.
[in]d_densepointer to the dense matrix.
[out]d_compressedcompressed matrix and metadata.
[out]d_compressBuffertemporary buffer for the compression.
[in]streamHIP stream for the computation.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, sparseMatDescr, op, d_dense, or d_compressed is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDthe 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]handlehipsparselt library handle.
[in]planmatrix multiplication plan descriptor.
[out]compressedSizesize in bytes of the compressed matrix.
[out]compressBufferSizesize in bytes for the buffer needed for the matrix compression.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, plan, compressedSize, or compressBufferSize is 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]handlehipsparselt library handle.
[in]sparseMatDescrstructured (sparse) matrix descriptor.
[out]compressedSizesize in bytes of the compressed matrix.
[out]compressBufferSizesize in bytes for the buffer needed for the matrix compression.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_NOT_INITIALIZEDhandle, sparseMatDescr, compressedSize, or compressBufferSize is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDthe 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]handlehipsparselt library handle.
[in]matmulDescrmatrix multiplication descriptor.
[in]d_inpointer to the dense matrix.
[out]d_outpointer to the pruned matrix.
[in]pruneAlgpruning algorithm.
[in]streamHIP stream for the computation.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, matmulDescr, d_in, or d_out is 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]handlehipsparselt library handle.
[in]sparseMatDescrstructured (sparse) matrix descriptor.
[in]isSparseAspecify if the structured (or sparse) matrix is in the first position (matA or matB). (It currently only supports matA.)
[in]opoperation that will be applied to the structured (or sparse) matrix in the multiplication.
[in]d_inpointer to the dense matrix.
[out]d_outpointer to the pruned matrix.
[in]pruneAlgpruning algorithm.
[in]streamHIP stream for the computation.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, sparseMatDescr, op, d_in, or d_out is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDthe 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]handlehipsparselt library handle.
[in]matmulDescrmatrix multiplication descriptor.
[in]d_inpointer to the matrix to check.
[out]d_validvalidation results (0 is correct, and 1 is incorrect).
[in]streamHIP stream for the computation.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, matmulDescr, d_in, or d_valid is 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]handlehipsparselt library handle.
[in]sparseMatDescrstructured (sparse) matrix descriptor.
[in]isSparseAspecify if the structured (or sparse) matrix is in the first position (matA or matB). (The HIP backend only supports matA.)
[in]opoperation that will be applied to the structured (or sparse) matrix in the multiplication.
[in]d_inpointer to the matrix to check.
[out]d_validvalidation results (0 is correct, and 1 is incorrect).
[in]streamHIP stream for the computation.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, sparseMatDescr, op, d_in, or d_valid is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDthe problem is not supported.