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)
 Purnes a dense matrix.
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.
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.
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.
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)
 compresses 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)
 compresses 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 )

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]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 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]handlehandle to the hipsparselt library context queue.
[in]sparseMatDescrstructured(sparse) matrix descriptor.
[in]isSparseAspecify if the structured (sparse) matrix is in the first position (matA or matB) (HIP backend only support matA)
[in]opoperation that will be applied to the structured (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 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]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 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]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 )

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]handlehipsparselt library handle
[in]sparseMatDescrstructured(sparse) matrix descriptor.
[in]isSparseAspecify if the structured (sparse) matrix is in the first position (matA or matB) (Currently, only support matA)
[in]opoperation that will be applied to the structured (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 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]handlehipsparselt library handle
[in]matmulDescrmatrix multiplication descriptor.
[in]d_inpointer to the matrix to check.
[out]d_validvalidation results (0 correct, 1 wrong).
[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 )

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]handlehipsparselt library handle
[in]sparseMatDescrstructured(sparse) matrix descriptor.
[in]isSparseAspecify if the structured (sparse) matrix is in the first position (matA or matB) (HIP backend only support matA)
[in]opoperation that will be applied to the structured (sparse) matrix in the multiplication
[in]d_inpointer to the matrix to check.
[out]d_validvalidation results (0 correct, 1 wrong).
[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 support