rocm.bindings.cyhipsparselt#
2026-09-24
23 min read time
Applies to Linux and Windows
Advanced Micro Devices, Inc.
Cython declarations for the C-level interface. Use
cimport rocm.bindings.cyhipsparselt from your Cython code to access
these declarations directly.
See also
The high-level Python API is documented at rocm.bindings.hipsparselt.
# MIT License
#
# Copyright (c) 2021-2026 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# This file has been autogenerated, do not modify.
from libc.stdint cimport *
ctypedef bint _Bool # bool is not a reserved keyword in C, _Bool is
from rocm.bindings.cyhip cimport *
from rocm.bindings.cyhipsparse cimport *
cdef extern from "hipsparselt/hipsparselt.h":
cdef struct hipsparseLtHandle_t:
uint8_t data[11024]
cdef struct hipsparseLtMatDescriptor_t:
uint8_t data[11024]
cdef struct hipsparseLtMatmulDescriptor_t:
uint8_t data[11024]
cdef struct hipsparseLtMatmulAlgSelection_t:
uint8_t data[11024]
cdef struct hipsparseLtMatmulPlan_t:
uint8_t data[11024]
ctypedef enum hipsparseLtSparsity_t:
HIPSPARSELT_SPARSITY_50_PERCENT
ctypedef enum hipsparseLtMatDescAttribute_t:
HIPSPARSELT_MAT_NUM_BATCHES
HIPSPARSELT_MAT_BATCH_STRIDE
ctypedef enum hipsparseLtComputetype_t:
HIPSPARSELT_COMPUTE_16F
HIPSPARSELT_COMPUTE_32I
HIPSPARSELT_COMPUTE_32F
HIPSPARSELT_COMPUTE_TF32
HIPSPARSELT_COMPUTE_TF32_FAST
ctypedef enum hipsparseLtMatmulDescAttribute_t:
HIPSPARSELT_MATMUL_ACTIVATION_RELU
HIPSPARSELT_MATMUL_ACTIVATION_RELU_UPPERBOUND
HIPSPARSELT_MATMUL_ACTIVATION_RELU_THRESHOLD
HIPSPARSELT_MATMUL_ACTIVATION_GELU
HIPSPARSELT_MATMUL_ACTIVATION_GELU_SCALING
HIPSPARSELT_MATMUL_ALPHA_VECTOR_SCALING
HIPSPARSELT_MATMUL_BETA_VECTOR_SCALING
HIPSPARSELT_MATMUL_BIAS_STRIDE
HIPSPARSELT_MATMUL_BIAS_POINTER
HIPSPARSELT_MATMUL_ACTIVATION_ABS
HIPSPARSELT_MATMUL_ACTIVATION_LEAKYRELU
HIPSPARSELT_MATMUL_ACTIVATION_LEAKYRELU_ALPHA
HIPSPARSELT_MATMUL_ACTIVATION_SIGMOID
HIPSPARSELT_MATMUL_ACTIVATION_TANH
HIPSPARSELT_MATMUL_ACTIVATION_TANH_ALPHA
HIPSPARSELT_MATMUL_ACTIVATION_TANH_BETA
HIPSPARSELT_MATMUL_BIAS_TYPE
HIPSPARSELT_MATMUL_SPARSE_MAT_POINTER
HIPSPARSELT_MATMUL_GATE_RESIDUAL_MAT_POINTER
HIPSPARSELT_MATMUL_GATE_RESIDUAL_DESC
ctypedef enum hipsparseLtMatmulAlg_t:
HIPSPARSELT_MATMUL_ALG_DEFAULT
ctypedef enum hipsparseLtMatmulAlgAttribute_t:
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
ctypedef enum hipsparseLtPruneAlg_t:
HIPSPARSELT_PRUNE_SPMMA_TILE
HIPSPARSELT_PRUNE_SPMMA_STRIP
ctypedef enum hipsparseLtSplitKMode_t:
HIPSPARSELT_SPLIT_K_MODE_ONE_KERNEL
HIPSPARSELT_SPLIT_K_MODE_TWO_KERNELS
# \ingroup aux_module
# \brief Initialize hipSPARSELt for the current HIP device.
#
# \details
# \p 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.
#
cdef void hipsparseLtInitialize() noexcept nogil
# \ingroup library_module
# \brief Retrieve the version number of the hipSPARSELt library.
#
# \details
# \p hipsparseLtGetVersion returns the version number of the hipSPARSELt library.
#
# @param[in]
# handle hipsparselt library handle.
# @param[out]
# version the version number of the library.
#
# \retval HIPSPARSE_STATUS_SUCCESS
# \retval HIPSPARSE_STATUS_INVALID_VALUE the \p handle is invalid.
cdef hipsparseStatus_t hipsparseLtGetVersion(const hipsparseLtHandle_t * handle,int * version) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Retrieve the value of the requested property.
#
# \details
# \p hipsparseLtGetProperty returns the value of the requested property.
#
# @param[in]
# propertyType hipLibraryPropertyType property type (as defined in library_types.h).
# @param[out]
# value value of the requested property.
#
# \retval HIPSPARSE_STATUS_SUCCESS
cdef hipsparseStatus_t hipsparseLtGetProperty(hipLibraryPropertyType propertyType,int * value) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseLtGetGitRevision(hipsparseLtHandle_t handle,char * rev) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseLtGetArchName(char ** archName) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Create a hipSPARSELt handle
#
# \details
# \p 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()``.
#
# @param[out]
# handle hipsparselt library handle.
#
# \retval HIPSPARSE_STATUS_SUCCESS the initialization succeeded.
# \retval HIPSPARSE_STATUS_INVALID_VALUE the \p handle is invalid.
cdef hipsparseStatus_t hipsparseLtInit(hipsparseLtHandle_t * handle) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Destroy a hipSPARSELt handle.
#
# \details
# \p hipsparseLtDestroy destroys the hipSPARSELt library context and releases all
# resources used by the hipSPARSELt library.
#
# @param[in]
# handle hipsparselt library handle
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED the \p handle is invalid.
cdef hipsparseStatus_t hipsparseLtDestroy(const hipsparseLtHandle_t * handle) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matrix_desc_module
# \brief Create a descriptor for a dense matrix
# \details
# \p hipsparseLtDenseDescriptorInit creates and initializes a matrix descriptor.
# It should be destroyed at the end using \ref hipsparseLtMatDescriptorDestroy().
#
# @param[in]
# handle the hipsparselt handle.
# @param[out]
# matDescr the pointer to the dense matrix descriptor.
# @param[in]
# rows number of rows.
# @param[in]
# cols number of columns.
# @param[in]
# ld leading dimension.
# @param[in]
# alignment memory alignment in bytes (not used by the HIP backend).
# @param[in]
# valueType data type of the matrix. Data type: hipDataType.
# @param[in]
# order memory layout: \p HIPSPARSE_ORDER_COL or \p HIPSPARSE_ORDER_ROW.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descr, \p rows, \p cols, or \p ld is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \p rows, \p cols, \p ld, \p alignment, \p valueType, or \p order is not supported.
cdef 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) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matrix_desc_module
# \brief Create a descriptor for a structured matrix.
# \details
# \p hipsparseLtStructuredDescriptorInit creates and initializes a matrix descriptor.
# It should be destroyed at the end using \ref hipsparseLtMatDescriptorDestroy().
#
# @param[in]
# handle the hipsparselt handle.
# @param[out]
# matDescr the pointer to the dense matrix descriptor.
# @param[in]
# rows number of rows.
# @param[in]
# cols number of columns.
# @param[in]
# ld leading dimension.
# @param[in]
# alignment memory alignment in bytes (not used by the HIP backend).
# @param[in]
# valueType data type of the matrix. Data type: hipDataType.
# @param[in]
# order memory layout: \p HIPSPARSE_ORDER_COL or \p HIPSPARSE_ORDER_ROW.
#
# @param[in]
# sparsity matrix sparsity ratio. See \ref hipsparseLtSparsity_t.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descr, \p rows, \p cols, or \p ld is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \p rows, \p cols, \p ld, \p alignment, \p valueType, or \p order is not supported.
cdef 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) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matrix_desc_module
# \brief Destroy a matrix descriptor.
#
# \details
# \p hipsparseLtMatDescriptorDestroy destroys a matrix descriptor and releases all
# resources used by the descriptor.
#
# @param[in]
# matDescr the matrix descriptor.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p descr is invalid.
cdef hipsparseStatus_t hipsparseLtMatDescriptorDestroy(const hipsparseLtMatDescriptor_t * matDescr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matrix_desc_module
# \brief Specify the matrix attribute of a matrix descriptor.
#
# \details
# \p hipsparseLtMatDescSetAttribute sets the value of the specified attribute belonging
# to a matrix descriptor, such as number of batches and their stride.
#
# @param[in]
# handle the hipsparselt handle.
# @param[inout]
# matDescr the matrix descriptor.
# @param[in]
# matAttribute \ref HIPSPARSELT_MAT_NUM_BATCHES or \ref HIPSPARSELT_MAT_BATCH_STRIDE.
# @param[in]
# data pointer to the value to which the specified attribute will be set.
# @param[in]
# dataSize size in bytes of the attribute value used for verification.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p matmulDescr, \p data, or \p dataSize is invalid.
cdef hipsparseStatus_t hipsparseLtMatDescSetAttribute(const hipsparseLtHandle_t * handle,hipsparseLtMatDescriptor_t * matDescr,hipsparseLtMatDescAttribute_t matAttribute,const void * data,size_t dataSize) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matrix_desc_module
# \brief Get the matrix type of a matrix descriptor.
#
# \details
# \p hipsparseLtMatDescGetAttribute returns the matrix attribute of a matrix descriptor.
#
#
# @param[in]
# handle the hipsparselt handle.
# @param[in]
# matDescr the matrix descriptor.
# @param[in]
# matAttribute \ref HIPSPARSELT_MAT_NUM_BATCHES or \ref HIPSPARSELT_MAT_BATCH_STRIDE.
# @param[inout]
# data the memory address containing the attribute value retrieved by this function.
# @param[in]
# dataSize size in bytes of the attribute value used for verification.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descr, \p data, or \p dataSize is invalid.
cdef hipsparseStatus_t hipsparseLtMatDescGetAttribute(const hipsparseLtHandle_t * handle,const hipsparseLtMatDescriptor_t * matDescr,hipsparseLtMatDescAttribute_t matAttribute,void * data,size_t dataSize) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matmul_desc_module
# \brief Initializes the matrix multiplication descriptor.
#
# \details
# \p hipsparseLtMatmulDescriptorInit creates a matrix multiplication descriptor.
#
# @param[in]
# handle the hipsparselt handle.
# @param[inout]
# matmulDescr the matrix multiplication descriptor.
# @param[in]
# opA hipsparse operation for Matrix A: \p HIPSPARSE_OPERATION_NON_TRANSPOSE or \p HIPSPARSE_OPERATION_TRANSPOSE.
# @param[in]
# opB hipsparse operation for Matrix B: \p HIPSPARSE_OPERATION_NON_TRANSPOSE or \p HIPSPARSE_OPERATION_TRANSPOSE.
# @param[in]
# matA the matrix descriptor (one and only one of matA or matB is a structured sparsity matrix).
# @param[in]
# matB the matrix descriptor (one and only one of matA or matB is a structured sparsity matrix).
# @param[in]
# matC the matrix descriptor (dense matrix).
# @param[in]
# matD the matrix descriptor (dense matrix).
# @param[in]
# computeType size in bytes of the attribute value used for verification.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p matmulDescr, \p opA, \p opB, \p matA, \p matB, \p matC, \p matD, or \p computeType is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \p opA, \p opB, or \p computeType is invalid.
cdef 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) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matmul_desc_module
# \brief Specify the matrix attribute of a matrix descriptor.
#
# \details
# \p hipsparseLtMatmulDescSetAttribute sets the value of the specified attribute belonging
# to a matrix descriptor, such as number of batches and their stride.
#
# @param[in]
# handle the hipsparselt handle.
# @param[inout]
# matmulDescr the matrix multiplication descriptor.
# @param[in]
# matmulAttribute see \ref hipsparseLtMatmulDescAttribute_t.
# @param[in]
# data pointer to the value to which the specified attribute will be set.
# @param[in]
# dataSize size in bytes of the attribute value used for verification.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p matDescr, \p data, or \p dataSize is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \p hipsparseLtMatmulDescAttribute_t is not supported.
cdef hipsparseStatus_t hipsparseLtMatmulDescSetAttribute(const hipsparseLtHandle_t * handle,hipsparseLtMatmulDescriptor_t * matmulDescr,hipsparseLtMatmulDescAttribute_t matmulAttribute,const void * data,size_t dataSize) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matmul_desc_module
# \brief Get the matrix type of a matrix descriptor.
#
# \details
# \p hipsparseLtMatmulDescGetAttribute returns the matrix attribute of a matrix descriptor.
#
#
# @param[in]
# handle the hipsparselt handle.
# @param[in]
# matmulDescr the matrix multiplication descriptor.
# @param[in]
# matmulAttribute see \ref hipsparseLtMatmulDescAttribute_t.
# @param[inout]
# data the memory address containing the attribute value retrieved by this function.
# @param[in]
# dataSize size in bytes of the attribute value used for verification.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p matDescr, \p data, or \p dataSize is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \p hipsparseLtMatmulDescAttribute_t is not supported.
cdef hipsparseStatus_t hipsparseLtMatmulDescGetAttribute(const hipsparseLtHandle_t * handle,const hipsparseLtMatmulDescriptor_t * matmulDescr,hipsparseLtMatmulDescAttribute_t matmulAttribute,void * data,size_t dataSize) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matmul_algo_module
# \brief Initializes the algorithm selection descriptor.
# \details
# \p hipsparseLtMatmulAlgSelectionInit creates a algorithm selection descriptor.
#
# @param[in]
# handle the hipsparselt handle.
# @param[out]
# algSelection the pointer to the algorithm selection descriptor.
# @param[in]
# matmulDescr the matrix multiplication descriptor.
# @param[in]
# alg the algorithm used to perform the matrix multiplication.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p matmulDescr, or \p algSelection is invalid.
cdef hipsparseStatus_t hipsparseLtMatmulAlgSelectionInit(const hipsparseLtHandle_t * handle,hipsparseLtMatmulAlgSelection_t * algSelection,const hipsparseLtMatmulDescriptor_t * matmulDescr,hipsparseLtMatmulAlg_t alg) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matmul_algo_module
# \brief Destroy the algorithm selection descriptor.
# \details
# \p hipsparseLtMatmulAlgSelectionDestroy releases the resources used by an instance
# of the algorithm selection. This function is the last call with a specific algorithm selection
# instance.
#
# @param[in]
# algSelection the algorithm selection descriptor
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p algSelection is invalid.
cdef hipsparseStatus_t hipsparseLtMatmulAlgSelectionDestroy(const hipsparseLtMatmulAlgSelection_t * algSelection) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matmul_algo_module
# \brief Specify the algorithm attribute of a algorithm selection descriptor.
#
# \details
# \p hipsparseLtMatmulAlgSetAttribute sets the value of the specified attribute
# belonging to a algorithm selection descriptor.
#
# @param[in]
# handle the hipsparselt handle.
# @param[inout]
# algSelection the algorithm selection descriptor.
# @param[in]
# attribute attributes are specified in \ref hipsparseLtMatmulAlgAttribute_t.
# @param[in]
# data pointer to the value to which the specified attribute will be set.
# @param[in]
# dataSize size in bytes of the attribute value used for verification.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p algSelection, \p attribute, \p data, or \p dataSize is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \p attribute is not supported.
cdef hipsparseStatus_t hipsparseLtMatmulAlgSetAttribute(const hipsparseLtHandle_t * handle,hipsparseLtMatmulAlgSelection_t * algSelection,hipsparseLtMatmulAlgAttribute_t attribute,const void * data,size_t dataSize) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matmul_algo_module
# \brief Get the specific algorithm attribute from the algorithm selection descriptor.
#
# \details
# \p hipsparseLtMatmulAlgGetAttribute returns the value of the queried attribute belonging
# to the algorithm selection descriptor.
#
#
# @param[in]
# handle the hipsparselt handle.
# @param[in]
# algSelection the algorithm selection descriptor.
# @param[in]
# attribute attributes are specified in \ref hipsparseLtMatmulAlgAttribute_t.
# @param[inout]
# data the memory address containing the attribute value retrieved by this function.
# @param[in]
# dataSize size in bytes of the attribute value used for verification.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p algSelection, \p attribute, \p data, or \p dataSize is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \p attribute is not supported.
cdef hipsparseStatus_t hipsparseLtMatmulAlgGetAttribute(const hipsparseLtHandle_t * handle,const hipsparseLtMatmulAlgSelection_t * algSelection,hipsparseLtMatmulAlgAttribute_t attribute,void * data,size_t dataSize) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matmul_module
# \brief Determines the required workspace size.
# \details
# \p hipsparseLtMatmulGetWorkspace determines the required workspace size
# associated with the selected algorithm.
#
# @param[in]
# handle hipsparselt library handle.
# @param[in]
# plan the matrix multiplication plan descriptor.
# @param[out]
# workspaceSize workspace size in bytes.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p algSelection, or \p workspaceSize is invalid.
cdef hipsparseStatus_t hipsparseLtMatmulGetWorkspace(const hipsparseLtHandle_t * handle,const hipsparseLtMatmulPlan_t * plan,size_t * workspaceSize) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matmul_module
# \brief Initializes the matrix multiplication plan descriptor.
# \details
# \p hipsparseLtMatmulPlanInit creates a matrix multiplication plan descriptor.
# It should be destroyed at the end using \ref hipsparseLtMatmulPlanDestroy.
#
# @param[in]
# handle hipsparselt library handle.
# @param[out]
# plan the matrix multiplication plan descriptor.
# @param[in]
# matmulDescr the matrix multiplication descriptor.
# @param[in]
# algSelection the algorithm selection descriptor.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p plan, \p matmulDescr, \p algSelection, or \p workspaceSize is invalid. \ref HIPSPARSELT_MAT_NUM_BATCHES from matrix A to D are inconsistent.
cdef hipsparseStatus_t hipsparseLtMatmulPlanInit(const hipsparseLtHandle_t * handle,hipsparseLtMatmulPlan_t * plan,const hipsparseLtMatmulDescriptor_t * matmulDescr,const hipsparseLtMatmulAlgSelection_t * algSelection) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matmul_module
# \brief Destroy a matrix multiplication plan descriptor.
# \details
# \p hipsparseLtMatmulPlanDestroy releases the resources used by an instance
# of the matrix multiplication plan. This function is the last call with a specific plan
# instance.
#
# @param[in]
# plan the matrix multiplication plan descriptor.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p plan is invalid.
cdef hipsparseStatus_t hipsparseLtMatmulPlanDestroy(const hipsparseLtMatmulPlan_t * plan) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matmul_module
# \brief Sparse matrix and dense matrix multiplication.
#
# \details
# \p hipsparseLtMatmul computes the matrix multiplication of matrices ``A`` and ``B`` to
# produce the output matrix ``D``, according to the following operation:
# \f[
# D := Activation(\alpha \cdot op(A) \cdot op(B) + \beta \cdot C + bias) * scale
# \f]
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# This function only supports the case where ``D`` has the same shape of ``C``.
#
# @param[in]
# handle hipsparselt library handle.
# @param[in]
# plan matrix multiplication plan.
# @param[in]
# alpha scalar \f$\alpha\f$ (float).
# @param[in]
# d_A Pointer to the structured matrix A.
# @param[in]
# d_B Pointer to the dense matrix B.
# @param[in]
# beta scalar \f$\beta\f$ (float).
# @param[in]
# d_C Pointer to the dense matrix C.
# @param[out]
# d_D Pointer to the dense matrix D.
# @param[in]
# workspace Pointer to the workspace.
# @param[in]
# streams Pointer to HIP stream array for the computation.
# @param[in]
# numStreams Number of HIP streams in \p streams.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle or \p plan is invalid.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p plan, \p alpha, \p d_A, \p d_B, \p beta, \p d_C , \p d_D , \p workspace, \p streams, or \p numStreams is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED the problem is not supported.
cdef 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) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup matmul_module
# \brief Sparse matrix and dense matrix multiplication
#
# \details
# \p 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 \ref hipsparseLtMatmul.
#
# \note
# ``d_C`` and ``d_D`` must be two different memory buffers, otherwise the output will be incorrect.
#
# \note
# This function is NOT asynchronous with respect to ``streams[0]`` (blocking call).
#
# \note
# The number of iterations for the evaluation can be set by using
# ``hipsparseLtMatmulAlgSetAttribute()`` with ``HIPSPARSELT_MATMUL_SEARCH_ITERATIONS``.
#
# \note
# The selected algorithm id can be retrieved by using
#
#
# @param[in]
# handle hipsparselt library handle.
# @param[in]
# plan matrix multiplication plan.
# @param[in]
# alpha scalar \f$\alpha\f$ (float).
# @param[in]
# d_A pointer to the structured matrix A.
# @param[in]
# d_B pointer to the dense matrix B.
# @param[in]
# beta scalar \f$\beta\f$ (float).
# @param[in]
# d_C pointer to the dense matrix C.
# @param[out]
# d_D pointer to the dense matrix D.
# @param[in]
# workspace pointer to the worksapce.
# @param[in]
# streams pointer to HIP stream array for the computation.
# @param[in]
# numStreams number of HIP streams in \p streams.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle or \p plan is invalid.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p plan, \p alpha, \p d_A, \p d_B, \p beta, \p d_C, \p d_D, \p workspace, \p streams, or \p numStreams is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED the problem is not supported.
cdef 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) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup helper_module
# \brief Prune a dense matrix.
#
# \details
# \p 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``.
#
# @param[in]
# handle hipsparselt library handle.
# @param[in]
# matmulDescr matrix multiplication descriptor.
# @param[in]
# d_in pointer to the dense matrix.
# @param[out]
# d_out pointer to the pruned matrix.
# @param[in]
# pruneAlg pruning algorithm.
# @param[in]
# stream HIP stream for the computation.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p matmulDescr, \p d_in, or \p d_out is invalid.
cdef hipsparseStatus_t hipsparseLtSpMMAPrune(const hipsparseLtHandle_t * handle,const hipsparseLtMatmulDescriptor_t * matmulDescr,const void * d_in,void * d_out,hipsparseLtPruneAlg_t pruneAlg,hipStream_t stream) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup helper_module
# \brief Check the correctness of the pruning structure for a given matrix.
#
# \details
# \p hipsparseLtSpMMAPruneCheck checks the correctness of the pruning structure for a given matrix.
# Contents in the provided matrix must have a sparsity of 2:4.
#
#
# @param[in]
# handle hipsparselt library handle.
# @param[in]
# matmulDescr matrix multiplication descriptor.
# @param[in]
# d_in pointer to the matrix to check.
# @param[out]
# d_valid validation results (0 is correct, and 1 is incorrect).
# @param[in]
# stream HIP stream for the computation.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p matmulDescr, \p d_in, or \p d_valid is invalid.
cdef hipsparseStatus_t hipsparseLtSpMMAPruneCheck(const hipsparseLtHandle_t * handle,const hipsparseLtMatmulDescriptor_t * matmulDescr,const void * d_in,int * d_valid,hipStream_t stream) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup helper_module
# \brief Prune a dense matrix.
#
# \details
# \p 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``.
#
# @param[in]
# handle hipsparselt library handle.
# @param[in]
# sparseMatDescr structured (sparse) matrix descriptor.
# @param[in]
# isSparseA specify if the structured (or sparse) matrix is in the first position (matA or matB). (It currently only supports matA.)
# @param[in]
# op operation that will be applied to the structured (or sparse) matrix in the multiplication.
# @param[in]
# d_in pointer to the dense matrix.
# @param[out]
# d_out pointer to the pruned matrix.
# @param[in]
# pruneAlg pruning algorithm.
# @param[in]
# stream HIP stream for the computation.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p sparseMatDescr, \p op, \p d_in, or \p d_out is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED the problem is not supported.
cdef 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) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup helper_module
# \brief Check the correctness of the pruning structure for a given matrix.
#
# \details
# \p hipsparseLtSpMMAPruneCheck2 checks the correctness of the pruning structure for a given matrix.
# Contents in the provided matrix must have a sparsity of 2:4.
#
# @param[in]
# handle hipsparselt library handle.
# @param[in]
# sparseMatDescr structured (sparse) matrix descriptor.
# @param[in]
# isSparseA specify if the structured (or sparse) matrix is in the first position (matA or matB). (The HIP backend only supports matA.)
# @param[in]
# op operation that will be applied to the structured (or sparse) matrix in the multiplication.
# @param[in]
# d_in pointer to the matrix to check.
# @param[out]
# d_valid validation results (0 is correct, and 1 is incorrect).
# @param[in]
# stream HIP stream for the computation.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p sparseMatDescr, \p op, \p d_in, or \p d_valid is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED the problem is not supported.
cdef 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) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup helper_module
# \brief Provide the size of the compressed matrix.
#
# \details
# \p hipsparseLtSpMMACompressedSize provides the size of the compressed matrix
# to be allocated before calling \ref hipsparseLtSpMMACompress() or \ref hipsparseLtSpMMACompress2().
#
# @param[in]
# handle hipsparselt library handle.
# @param[in]
# plan matrix multiplication plan descriptor.
# @param[out]
# compressedSize size in bytes of the compressed matrix.
# @param[out]
# compressBufferSize size in bytes for the buffer needed for the matrix compression.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p plan, \p compressedSize, or \p compressBufferSize is invalid.
cdef hipsparseStatus_t hipsparseLtSpMMACompressedSize(const hipsparseLtHandle_t * handle,const hipsparseLtMatmulPlan_t * plan,size_t * compressedSize,size_t * compressBufferSize) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup helper_module
# \brief Compress a dense matrix to structured matrix.
#
# \details
# \p hipsparseLtSpMMACompress compresses the dense matrix ``d_dense``.
# The compressed matrix is intended to be used as the first/second operand A/B
# in the \ref hipsparseLtMatmul() function.
#
# @param[in]
# handle handle to the hipsparselt library context queue.
# @param[in]
# plan matrix multiplication plan descriptor.
# @param[in]
# d_dense pointer to the dense matrix.
# @param[out]
# d_compressed compressed matrix and metadata.
# @param[out]
# d_compressBuffer temporary buffer for the compression.
# @param[in]
# stream HIP stream for the computation.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p plan, \p d_dense, or \p d_compressed is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED the problem is not supported.
cdef hipsparseStatus_t hipsparseLtSpMMACompress(const hipsparseLtHandle_t * handle,const hipsparseLtMatmulPlan_t * plan,const void * d_dense,void * d_compressed,void * d_compressBuffer,hipStream_t stream) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup helper_module
# \brief Provide the size of the compressed matrix.
#
# \details
# \p hipsparseLtSpMMACompressedSize2 provides the size of the compressed matrix
# to be allocated before calling \ref hipsparseLtSpMMACompress or \ref hipsparseLtSpMMACompress2.
#
# @param[in]
# handle hipsparselt library handle.
# @param[in]
# sparseMatDescr structured (sparse) matrix descriptor.
# @param[out]
# compressedSize size in bytes of the compressed matrix.
# @param[out]
# compressBufferSize size in bytes for the buffer needed for the matrix compression.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle, \p sparseMatDescr, \p compressedSize, or \p compressBufferSize is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED the problem is not supported.
cdef hipsparseStatus_t hipsparseLtSpMMACompressedSize2(const hipsparseLtHandle_t * handle,const hipsparseLtMatDescriptor_t * sparseMatDescr,size_t * compressedSize,size_t * compressBufferSize) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup helper_module
# \brief Compress a dense matrix to structured matrix.
#
# \details
# \p hipsparseLtSpMMACompress2 compresses the dense matrix ``d_dense``.
# The compressed matrix is intended to be used as the first/second operand A/B
# in the \ref hipsparseLtMatmul() function.
#
# @param[in]
# handle handle to the hipsparselt library context queue.
# @param[in]
# sparseMatDescr structured (sparse) matrix descriptor.
# @param[in]
# isSparseA specify whether the structured (or sparse) matrix is in the first position (matA or matB).
# @param[in]
# op operation that will be applied to the structured (or sparse) matrix in the multiplication.
# @param[in]
# d_dense pointer to the dense matrix.
# @param[out]
# d_compressed compressed matrix and metadata.
# @param[out]
# d_compressBuffer temporary buffer for the compression.
# @param[in]
# stream HIP stream for the computation.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p sparseMatDescr, \p op, \p d_dense, or \p d_compressed is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED the problem is not supported.
cdef 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) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef bint __hipsparselt_has_symbol(const char* name) noexcept nogil