/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hipsparselt/checkouts/latest/projects/hipsparselt/library/include/hipsparselt.h File Reference

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hipsparselt/checkouts/latest/projects/hipsparselt/library/include/hipsparselt.h File Reference#

hipSPARSELt: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hipsparselt/checkouts/latest/projects/hipsparselt/library/include/hipsparselt.h File Reference
hipsparselt.h File Reference

hipsparselt.h provides Sparse Linear Algebra Subprograms of Prune, Compressed and Matrix Multiplication, using HIP optimized for AMD GPU hardware. More...

#include <hipsparse/hipsparse.h>
#include <hipsparselt/hipsparselt-export.h>
#include <hipsparselt/hipsparselt-version.h>
#include <hip/hip_complex.h>
#include <hip/hip_runtime_api.h>
#include <hip/hip_bfloat16.h>
#include <hip/hip_fp16.h>
#include <hip/hip_fp8.h>
#include <hip/library_types.h>
Include dependency graph for hipsparselt.h:

Go to the source code of this file.

Data Structures

struct  hipsparseLtHandle_t
 Handle to the hipSPARSELt library context queue. More...
 
struct  hipsparseLtMatDescriptor_t
 Descriptor of the matrix. More...
 
struct  hipsparseLtMatmulDescriptor_t
 Descriptor of the matrix multiplication operation. More...
 
struct  hipsparseLtMatmulAlgSelection_t
 Descriptor of the matrix multiplication algorithm. More...
 
struct  hipsparseLtMatmulPlan_t
 Descriptor of the matrix multiplication execution plan. More...
 

Macros

#define _HIPSPARSELT_H_
 

Enumerations

enum  hipsparseLtSparsity_t { HIPSPARSELT_SPARSITY_50_PERCENT }
 Specify the sparsity of the structured matrix. More...
 
enum  hipsparseLtMatDescAttribute_t {
  HIPSPARSELT_MAT_NUM_BATCHES ,
  HIPSPARSELT_MAT_BATCH_STRIDE
}
 Specify the additional attributes of a matrix descriptor. More...
 
enum  hipsparseLtComputetype_t {
  HIPSPARSELT_COMPUTE_16F = 0 ,
  HIPSPARSELT_COMPUTE_32I ,
  HIPSPARSELT_COMPUTE_32F ,
  HIPSPARSELT_COMPUTE_TF32 ,
  HIPSPARSELT_COMPUTE_TF32_FAST
}
 Specify the compute precision modes of the matrix. More...
 
enum  hipsparseLtMatmulDescAttribute_t {
  HIPSPARSELT_MATMUL_ACTIVATION_RELU = 0 ,
  HIPSPARSELT_MATMUL_ACTIVATION_RELU_UPPERBOUND = 1 ,
  HIPSPARSELT_MATMUL_ACTIVATION_RELU_THRESHOLD = 2 ,
  HIPSPARSELT_MATMUL_ACTIVATION_GELU = 3 ,
  HIPSPARSELT_MATMUL_ACTIVATION_GELU_SCALING = 4 ,
  HIPSPARSELT_MATMUL_ALPHA_VECTOR_SCALING = 5 ,
  HIPSPARSELT_MATMUL_BETA_VECTOR_SCALING = 6 ,
  HIPSPARSELT_MATMUL_BIAS_STRIDE = 7 ,
  HIPSPARSELT_MATMUL_BIAS_POINTER = 8 ,
  HIPSPARSELT_MATMUL_ACTIVATION_ABS = 9 ,
  HIPSPARSELT_MATMUL_ACTIVATION_LEAKYRELU = 10 ,
  HIPSPARSELT_MATMUL_ACTIVATION_LEAKYRELU_ALPHA = 11 ,
  HIPSPARSELT_MATMUL_ACTIVATION_SIGMOID = 12 ,
  HIPSPARSELT_MATMUL_ACTIVATION_TANH = 13 ,
  HIPSPARSELT_MATMUL_ACTIVATION_TANH_ALPHA = 14 ,
  HIPSPARSELT_MATMUL_ACTIVATION_TANH_BETA = 15 ,
  HIPSPARSELT_MATMUL_BIAS_TYPE = 16 ,
  HIPSPARSELT_MATMUL_SPARSE_MAT_POINTER = 17 ,
  HIPSPARSELT_MATMUL_GATE_RESIDUAL_MAT_POINTER = 18 ,
  HIPSPARSELT_MATMUL_GATE_RESIDUAL_DESC = 19
}
 Specify the additional attributes of a matrix multiplication descriptor. More...
 
enum  hipsparseLtMatmulAlg_t { HIPSPARSELT_MATMUL_ALG_DEFAULT }
 Specify the algorithm for matrix-matrix multiplication. More...
 
enum  hipsparseLtMatmulAlgAttribute_t {
  HIPSPARSELT_MATMUL_ALG_CONFIG_ID = 0 ,
  HIPSPARSELT_MATMUL_ALG_CONFIG_MAX_ID = 1 ,
  HIPSPARSELT_MATMUL_SEARCH_ITERATIONS = 2 ,
  HIPSPARSELT_MATMUL_SPLIT_K = 3 ,
  HIPSPARSELT_MATMUL_SPLIT_K_MODE = 4 ,
  HIPSPARSELT_MATMUL_SPLIT_K_BUFFERS = 5
}
 Specify the matrix multiplication algorithm attributes. More...
 
enum  hipsparseLtPruneAlg_t {
  HIPSPARSELT_PRUNE_SPMMA_TILE = 0 ,
  HIPSPARSELT_PRUNE_SPMMA_STRIP = 1
}
 Specify the pruning algorithm to apply to the structured matrix before the compression. More...
 
enum  hipsparseLtSplitKMode_t {
  HIPSPARSELT_SPLIT_K_MODE_ONE_KERNEL = 0 ,
  HIPSPARSELT_SPLIT_K_MODE_TWO_KERNELS = 1
}
 Specify the Split-K mode value. More...
 

Functions

void hipsparseLtInitialize ()
 Initialize hipSPARSELt for the current HIP device. More...
 
hipsparseStatus_t hipsparseLtGetVersion (const hipsparseLtHandle_t *handle, int *version)
 Retrieve the version number of the hipSPARSELt library. More...
 
hipsparseStatus_t hipsparseLtGetProperty (hipLibraryPropertyType propertyType, int *value)
 Retrieve the value of the requested property. More...
 
hipsparseStatus_t hipsparseLtGetGitRevision (hipsparseLtHandle_t handle, char *rev)
 
hipsparseStatus_t hipsparseLtGetArchName (char **archName)
 
hipsparseStatus_t hipsparseLtInit (hipsparseLtHandle_t *handle)
 Create a hipSPARSELt handle. More...
 
hipsparseStatus_t hipsparseLtDestroy (const hipsparseLtHandle_t *handle)
 Destroy a hipSPARSELt handle. More...
 
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. More...
 
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. More...
 
hipsparseStatus_t hipsparseLtMatDescriptorDestroy (const hipsparseLtMatDescriptor_t *matDescr)
 Destroy a matrix descriptor. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
hipsparseStatus_t hipsparseLtMatmulAlgSelectionInit (const hipsparseLtHandle_t *handle, hipsparseLtMatmulAlgSelection_t *algSelection, const hipsparseLtMatmulDescriptor_t *matmulDescr, hipsparseLtMatmulAlg_t alg)
 Initializes the algorithm selection descriptor. More...
 
hipsparseStatus_t hipsparseLtMatmulAlgSelectionDestroy (const hipsparseLtMatmulAlgSelection_t *algSelection)
 Destroy the algorithm selection descriptor. More...
 
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. More...
 
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. More...
 
hipsparseStatus_t hipsparseLtMatmulGetWorkspace (const hipsparseLtHandle_t *handle, const hipsparseLtMatmulPlan_t *plan, size_t *workspaceSize)
 Determines the required workspace size. More...
 
hipsparseStatus_t hipsparseLtMatmulPlanInit (const hipsparseLtHandle_t *handle, hipsparseLtMatmulPlan_t *plan, const hipsparseLtMatmulDescriptor_t *matmulDescr, const hipsparseLtMatmulAlgSelection_t *algSelection)
 Initializes the matrix multiplication plan descriptor. More...
 
hipsparseStatus_t hipsparseLtMatmulPlanDestroy (const hipsparseLtMatmulPlan_t *plan)
 Destroy a matrix multiplication plan descriptor. More...
 
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. More...
 
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. More...
 
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

hipsparselt.h provides Sparse Linear Algebra Subprograms of Prune, Compressed and Matrix Multiplication, using HIP optimized for AMD GPU hardware.

Macro Definition Documentation

◆ _HIPSPARSELT_H_

#define _HIPSPARSELT_H_

Enumeration Type Documentation

◆ hipsparseLtComputetype_t

Specify the compute precision modes of the matrix.

Enumerator
HIPSPARSELT_COMPUTE_16F 

16-bit floating-point precision. CUDA backend only.

HIPSPARSELT_COMPUTE_32I 

32-bit integer precision.

HIPSPARSELT_COMPUTE_32F 

32-bit floating-point precision. HIP backend only.

HIPSPARSELT_COMPUTE_TF32 

32-bit floating point value, rounded to TF32 before the computation. CUDA backend only.

HIPSPARSELT_COMPUTE_TF32_FAST 

32-bit floating point value, truncated to TF32 before the computation. CUDA backend only.

◆ hipsparseLtMatDescAttribute_t

Specify the additional attributes of a matrix descriptor.

The hipsparseLtMatDescAttribute_t enumeration is used in the hipsparseLtMatDescSetAttribute and hipsparseLtMatDescGetAttribute functions.

Enumerator
HIPSPARSELT_MAT_NUM_BATCHES 

Number of matrices in a batch. READ/WRITE.

HIPSPARSELT_MAT_BATCH_STRIDE 

Stride between consecutive matrices in a batch expressed in terms of matrix elements. READ/WRITE.

◆ hipsparseLtMatmulAlg_t

Specify the algorithm for matrix-matrix multiplication.

The hipsparseLtMatmulAlg_t enumeration is used in the hipsparseLtMatmulAlgSelectionInit function.

Enumerator
HIPSPARSELT_MATMUL_ALG_DEFAULT 

◆ hipsparseLtMatmulAlgAttribute_t

Specify the matrix multiplication algorithm attributes.

The hipsparseLtMatmulAlgAttribute_t enumeration is used in the hipsparseLtMatmulAlgGetAttribute and hipsparseLtMatmulAlgSetAttribute functions.

Enumerator
HIPSPARSELT_MATMUL_ALG_CONFIG_ID 
HIPSPARSELT_MATMUL_ALG_CONFIG_MAX_ID 
HIPSPARSELT_MATMUL_SEARCH_ITERATIONS 
HIPSPARSELT_MATMUL_SPLIT_K 
HIPSPARSELT_MATMUL_SPLIT_K_MODE 
HIPSPARSELT_MATMUL_SPLIT_K_BUFFERS 

◆ hipsparseLtMatmulDescAttribute_t

Specify the additional attributes of a matrix multiplication descriptor.

The hipsparseLtMatmulDescAttribute_t enumeration is used in the hipsparseLtMatmulDescSetAttribute and hipsparseLtMatmulDescGetAttribute functions.

Enumerator
HIPSPARSELT_MATMUL_ACTIVATION_RELU 

ReLU activation function.

HIPSPARSELT_MATMUL_ACTIVATION_RELU_UPPERBOUND 

Upper bound of the ReLU activation function.

HIPSPARSELT_MATMUL_ACTIVATION_RELU_THRESHOLD 

Lower threshold of the ReLU activation function.

HIPSPARSELT_MATMUL_ACTIVATION_GELU 

GeLU activation function.

HIPSPARSELT_MATMUL_ACTIVATION_GELU_SCALING 

Scaling coefficient for the GeLU activation function. It implies GeLU is endable.

HIPSPARSELT_MATMUL_ALPHA_VECTOR_SCALING 

Enable/disable alpha vector (per-channel) scaling.

HIPSPARSELT_MATMUL_BETA_VECTOR_SCALING 

Enable/disable beta vector (per-channel) scaling.

HIPSPARSELT_MATMUL_BIAS_STRIDE 

Bias pointer. The Bias vector size must be equal to the number of rows of the output matrix (D).

HIPSPARSELT_MATMUL_BIAS_POINTER 

Bias stride between consecutive Bias vectors. 0 means broadcast the first bias vector.

HIPSPARSELT_MATMUL_ACTIVATION_ABS 

ABS activation function. HIP backend only.

HIPSPARSELT_MATMUL_ACTIVATION_LEAKYRELU 

LeakyReLU activation function. HIP backend only.

HIPSPARSELT_MATMUL_ACTIVATION_LEAKYRELU_ALPHA 

Alpha value of the LeakyReLU activation function. HIP backend only.

HIPSPARSELT_MATMUL_ACTIVATION_SIGMOID 

Sigmoid activation function. HIP backend only.

HIPSPARSELT_MATMUL_ACTIVATION_TANH 

Tanh activation function. HIP backend only.

HIPSPARSELT_MATMUL_ACTIVATION_TANH_ALPHA 

Alpha value of the Tanh activation function. HIP backend only.

HIPSPARSELT_MATMUL_ACTIVATION_TANH_BETA 

Beta value of the Tanh activation function. HIP backend only.

HIPSPARSELT_MATMUL_BIAS_TYPE 

Precision of Bias. HIP backend only.

  • When the input datatype is FP16, the Bias type can be FP16 or FP32. (default FP16)
  • When the input datatype is BF16, the Bias type can be BF16 or FP32. (default BF16)
  • In other cases, the Bias type is FP32.
HIPSPARSELT_MATMUL_SPARSE_MAT_POINTER 

Pointer to the pruned sparse matrix.

HIPSPARSELT_MATMUL_GATE_RESIDUAL_MAT_POINTER 

Pointer to the gate residual matrix.

HIPSPARSELT_MATMUL_GATE_RESIDUAL_DESC 

Pointer to the gate residual matrix.descriptor

◆ hipsparseLtPruneAlg_t

Specify the pruning algorithm to apply to the structured matrix before the compression.

The hipsparseLtPruneAlg_t enumeration is used in the hipsparseLtSpMMAPrune and hipsparseLtSpMMAPrune2 functions.

Enumerator
HIPSPARSELT_PRUNE_SPMMA_TILE 

Zero out eight elements in a 4x4 tile. Non-zero elements have the maximum L1-norm value in all combinations in the tile. Exactly two elements in each row and column.

HIPSPARSELT_PRUNE_SPMMA_STRIP 

Zero out two elements in a 1x4 strip. Non-zero elements have the maximum L1-norm value in all combinations in the strip.

◆ hipsparseLtSparsity_t

Specify the sparsity of the structured matrix.

The enumerator specifies the sparsity ratio of the structured matrix as sparsity = nnz / total elements. The sparsity property is used in the hipsparseLtStructuredDescriptorInit function.

Enumerator
HIPSPARSELT_SPARSITY_50_PERCENT 

50% sparsity ratio:

  • 1:2 for TF32 and float.
  • 2:4 for half, bfloat16, and int.

◆ hipsparseLtSplitKMode_t

Specify the Split-K mode value.

The hipsparseLtSplitKMode_t enumeration is used by the HIPSPARSELT_MATMUL_SPLIT_K_MODE attribute in hipsparseLtMatmulAlgAttribute_t.

Enumerator
HIPSPARSELT_SPLIT_K_MODE_ONE_KERNEL 

Use the same SP-MM kernel to do the final reduction.

HIPSPARSELT_SPLIT_K_MODE_TWO_KERNELS 

Use another kernel to do the final reduction.

Function Documentation

◆ 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.

hipsparseLtDenseDescriptorInit creates and initializes a matrix descriptor. It should be destroyed at the end using hipsparseLtMatDescriptorDestroy().

Parameters
[in]handlethe hipsparselt handle.
[out]matDescrthe pointer to the dense matrix descriptor.
[in]rowsnumber of rows.
[in]colsnumber of columns.
[in]ldleading dimension.
[in]alignmentmemory alignment in bytes (not used by the HIP backend).
[in]valueTypedata type of the matrix. Data type: hipDataType.
[in]ordermemory layout: HIPSPARSE_ORDER_COL or HIPSPARSE_ORDER_ROW.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, descr, rows, cols, or ld is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDrows, cols, ld, alignment, valueType, or order is not supported.

◆ hipsparseLtDestroy()

hipsparseStatus_t hipsparseLtDestroy ( const hipsparseLtHandle_t handle)

Destroy a hipSPARSELt handle.

hipsparseLtDestroy destroys the hipSPARSELt library context and releases all resources used by the hipSPARSELt library.

Parameters
[in]handlehipsparselt library handle
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_NOT_INITIALIZEDthe handle is invalid.

◆ hipsparseLtGetArchName()

hipsparseStatus_t hipsparseLtGetArchName ( char **  archName)

◆ hipsparseLtGetGitRevision()

hipsparseStatus_t hipsparseLtGetGitRevision ( hipsparseLtHandle_t  handle,
char *  rev 
)

◆ hipsparseLtGetProperty()

hipsparseStatus_t hipsparseLtGetProperty ( hipLibraryPropertyType  propertyType,
int *  value 
)

Retrieve the value of the requested property.

hipsparseLtGetProperty returns the value of the requested property.

Parameters
[in]propertyTypehipLibraryPropertyType property type (as defined in library_types.h).
[out]valuevalue of the requested property.
Return values
HIPSPARSE_STATUS_SUCCESS

◆ hipsparseLtGetVersion()

hipsparseStatus_t hipsparseLtGetVersion ( const hipsparseLtHandle_t handle,
int *  version 
)

Retrieve the version number of the hipSPARSELt library.

hipsparseLtGetVersion returns the version number of the hipSPARSELt library.

Parameters
[in]handlehipsparselt library handle.
[out]versionthe version number of the library.
Return values
HIPSPARSE_STATUS_SUCCESS
HIPSPARSE_STATUS_INVALID_VALUEthe handle is invalid.

◆ hipsparseLtInit()

hipsparseStatus_t hipsparseLtInit ( hipsparseLtHandle_t handle)

Create a hipSPARSELt handle.

hipsparseLtInit creates 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 using hipsparseLtDestroy_handle().

Parameters
[out]handlehipsparselt library handle.
Return values
HIPSPARSE_STATUS_SUCCESSthe initialization succeeded.
HIPSPARSE_STATUS_INVALID_VALUEthe handle is invalid.

◆ hipsparseLtInitialize()

void hipsparseLtInitialize ( )

Initialize hipSPARSELt for the current HIP device.

hipsparseLtInitialize Initialize hipSPARSELt for the current HIP device to avoid costly startup time at the first call on that device. This function is only supported by the HIP backend.

◆ 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.

hipsparseLtMatDescGetAttribute returns the matrix attribute of a matrix descriptor.

Parameters
[in]handlethe hipsparselt handle.
[in]matDescrthe matrix descriptor.
[in]matAttributeHIPSPARSELT_MAT_NUM_BATCHES or HIPSPARSELT_MAT_BATCH_STRIDE.
[in,out]datathe memory address containing the attribute value retrieved by this function.
[in]dataSizesize in bytes of the attribute value used for verification.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, descr, data, or dataSize is invalid.

◆ hipsparseLtMatDescriptorDestroy()

hipsparseStatus_t hipsparseLtMatDescriptorDestroy ( const hipsparseLtMatDescriptor_t matDescr)

Destroy a matrix descriptor.

hipsparseLtMatDescriptorDestroy destroys a matrix descriptor and releases all resources used by the descriptor.

Parameters
[in]matDescrthe matrix descriptor.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEdescr is 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.

hipsparseLtMatDescSetAttribute sets the value of the specified attribute belonging to a matrix descriptor, such as number of batches and their stride.

Parameters
[in]handlethe hipsparselt handle.
[in,out]matDescrthe matrix descriptor.
[in]matAttributeHIPSPARSELT_MAT_NUM_BATCHES or HIPSPARSELT_MAT_BATCH_STRIDE.
[in]datapointer to the value to which the specified attribute will be set.
[in]dataSizesize in bytes of the attribute value used for verification.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, matmulDescr, data, or dataSize is 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.

hipsparseLtMatmul computes the matrix multiplication of matrices A and B to produce the output matrix D, 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.
This function only supports the case where D has the same shape of C.
Parameters
[in]handlehipsparselt library handle.
[in]planmatrix multiplication plan.
[in]alphascalar \(\alpha\) (float).
[in]d_APointer to the structured matrix A.
[in]d_BPointer to the dense matrix B.
[in]betascalar \(\beta\) (float).
[in]d_CPointer to the dense matrix C.
[out]d_DPointer to the dense matrix D.
[in]workspacePointer to the workspace.
[in]streamsPointer to HIP stream array for the computation.
[in]numStreamsNumber of HIP streams in streams.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_NOT_INITIALIZEDhandle or plan is invalid.
HIPSPARSE_STATUS_INVALID_VALUEhandle, plan, alpha, d_A, d_B, beta, d_C , d_D , workspace, streams, or numStreams is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDthe problem is 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.

hipsparseLtMatmulAlgGetAttribute returns the value of the queried attribute belonging to the algorithm selection descriptor.

Parameters
[in]handlethe hipsparselt handle.
[in]algSelectionthe algorithm selection descriptor.
[in]attributeattributes are specified in hipsparseLtMatmulAlgAttribute_t.
[in,out]datathe memory address containing the attribute value retrieved by this function.
[in]dataSizesize in bytes of the attribute value used for verification.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, algSelection, attribute, data, or dataSize is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDattribute is not supported.

◆ hipsparseLtMatmulAlgSelectionDestroy()

hipsparseStatus_t hipsparseLtMatmulAlgSelectionDestroy ( const hipsparseLtMatmulAlgSelection_t algSelection)

Destroy the algorithm selection descriptor.

hipsparseLtMatmulAlgSelectionDestroy releases the resources used by an instance of the algorithm selection. This function is the last call with a specific algorithm selection instance.

Parameters
[in]algSelectionthe algorithm selection descriptor
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEalgSelection is invalid.

◆ hipsparseLtMatmulAlgSelectionInit()

hipsparseStatus_t hipsparseLtMatmulAlgSelectionInit ( const hipsparseLtHandle_t handle,
hipsparseLtMatmulAlgSelection_t algSelection,
const hipsparseLtMatmulDescriptor_t matmulDescr,
hipsparseLtMatmulAlg_t  alg 
)

Initializes the algorithm selection descriptor.

hipsparseLtMatmulAlgSelectionInit creates a algorithm selection descriptor.

Parameters
[in]handlethe hipsparselt handle.
[out]algSelectionthe pointer to the algorithm selection descriptor.
[in]matmulDescrthe matrix multiplication descriptor.
[in]algthe algorithm used to perform the matrix multiplication.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, matmulDescr, or algSelection is 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.

hipsparseLtMatmulAlgSetAttribute sets the value of the specified attribute belonging to a algorithm selection descriptor.

Parameters
[in]handlethe hipsparselt handle.
[in,out]algSelectionthe algorithm selection descriptor.
[in]attributeattributes are specified in hipsparseLtMatmulAlgAttribute_t.
[in]datapointer to the value to which the specified attribute will be set.
[in]dataSizesize in bytes of the attribute value used for verification.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, algSelection, attribute, data, or dataSize is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDattribute is 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.

hipsparseLtMatmulDescGetAttribute returns the matrix attribute of a matrix descriptor.

Parameters
[in]handlethe hipsparselt handle.
[in]matmulDescrthe matrix multiplication descriptor.
[in]matmulAttributesee hipsparseLtMatmulDescAttribute_t.
[in,out]datathe memory address containing the attribute value retrieved by this function.
[in]dataSizesize in bytes of the attribute value used for verification.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, matDescr, data, or dataSize is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDhipsparseLtMatmulDescAttribute_t is not supported.

◆ 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.

hipsparseLtMatmulDescriptorInit creates a matrix multiplication descriptor.

Parameters
[in]handlethe hipsparselt handle.
[in,out]matmulDescrthe matrix multiplication descriptor.
[in]opAhipsparse operation for Matrix A: HIPSPARSE_OPERATION_NON_TRANSPOSE or HIPSPARSE_OPERATION_TRANSPOSE.
[in]opBhipsparse operation for Matrix B: HIPSPARSE_OPERATION_NON_TRANSPOSE or HIPSPARSE_OPERATION_TRANSPOSE.
[in]matAthe matrix descriptor (one and only one of matA or matB is a structured sparsity matrix).
[in]matBthe matrix descriptor (one and only one of matA or matB is a structured sparsity matrix).
[in]matCthe matrix descriptor (dense matrix).
[in]matDthe matrix descriptor (dense matrix).
[in]computeTypesize in bytes of the attribute value used for verification.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, matmulDescr, opA, opB, matA, matB, matC, matD, or computeType is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDopA, opB, or computeType is 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.

hipsparseLtMatmulDescSetAttribute sets the value of the specified attribute belonging to a matrix descriptor, such as number of batches and their stride.

Parameters
[in]handlethe hipsparselt handle.
[in,out]matmulDescrthe matrix multiplication descriptor.
[in]matmulAttributesee hipsparseLtMatmulDescAttribute_t.
[in]datapointer to the value to which the specified attribute will be set.
[in]dataSizesize in bytes of the attribute value used for verification.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, matDescr, data, or dataSize is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDhipsparseLtMatmulDescAttribute_t is not supported.

◆ hipsparseLtMatmulGetWorkspace()

hipsparseStatus_t hipsparseLtMatmulGetWorkspace ( const hipsparseLtHandle_t handle,
const hipsparseLtMatmulPlan_t plan,
size_t *  workspaceSize 
)

Determines the required workspace size.

hipsparseLtMatmulGetWorkspace determines the required workspace size associated with the selected algorithm.

Parameters
[in]handlehipsparselt library handle.
[in]planthe matrix multiplication plan descriptor.
[out]workspaceSizeworkspace size in bytes.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, algSelection, or workspaceSize is invalid.

◆ hipsparseLtMatmulPlanDestroy()

hipsparseStatus_t hipsparseLtMatmulPlanDestroy ( const hipsparseLtMatmulPlan_t plan)

Destroy a matrix multiplication plan descriptor.

hipsparseLtMatmulPlanDestroy releases the resources used by an instance of the matrix multiplication plan. This function is the last call with a specific plan instance.

Parameters
[in]planthe matrix multiplication plan descriptor.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEplan is 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.

hipsparseLtMatmulPlanInit creates a matrix multiplication plan descriptor. It should be destroyed at the end using hipsparseLtMatmulPlanDestroy.

Parameters
[in]handlehipsparselt library handle.
[out]planthe matrix multiplication plan descriptor.
[in]matmulDescrthe matrix multiplication descriptor.
[in]algSelectionthe algorithm selection descriptor.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, plan, matmulDescr, algSelection, or workspaceSize is invalid. HIPSPARSELT_MAT_NUM_BATCHES from matrix A to D are inconsistent.

◆ 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.

hipsparseLtMatmulSearch evaluates 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.
d_C and d_D must be two different memory buffers, otherwise the output will be incorrect.
This function is NOT asynchronous with respect to streams[0] (blocking call).
The number of iterations for the evaluation can be set by using hipsparseLtMatmulAlgSetAttribute() with HIPSPARSELT_MATMUL_SEARCH_ITERATIONS.
The selected algorithm id can be retrieved by using
Parameters
[in]handlehipsparselt library handle.
[in]planmatrix multiplication plan.
[in]alphascalar \(\alpha\) (float).
[in]d_Apointer to the structured matrix A.
[in]d_Bpointer to the dense matrix B.
[in]betascalar \(\beta\) (float).
[in]d_Cpointer to the dense matrix C.
[out]d_Dpointer to the dense matrix D.
[in]workspacepointer to the worksapce.
[in]streamspointer to HIP stream array for the computation.
[in]numStreamsnumber of HIP streams in streams.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_NOT_INITIALIZEDhandle or plan is invalid.
HIPSPARSE_STATUS_INVALID_VALUEhandle, plan, alpha, d_A, d_B, beta, d_C, d_D, workspace, streams, or numStreams is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDthe problem is not supported.

◆ 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.

◆ 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.

hipsparseLtStructuredDescriptorInit creates and initializes a matrix descriptor. It should be destroyed at the end using hipsparseLtMatDescriptorDestroy().

Parameters
[in]handlethe hipsparselt handle.
[out]matDescrthe pointer to the dense matrix descriptor.
[in]rowsnumber of rows.
[in]colsnumber of columns.
[in]ldleading dimension.
[in]alignmentmemory alignment in bytes (not used by the HIP backend).
[in]valueTypedata type of the matrix. Data type: hipDataType.
[in]ordermemory layout: HIPSPARSE_ORDER_COL or HIPSPARSE_ORDER_ROW.
[in]sparsitymatrix sparsity ratio. See hipsparseLtSparsity_t.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, descr, rows, cols, or ld is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDrows, cols, ld, alignment, valueType, or order is not supported.