Skip to main content
`Ctrl`+`K`

# Matrix descriptor functions

hipSPARSELt: Matrix descriptor functions
Functions
Matrix descriptor functions

## Functions

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 dense matrix.
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 structured matrix.
hipsparseStatus_t | hipsparseLtMatDescriptorDestroy (const hipsparseLtMatDescriptor_t *matDescr)
| Destroy a matrix descriptor.
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.
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.

## Detailed Description

Defines sparse and dense matrices

## 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 dense matrix.

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

Parameters

  [in] | handle | the hipsparselt handle
  [out] | matDescr | the pointer to the dense matrix descriptor
  [in] | rows | number of rows
  [in] | cols | number of columns
  [in] | ld | leading dimension
  [in] | alignment | memory alignment in bytes (not used by HIP backend)
  [in] | valueType | data type of the matrix. see hipDataType
  [in] | order | memory layout. `HIPSPARSE_ORDER_COL` or `HIPSPARSE_ORDER_ROW`.

Return values

  HIPSPARSE_STATUS_SUCCESS | the operation completed successfully.
  HIPSPARSE_STATUS_INVALID_VALUE | `handle`, `descr` , `rows` , `cols` , `ld` is invalid.
  HIPSPARSE_STATUS_NOT_SUPPORTED | `rows` , `cols` , `ld` , `alignment` , `valueType` or `order` is not supported.

## ◆ 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] | handle | the hipsparselt handle
  [in] | matDescr | the matrix descriptor
  [in] | matAttribute | HIPSPARSELT_MAT_NUM_BATCHES, HIPSPARSELT_MAT_BATCH_STRIDE.
  [in,out] | data | the memory address containing the attribute value retrieved by this function
  [in] | dataSize | size in bytes of the attribute value used for verification.

Return values

  HIPSPARSE_STATUS_SUCCESS | the operation completed successfully.
  HIPSPARSE_STATUS_INVALID_VALUE | `handle` , `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] | matDescr | the matrix descriptor

Return values

  HIPSPARSE_STATUS_SUCCESS | the operation completed successfully.
  HIPSPARSE_STATUS_INVALID_VALUE | `descr` 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 matrix descr such as number of batches and their stride.

Parameters

  [in] | handle | the hipsparselt handle
  [in,out] | matDescr | the matrix descriptor
  [in] | matAttribute | HIPSPARSELT_MAT_NUM_BATCHES, HIPSPARSELT_MAT_BATCH_STRIDE.
  [in] | data | pointer to the value to which the specified attribute will be set.
  [in] | dataSize | size in bytes of the attribute value used for verification.

Return values

  HIPSPARSE_STATUS_SUCCESS | the operation completed successfully.
  HIPSPARSE_STATUS_INVALID_VALUE | `handle` , `matmulDescr` , `data` or `dataSize` is invalid.

## ◆ 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 structured matrix.

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

Parameters

  [in] | handle | the hipsparselt handle
  [out] | matDescr | the pointer to the dense matrix descriptor
  [in] | rows | number of rows
  [in] | cols | number of columns
  [in] | ld | leading dimension
  [in] | alignment | memory alignment in bytes (not used by HIP backend)
  [in] | valueType | data type of the matrix. see hipDataType
  [in] | order | memory layout. `HIPSPARSE_ORDER_COL` or `HIPSPARSE_ORDER_ROW`.
  [in] | sparsity | matrix sparsity ratio. see hipsparseLtSparsity_t

Return values

  HIPSPARSE_STATUS_SUCCESS | the operation completed successfully.
  HIPSPARSE_STATUS_INVALID_VALUE | `handle`, `descr` , `rows` , `cols` , `ld` is invalid.
  HIPSPARSE_STATUS_NOT_SUPPORTED | `rows` , `cols` , `ld` , `alignment` , `valueType` or `order` is not supported.