rocm.bindings.cyhipblaslt#
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.cyhipblaslt from your Cython code to access
these declarations directly.
See also
The high-level Python API is documented at rocm.bindings.hipblaslt.
# 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.cyhipblas cimport *
cdef extern from "hipblaslt/hipblaslt.h":
cdef int HIPBLASLT_VERSION_MAJOR
cdef int HIPBLASLT_VERSION_MINOR
cdef int HIPBLASLT_VERSION_PATCH
ctypedef enum hipblasLtEpilogue_t:
HIPBLASLT_EPILOGUE_DEFAULT
HIPBLASLT_EPILOGUE_RELU
HIPBLASLT_EPILOGUE_BIAS
HIPBLASLT_EPILOGUE_RELU_BIAS
HIPBLASLT_EPILOGUE_GELU
HIPBLASLT_EPILOGUE_GELU_BIAS
HIPBLASLT_EPILOGUE_RELU_AUX
HIPBLASLT_EPILOGUE_RELU_AUX_BIAS
HIPBLASLT_EPILOGUE_DRELU
HIPBLASLT_EPILOGUE_DRELU_BGRAD
HIPBLASLT_EPILOGUE_GELU_AUX
HIPBLASLT_EPILOGUE_GELU_AUX_BIAS
HIPBLASLT_EPILOGUE_DGELU
HIPBLASLT_EPILOGUE_DGELU_BGRAD
HIPBLASLT_EPILOGUE_BGRADA
HIPBLASLT_EPILOGUE_BGRADB
HIPBLASLT_EPILOGUE_SIGMOID
HIPBLASLT_EPILOGUE_SWISH_EXT
HIPBLASLT_EPILOGUE_SWISH_BIAS_EXT
HIPBLASLT_EPILOGUE_CLAMP_EXT
HIPBLASLT_EPILOGUE_CLAMP_BIAS_EXT
HIPBLASLT_EPILOGUE_CLAMP_AUX_EXT
HIPBLASLT_EPILOGUE_CLAMP_AUX_BIAS_EXT
ctypedef enum hipblasLtBatchMode_t:
HIPBLASLT_BATCH_MODE_STRIDED
HIPBLASLT_BATCH_MODE_POINTER_ARRAY
ctypedef enum hipblasLtMatrixLayoutAttribute_t:
HIPBLASLT_MATRIX_LAYOUT_BATCH_COUNT
HIPBLASLT_MATRIX_LAYOUT_STRIDED_BATCH_OFFSET
HIPBLASLT_MATRIX_LAYOUT_TYPE
HIPBLASLT_MATRIX_LAYOUT_ORDER
HIPBLASLT_MATRIX_LAYOUT_ROWS
HIPBLASLT_MATRIX_LAYOUT_COLS
HIPBLASLT_MATRIX_LAYOUT_LD
HIPBLASLT_MATRIX_LAYOUT_BATCH_MODE
ctypedef enum hipblasLtPointerMode_t:
HIPBLASLT_POINTER_MODE_HOST
HIPBLASLT_POINTER_MODE_DEVICE
HIPBLASLT_POINTER_MODE_ALPHA_DEVICE_VECTOR_BETA_HOST
ctypedef enum hipblasLtMatmulMatrixScale_t:
HIPBLASLT_MATMUL_MATRIX_SCALE_SCALAR_32F
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC16_UE4M3
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC32_UE8M0
HIPBLASLT_MATMUL_MATRIX_SCALE_OUTER_VEC_32F
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC128_32F
HIPBLASLT_MATMUL_MATRIX_SCALE_BLK128x128_32F
HIPBLASLT_MATMUL_MATRIX_SCALE_BLK32_UE8M0_32_8_EXT
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC16_UE8M0_EXT
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC32_UE4M3_EXT
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC16_UE5M3_EXT
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC32_UE5M3_EXT
HIPBLASLT_MATMUL_MATRIX_SCALE_END
ctypedef enum hipblasLtStreamKTileSchedulingMode_t:
HIPBLASLT_STREAMK_TILE_SCHEDULING_OFF
HIPBLASLT_STREAMK_TILE_SCHEDULING_ON
HIPBLASLT_STREAMK_TILE_SCHEDULING_AUTO
ctypedef enum hipblasLtMatmulDescAttributes_t:
HIPBLASLT_MATMUL_DESC_TRANSA
HIPBLASLT_MATMUL_DESC_TRANSB
HIPBLASLT_MATMUL_DESC_EPILOGUE
HIPBLASLT_MATMUL_DESC_BIAS_POINTER
HIPBLASLT_MATMUL_DESC_BIAS_DATA_TYPE
HIPBLASLT_MATMUL_DESC_A_SCALE_POINTER
HIPBLASLT_MATMUL_DESC_B_SCALE_POINTER
HIPBLASLT_MATMUL_DESC_C_SCALE_POINTER
HIPBLASLT_MATMUL_DESC_D_SCALE_POINTER
HIPBLASLT_MATMUL_DESC_EPILOGUE_AUX_SCALE_POINTER
HIPBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER
HIPBLASLT_MATMUL_DESC_EPILOGUE_AUX_LD
HIPBLASLT_MATMUL_DESC_EPILOGUE_AUX_BATCH_STRIDE
HIPBLASLT_MATMUL_DESC_POINTER_MODE
HIPBLASLT_MATMUL_DESC_AMAX_D_POINTER
HIPBLASLT_MATMUL_DESC_EPILOGUE_AUX_DATA_TYPE
HIPBLASLT_MATMUL_DESC_BIAS_BATCH_STRIDE
HIPBLASLT_MATMUL_DESC_A_SCALE_MODE
HIPBLASLT_MATMUL_DESC_B_SCALE_MODE
HIPBLASLT_MATMUL_DESC_SM_COUNT_TARGET
HIPBLASLT_MATMUL_DESC_COMPUTE_INPUT_TYPE_A_EXT
HIPBLASLT_MATMUL_DESC_COMPUTE_INPUT_TYPE_B_EXT
HIPBLASLT_MATMUL_DESC_EPILOGUE_ACT_ARG0_EXT
HIPBLASLT_MATMUL_DESC_EPILOGUE_ACT_ARG1_EXT
HIPBLASLT_MATMUL_DESC_STREAMK_TILE_SCHEDULING_EXT
HIPBLASLT_MATMUL_DESC_MAX
ctypedef enum hipblasLtMatmulPreferenceAttributes_t:
HIPBLASLT_MATMUL_PREF_SEARCH_MODE
HIPBLASLT_MATMUL_PREF_MAX_WORKSPACE_BYTES
HIPBLASLT_MATMUL_PREF_SM_COUNT_TARGET
HIPBLASLT_MATMUL_PREF_MAX
ctypedef enum hipblasLtOrder_t:
HIPBLASLT_ORDER_COL
HIPBLASLT_ORDER_ROW
HIPBLASLT_ORDER_COL16_4R32
HIPBLASLT_ORDER_COL16_4R16
HIPBLASLT_ORDER_COL16_4R8
HIPBLASLT_ORDER_COL16_4R4
HIPBLASLT_ORDER_COL16_4R2
ctypedef enum hipblasLtMatrixTransformDescAttributes_t:
HIPBLASLT_MATRIX_TRANSFORM_DESC_SCALE_TYPE
HIPBLASLT_MATRIX_TRANSFORM_DESC_POINTER_MODE
HIPBLASLT_MATRIX_TRANSFORM_DESC_TRANSA
HIPBLASLT_MATRIX_TRANSFORM_DESC_TRANSB
ctypedef struct hipblasLtMatmulDescOpaque_t:
uint64_t data[4]
ctypedef struct hipblasLtMatrixLayoutOpaque_t:
uint64_t data[4]
ctypedef struct hipblasLtMatmulPreferenceOpaque_t:
uint64_t data[5]
ctypedef struct hipblasLtMatrixTransformDescOpaque_t:
uint64_t data[8]
ctypedef hipblasLtMatrixTransformDescOpaque_t * hipblasLtMatrixTransformDesc_t
ctypedef void * hipblasLtHandle_t
ctypedef hipblasLtMatmulDescOpaque_t * hipblasLtMatmulDesc_t
ctypedef hipblasLtMatrixLayoutOpaque_t * hipblasLtMatrixLayout_t
ctypedef hipblasLtMatmulPreferenceOpaque_t * hipblasLtMatmulPreference_t
cdef struct _hipblasLtMatmulAlgo_t:
uint8_t data[16]
size_t max_workspace_bytes
ctypedef _hipblasLtMatmulAlgo_t hipblasLtMatmulAlgo_t
cdef struct _hipblasLtMatmulHeuristicResult_t:
_hipblasLtMatmulAlgo_t algo
size_t workspaceSize
hipblasStatus_t state
float wavesCount
int reserved[4]
ctypedef _hipblasLtMatmulHeuristicResult_t hipblasLtMatmulHeuristicResult_t
cdef hipblasStatus_t hipblasLtGetVersion(void * handle,int * version) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
cdef hipblasStatus_t hipblasLtGetGitRevision(void * handle,char * rev) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
cdef hipblasStatus_t hipblasLtGetArchName(char ** archName) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Create a hipBLASLt handle
#
# \details
# This function initializes the hipBLASLt library and creates a handle to an
# opaque structure holding the hipBLASLt library context. It allocates light
# hardware resources on the host and device and must be called prior to making
# any other hipBLASLt library calls. The hipBLASLt library context is tied to
# the current ROCm device. To use the library on multiple devices, one
# hipBLASLt handle should be created for each device.
#
# @param[out]
# handle Pointer to the allocated hipBLASLt handle for the created hipBLASLt
# context.
#
# \retval HIPBLAS_STATUS_SUCCESS The allocation completed successfully.
# \retval HIPBLAS_STATUS_INVALID_VALUE \p handle == NULL.
cdef hipblasStatus_t hipblasLtCreate(void ** handle) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Destroy a hipBLASLt handle.
#
# \details
# This function releases hardware resources used by the hipBLASLt library.
# It is usually the last call with a particular handle to the
# hipBLASLt library. Because hipblasLtCreate() allocates some internal
# resources and the release of those resources by calling hipblasLtDestroy()
# implicitly calls ``hipDeviceSynchronize``, it is recommended to minimize
# the number of hipblasLtCreate() / hipblasLtDestroy() occurrences.
#
# @param[in]
# handle Pointer to the hipBLASLt handle to be destroyed.
#
# \retval HIPBLAS_STATUS_SUCCESS The hipBLASLt context was successfully
# destroyed. \retval HIPBLAS_STATUS_NOT_INITIALIZED The hipBLASLt library was
# not initialized. \retval HIPBLAS_STATUS_INVALID_VALUE \p handle == NULL.
cdef hipblasStatus_t hipblasLtDestroy(void *const handle) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Set the handle-level target compute-unit (CU / SM) count.
#
# \details
# The hipBLASLt analogue of cuBLAS's ``cublasSetSmCountTarget``. The value
# hints how many compute units hipBLASLt should target for kernel selection
# and persistent-grid sizing on subsequent matmul calls that use this handle.
#
# ``0`` (the default) means "no override; use all CUs the device exposes".
# Negative values are rejected with ``HIPBLAS_STATUS_INVALID_VALUE``. A
# per-matmul-descriptor (``HIPBLASLT_MATMUL_DESC_SM_COUNT_TARGET``) or
# per-preference (``HIPBLASLT_MATMUL_PREF_SM_COUNT_TARGET``) attribute, when
# set to a non-zero value, takes precedence over this handle-level value.
#
# The user must ensure thread safety when modifying handle state from
# multiple threads, the same as for any other handle-mutating helper.
#
# @param[in]
# handle hipBLASLt library context.
# @param[in]
# smCountTarget target CU/SM count; ``0`` for "use all CUs".
#
# \retval HIPBLAS_STATUS_SUCCESS value stored.
# \retval HIPBLAS_STATUS_NOT_INITIALIZED \p handle is null / uninitialized.
# \retval HIPBLAS_STATUS_INVALID_VALUE \p smCountTarget is negative.
cdef hipblasStatus_t hipblasLtSetSmCountTarget(void * handle,int32_t smCountTarget) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Return the handle-level target compute-unit (CU / SM) count.
#
# \details
# Returns the value previously programmed via ``hipblasLtSetSmCountTarget``.
# Equivalent to cuBLAS's ``cublasGetSmCountTarget``.
#
# @param[in]
# handle hipBLASLt library context.
# @param[out]
# smCountTarget receives the previously stored value (``0`` if never set).
#
# \retval HIPBLAS_STATUS_SUCCESS value returned.
# \retval HIPBLAS_STATUS_NOT_INITIALIZED \p handle is null / uninitialized.
# \retval HIPBLAS_STATUS_INVALID_VALUE \p smCountTarget is null.
cdef hipblasStatus_t hipblasLtGetSmCountTarget(void * handle,int32_t * smCountTarget) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Drain the post-GEMM check-numerics flag without destroying the handle.
#
# \details
# When \c HIPBLASLT_CHECK_NUMERICS is set, this function performs a
# device-wide synchronize, reads the persistent NaN flag, and resets it.
# The matmul \c call_id of the FIRST scanned NaN observed since the
# previous drain (or handle creation) is written to \p first_nan_call_id
# if non-null. Zero means no NaN was observed in that window. Frameworks
# (e.g. PyTorch) call this to obtain a result without relying on the
# handle destructor (which may not run if the process is killed).
#
# When the env var is not set, the function is a no-op and returns
# \c HIPBLAS_STATUS_SUCCESS with \p *first_nan_call_id set to 0.
#
# @param[in]
# handle Pointer to the allocated hipBLASLt handle.
# @param[out]
# first_nan_call_id Optional. If non-null, receives the call_id of the
# first NaN seen in this drain window (0 = none).
#
# \retval HIPBLAS_STATUS_SUCCESS Drain completed (or scanning disabled).
# \retval HIPBLAS_STATUS_NOT_INITIALIZED \p handle is null.
cdef hipblasStatus_t hipblasLtCheckNumericsDrain(void * handle,uint32_t * first_nan_call_id) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Create a matrix layout descriptor.
#
# \details
# This function creates a matrix layout descriptor by allocating the memory
# needed to hold its opaque structure.
#
# @param[out]
# matLayout Pointer to the structure holding the matrix layout descriptor
# created by this function. See \ref hipblasLtMatrixLayout_t.
# @param[in]
# type Enumerant that specifies the data precision for the matrix layout
# descriptor created by this function. See hipDataType.
# @param[in]
# rows Number of rows of the matrix.
# @param[in]
# cols Number of columns of the matrix.
# @param[in]
# ld The leading dimension of the matrix. In column major layout, this is the
# number of elements to jump to reach the next column. Therefore, ld >= m (number of
# rows).
#
# \retval HIPBLAS_STATUS_SUCCESS If the descriptor was created successfully.
# \retval HIPBLAS_STATUS_ALLOC_FAILED If the memory could not be allocated.
cdef hipblasStatus_t hipblasLtMatrixLayoutCreate(hipblasLtMatrixLayout_t * matLayout,hipDataType type,uint64_t rows,uint64_t cols,int64_t ld) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Destroy a matrix layout descriptor
#
# \details
# This function destroys a previously created matrix layout descriptor object.
#
# @param[in]
# matLayout Pointer to the structure holding the matrix layout descriptor to
# be destroyed by this function. see \ref hipblasLtMatrixLayout_t.
#
# \retval HIPBLAS_STATUS_SUCCESS If the operation was successful.
cdef hipblasStatus_t hipblasLtMatrixLayoutDestroy(const hipblasLtMatrixLayout_t matLayout) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Set an attribute for a matrix descriptor.
#
# \details
# This function sets the value of the specified attribute belonging to a
# previously created matrix descriptor.
#
# @param[in]
# matLayout Pointer to the previously created structure holding the matrix
# descriptor queried by this function. See \ref hipblasLtMatrixLayout_t.
# @param[in]
# attr The attribute that will be set by this function. See \ref
# hipblasLtMatrixLayoutAttribute_t.
# @param[in]
# buf The value to which the specified attribute should be set.
# @param[in]
# sizeInBytes Size of the buf buffer (in bytes) for verification.
#
# \retval HIPBLAS_STATUS_SUCCESS If the attribute was set successfully.
# \retval HIPBLAS_STATUS_INVALID_VALUE If \p buf is NULL or \p sizeInBytes
# doesn't match the size of the internal storage for the selected attribute.
cdef hipblasStatus_t hipblasLtMatrixLayoutSetAttribute(hipblasLtMatrixLayout_t matLayout,hipblasLtMatrixLayoutAttribute_t attr,const void * buf,size_t sizeInBytes) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Query an attribute from a matrix descriptor.
#
# \details
# This function returns the value of the queried attribute belonging to a
# previously created matrix descriptor.
#
# @param[in]
# matLayout Pointer to the previously created structure holding the matrix
# descriptor queried by this function. See \ref hipblasLtMatrixLayout_t.
# @param[in]
# attr The attribute that will be retrieved by this function. See
# \ref hipblasLtMatrixLayoutAttribute_t.
# @param[out]
# buf Memory address containing the attribute value retrieved by this
# function.
# @param[in]
# sizeInBytes Size of the \p buf buffer (in bytes) for verification.
# @param[out]
# sizeWritten Valid only when the return value is HIPBLAS_STATUS_SUCCESS. If
# sizeInBytes is non-zero, then sizeWritten is the number of bytes actually
# written. If sizeInBytes is 0, then sizeWritten is the number of bytes needed
# to write the full contents.
#
# \retval HIPBLAS_STATUS_SUCCESS If the attribute's value was successfully
# written to user memory. \retval HIPBLAS_STATUS_INVALID_VALUE If \p
# sizeInBytes is 0 and \p sizeWritten is NULL, or if \p sizeInBytes is non-zero
# and \p buf is NULL, or \p sizeInBytes doesn't match the size of the internal storage
# for the selected attribute.
cdef hipblasStatus_t hipblasLtMatrixLayoutGetAttribute(hipblasLtMatrixLayout_t matLayout,hipblasLtMatrixLayoutAttribute_t attr,void * buf,size_t sizeInBytes,size_t * sizeWritten) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Create a matrix multiply descriptor.
#
# \details
# This function creates a matrix multiply descriptor by allocating the memory
# needed to hold its opaque structure.
#
# @param[out]
# matmulDesc Pointer to the structure holding the matrix multiply descriptor
# created by this function. See \ref hipblasLtMatmulDesc_t.
# @param[in]
# computeType Enumerant that specifies the data precision for the matrix
# multiply descriptor this function creates. See hipblasComputeType_t.
# @param[in]
# scaleType Enumerant that specifies the data precision for the matrix
# transform descriptor this function creates. See hipDataType.
#
# \retval HIPBLAS_STATUS_SUCCESS If the descriptor was created successfully.
# \retval HIPBLAS_STATUS_ALLOC_FAILED If the memory could not be allocated.
cdef hipblasStatus_t hipblasLtMatmulDescCreate(hipblasLtMatmulDesc_t * matmulDesc,hipblasComputeType_t computeType,hipDataType scaleType) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Destroy a matrix multiply descriptor.
#
# \details
# This function destroys a previously created matrix multiply descriptor
# object.
#
# @param[in]
# matmulDesc Pointer to the structure holding the matrix multiply descriptor
# to be destroyed by this function. See \ref hipblasLtMatmulDesc_t.
#
# \retval HIPBLAS_STATUS_SUCCESS If operation was successful.
cdef hipblasStatus_t hipblasLtMatmulDescDestroy(const hipblasLtMatmulDesc_t matmulDesc) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Set attribute to a matrix multiply descriptor.
#
# \details
# This function sets the value of the specified attribute belonging to a
# previously created matrix multiply descriptor.
#
# @param[in]
# matmulDesc Pointer to the previously created structure holding the matrix
# multiply descriptor queried by this function. See \ref hipblasLtMatmulDesc_t.
# @param[in]
# attr The attribute that will be set by this function. See \ref
# hipblasLtMatmulDescAttributes_t.
# @param[in]
# buf The value to which the specified attribute should be set.
# @param[in]
# sizeInBytes Size of the buf buffer (in bytes) for verification.
#
# \retval HIPBLAS_STATUS_SUCCESS If the attribute was set successfully.
# \retval HIPBLAS_STATUS_INVALID_VALUE If \p buf is NULL or \p sizeInBytes
# doesn't match the size of the internal storage for the selected attribute.
cdef hipblasStatus_t hipblasLtMatmulDescSetAttribute(hipblasLtMatmulDesc_t matmulDesc,hipblasLtMatmulDescAttributes_t attr,const void * buf,size_t sizeInBytes) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Query attribute from a matrix multiply descriptor.
#
# \details
# This function returns the value of the queried attribute belonging to a
# previously created matrix multiply descriptor.
#
# @param[in]
# matmulDesc Pointer to the previously created structure holding the matrix
# multiply descriptor queried by this function. See \ref hipblasLtMatmulDesc_t.
# @param[in]
# attr The attribute that will be retrieved by this function. See
# \ref hipblasLtMatmulDescAttributes_t.
# @param[out]
# buf Memory address containing the attribute value retrieved by this
# function.
# @param[in]
# sizeInBytes Size of the \p buf buffer (in bytes) for verification.
# @param[out]
# sizeWritten Valid only when the return value is HIPBLAS_STATUS_SUCCESS. If
# sizeInBytes is non-zero, then sizeWritten is the number of bytes actually
# written. If sizeInBytes is 0, then sizeWritten is the number of bytes needed
# to write the full contents.
#
# \retval HIPBLAS_STATUS_SUCCESS If the attribute's value was successfully
# written to user memory. \retval HIPBLAS_STATUS_INVALID_VALUE If \p
# sizeInBytes is 0 and \p sizeWritten is NULL, or if \p sizeInBytes is non-zero
# and \p buf is NULL, or \p sizeInBytes doesn't match the size of the internal storage
# for the selected attribute.
cdef hipblasStatus_t hipblasLtMatmulDescGetAttribute(hipblasLtMatmulDesc_t matmulDesc,hipblasLtMatmulDescAttributes_t attr,void * buf,size_t sizeInBytes,size_t * sizeWritten) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Create a preference descriptor.
#
# \details
# This function creates a matrix multiply heuristic search preferences
# descriptor by allocating the memory needed to hold its opaque structure.
#
# @param[out]
# pref Pointer to the structure holding the matrix multiply preferences
# descriptor created by this function. see \ref hipblasLtMatmulPreference_t.
#
# \retval HIPBLAS_STATUS_SUCCESS If the descriptor was created
# successfully. \retval HIPBLAS_STATUS_ALLOC_FAILED If memory could not be
# allocated.
cdef hipblasStatus_t hipblasLtMatmulPreferenceCreate(hipblasLtMatmulPreference_t * pref) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Destroy a preference descriptor.
#
# \details
# This function destroys a previously created matrix multiply preferences
# descriptor object.
#
# @param[in]
# pref Pointer to the structure holding the matrix multiply preferences
# descriptor to be destroyed by this function. See \ref
# hipblasLtMatmulPreference_t.
#
# \retval HIPBLAS_STATUS_SUCCESS If operation was successful.
cdef hipblasStatus_t hipblasLtMatmulPreferenceDestroy(const hipblasLtMatmulPreference_t pref) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Set attribute in a preference descriptor.
#
# \details
# This function sets the value of the specified attribute belonging to a
# previously created matrix multiply preferences descriptor.
#
# @param[in]
# pref Pointer to the previously created structure holding the matrix
# multiply preferences descriptor queried by this function. See \ref
# hipblasLtMatmulPreference_t.
# @param[in]
# attr The attribute that will be set by this function. See \ref
# hipblasLtMatmulPreferenceAttributes_t.
# @param[in]
# buf The value to which the specified attribute should be set.
# @param[in]
# sizeInBytes Size of the \p buf buffer (in bytes) for verification.
#
# \retval HIPBLAS_STATUS_SUCCESS If the attribute was set successfully.
# \retval HIPBLAS_STATUS_INVALID_VALUE If \p buf is NULL or \p sizeInBytes
# doesn't match the size of the internal storage for the selected attribute.
cdef hipblasStatus_t hipblasLtMatmulPreferenceSetAttribute(hipblasLtMatmulPreference_t pref,hipblasLtMatmulPreferenceAttributes_t attr,const void * buf,size_t sizeInBytes) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Query attribute from a preference descriptor.
#
# \details
# This function returns the value of the queried attribute belonging to a
# previously created matrix multiply heuristic search preferences descriptor.
#
# @param[in]
# pref Pointer to the previously created structure holding the matrix
# multiply heuristic search preferences descriptor queried by this function.
# See \ref hipblasLtMatmulPreference_t.
# @param[in]
# attr The attribute that will be retrieved by this function. See
# \ref hipblasLtMatmulPreferenceAttributes_t.
# @param[out]
# buf Memory address containing the attribute value retrieved by this
# function.
# @param[in]
# sizeInBytes Size of the \p buf buffer (in bytes) for verification.
# @param[out]
# sizeWritten Valid only when the return value is HIPBLAS_STATUS_SUCCESS. If
# sizeInBytes is non-zero, then sizeWritten is the number of bytes actually
# written. If sizeInBytes is 0, then sizeWritten is the number of bytes needed
# to write the full contents.
#
# \retval HIPBLAS_STATUS_SUCCESS If the attribute's value was successfully
# written to user memory. \retval HIPBLAS_STATUS_INVALID_VALUE If \p
# sizeInBytes is 0 and \p sizeWritten is NULL, or if \p sizeInBytes is non-zero
# and \p buf is NULL, or \p sizeInBytes doesn't match the size of the internal storage
# for the selected attribute.
cdef hipblasStatus_t hipblasLtMatmulPreferenceGetAttribute(hipblasLtMatmulPreference_t pref,hipblasLtMatmulPreferenceAttributes_t attr,void * buf,size_t sizeInBytes,size_t * sizeWritten) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Retrieve the possible algorithms.
#
# \details
# This function retrieves the possible algorithms for the matrix multiply
# operation hipblasLtMatmul() with the given input matrices A, B, and
# C, and the output matrix D. The output is placed in ``heuristicResultsArray``
# in order of increasing estimated compute time. Note that the wall duration
# increases if the ``requestedAlgoCount`` increases.
#
# @param[in]
# handle Pointer to the allocated hipBLASLt handle for the
# hipBLASLt context. See \ref hipblasLtHandle_t.
# @param[in]
# matmulDesc Handle to a previously created matrix multiplication
# descriptor of type \ref hipblasLtMatmulDesc_t.
# @param[in]
# Adesc,Bdesc,Cdesc,Ddesc Handles to the previously created matrix layout
# descriptors of the type \ref hipblasLtMatrixLayout_t.
# @param[in]
# pref Pointer to the structure holding the heuristic
# search preferences descriptor. See \ref hipblasLtMatmulPreference_t.
# @param[in]
# requestedAlgoCount Size of the \p heuristicResultsArray (in elements).
# This is the requested maximum number of algorithms to return.
# @param[out]
# heuristicResultsArray[] Array containing the algorithm heuristics and
# associated runtime characteristics returned by this function, in order
# of increasing estimated compute time.
# @param[out]
# returnAlgoCount Number of algorithms returned by this function. This
# is the number of \p heuristicResultsArray elements written.
#
# \retval HIPBLAS_STATUS_SUCCESS If query was successful. Inspect
# ``heuristicResultsArray[0 to (returnAlgoCount -1)].state`` for the status of the
# results. \retval HIPBLAS_STATUS_NOT_SUPPORTED If no heuristic function is
# available for current configuration. \retval HIPBLAS_STATUS_INVALID_VALUE If
# \p requestedAlgoCount is less than or equal to zero.
cdef hipblasStatus_t hipblasLtMatmulAlgoGetHeuristic(void * handle,hipblasLtMatmulDesc_t matmulDesc,hipblasLtMatrixLayout_t Adesc,hipblasLtMatrixLayout_t Bdesc,hipblasLtMatrixLayout_t Cdesc,hipblasLtMatrixLayout_t Ddesc,hipblasLtMatmulPreference_t pref,int requestedAlgoCount,_hipblasLtMatmulHeuristicResult_t * heuristicResultsArray,int * returnAlgoCount) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Compute a matrix multiplication on the described inputs.
#
# \details
# This function computes the matrix multiplication of matrices A and B to
# produce the output matrix D, according to the following operation: \p D = \p
# alpha*( \p A *\p B) + \p beta*( \p C ), where \p A, \p B, and \p C are input
# matrices, and \p alpha and \p beta are input scalars. Note: This function
# supports both in-place matrix multiplication (``C == D`` and ``Cdesc == Ddesc``) and
# out-of-place matrix multiplication (``C != D``, both matrices must have the same
# data type, number of rows, number of columns, batch size, and memory order).
# In the out-of-place case, the leading dimension of ``C`` can be different from
# the leading dimension of ``D``. Specifically, the leading dimension of ``C`` can be 0
# to achieve row or column broadcast. If ``Cdesc`` is omitted, this function
# assumes it to be equal to ``Ddesc``.
#
# @param[in]
# handle Pointer to the allocated hipBLASLt handle for the
# hipBLASLt context. See \ref hipblasLtHandle_t.
# @param[in]
# matmulDesc Handle to a previously created matrix multiplication
# descriptor of type \ref hipblasLtMatmulDesc_t.
# @param[in]
# alpha,beta Pointers to the scalars used in the multiplication.
# @param[in]
# Adesc,Bdesc,Cdesc,Ddesc Handles to the previously created matrix layout
# descriptors of the type \ref hipblasLtMatrixLayout_t.
# @param[in]
# A,B,C Pointers to the GPU memory associated with the
# corresponding descriptors \p Adesc, \p Bdesc, and \p Cdesc.
# @param[out]
# D Pointer to the GPU memory associated with the
# descriptor \p Ddesc.
# @param[in]
# algo Handle for matrix multiplication algorithm to be
# used. See \ref hipblasLtMatmulAlgo_t. When NULL, an implicit heuristics query
# with default search preferences will be performed to determine the actual
# algorithm to use.
# @param[in]
# workspace Pointer to the workspace buffer allocated in the GPU
# memory. Pointer must be 16B aligned (that is, the lowest 4 bits of the address must
# be 0).
# @param[in]
# workspaceSizeInBytes Size of the workspace.
# @param[in]
# stream The HIP stream where all GPU work is
# submitted.
#
# \retval HIPBLAS_STATUS_SUCCESS If the operation completed
# successfully. \retval HIPBLAS_STATUS_EXECUTION_FAILED If HIP reported an
# execution error from the device. \retval HIPBLAS_STATUS_ARCH_MISMATCH If
# the configured operation cannot be run using the selected device. \retval
# HIPBLAS_STATUS_NOT_SUPPORTED If the current implementation on the
# selected device doesn't support the configured operation. \retval
# HIPBLAS_STATUS_INVALID_VALUE If the parameters are unexpectedly NULL, in
# conflict, or in an impossible configuration. For example, when
# workspaceSizeInBytes is less than the workspace required by the configured algorithm.
# \retval HIBLAS_STATUS_NOT_INITIALIZED If the hipBLASLt handle has not been
# initialized.
cdef hipblasStatus_t hipblasLtMatmul(void * handle,hipblasLtMatmulDesc_t matmulDesc,const void * alpha,const void * A,hipblasLtMatrixLayout_t Adesc,const void * B,hipblasLtMatrixLayout_t Bdesc,const void * beta,const void * C,hipblasLtMatrixLayout_t Cdesc,void * D,hipblasLtMatrixLayout_t Ddesc,const _hipblasLtMatmulAlgo_t * algo,void * workspace,size_t workspaceSizeInBytes,hipStream_t stream) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# Create a new matrix transform operation descriptor.
#
# \retval HIPBLAS_STATUS_ALLOC_FAILED If memory could not be allocated.
# \retval HIPBLAS_STATUS_SUCCESS If the descriptor was created successfully.
cdef hipblasStatus_t hipblasLtMatrixTransformDescCreate(hipblasLtMatrixTransformDesc_t * transformDesc,hipDataType scaleType) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# Destroy a matrix transform operation descriptor.
#
# \retval HIPBLAS_STATUS_SUCCESS If the operation was successful.
cdef hipblasStatus_t hipblasLtMatrixTransformDescDestroy(hipblasLtMatrixTransformDesc_t transformDesc) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# Set a matrix transform operation descriptor attribute.
#
# \param[in] transformDesc The descriptor.
# \param[in] attr The attribute.
# \param[in] buf Memory address containing the new value.
# \param[in] sizeInBytes Size of the buf buffer for verification (in bytes).
#
# \retval HIPBLAS_STATUS_INVALID_VALUE If buf is NULL or sizeInBytes doesn't match the size of the internal storage for
# the selected attribute.
# \retval HIPBLAS_STATUS_SUCCESS If the attribute was set successfully.
cdef hipblasStatus_t hipblasLtMatrixTransformDescSetAttribute(hipblasLtMatrixTransformDesc_t transformDesc,hipblasLtMatrixTransformDescAttributes_t attr,const void * buf,size_t sizeInBytes) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Gets the matrix transform attribute.
# \details Gets the attribute from the matrix transform operation descriptor.
#
# @param[in] transformDesc The descriptor.
# @param[in] attr The attribute.
# @param[out] buf Memory address containing the new value.
# @param[in] sizeInBytes Size of the buf buffer for verification (in bytes).
# @param[out] sizeWritten Only valid when return value is HIPBLAS_STATUS_SUCCESS. If sizeInBytes is non-zero, the number
# of bytes actually written. If sizeInBytes is 0, the number of bytes needed to write the full contents.
#
# \retval HIPBLAS_STATUS_INVALID_VALUE If sizeInBytes is 0 and sizeWritten is NULL, or sizeInBytes is non-zero
# and buf is NULL, or sizeInBytes doesn't match the size of the internal storage for
# the selected attribute.
# \retval HIPBLAS_STATUS_SUCCESS If the attribute's value was successfully written to user memory.
cdef hipblasStatus_t hipblasLtMatrixTransformDescGetAttribute(hipblasLtMatrixTransformDesc_t transformDesc,hipblasLtMatrixTransformDescAttributes_t attr,void * buf,size_t sizeInBytes,size_t * sizeWritten) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
# \ingroup library_module
# \brief Matrix layout conversion helper.
# \details
# The matrix layout conversion helper (``C = alpha * op(A) + beta * op(B)``),
# can be used to change the memory order of the data or to scale and shift the values.
# @param[in] lightHandle Pointer to the allocated hipBLASLt handle for the
# hipBLASLt context. See \ref hipblasLtHandle_t.
# @param[in] transformDesc Pointer to the allocated matrix transform descriptor.
# @param[in] alpha Pointer to scalar alpha. Pointer to either the host or device address.
# @param[in] A Pointer to matrix A. Must be a pointer to the device address.
# @param[in] Adesc Pointer to the layout for input matrix A.
# @param[in] beta Pointer to scalar beta. Pointer to either the host or device address.
# @param[in] B Pointer to the layout for matrix B. Must be a pointer to the device address.
# @param[in] Bdesc Pointer to the layout for input matrix B.
# @param[in] C Pointer to matrix C. Must be a pointer to the device address.
# @param[out] Cdesc Pointer to the layout for output matrix C.
# @param[in] stream The HIP stream where all the GPU work will be submitted.
#
# \retval HIPBLAS_STATUS_NOT_INITIALIZED If the hipBLASLt handle has not been initialized.
# \retval HIPBLAS_STATUS_INVALID_VALUE If the parameters are in conflict or in an impossible configuration, for example,
# when A is not NULL but Adesc is NULL.
# \retval HIPBLAS_STATUS_NOT_SUPPORTED If the current implementation on the selected device doesn't support the configured
# operation.
# \retval HIPBLAS_STATUS_ARCH_MISMATCH If the configured operation cannot be run using the selected device.
# \retval HIPBLAS_STATUS_EXECUTION_FAILED If HIP reported an execution error from the device.
# \retval HIPBLAS_STATUS_SUCCESS If the operation completed successfully.
cdef hipblasStatus_t hipblasLtMatrixTransform(void * lightHandle,hipblasLtMatrixTransformDesc_t transformDesc,const void * alpha,const void * A,hipblasLtMatrixLayout_t Adesc,const void * beta,const void * B,hipblasLtMatrixLayout_t Bdesc,void * C,hipblasLtMatrixLayout_t Cdesc,hipStream_t stream) except? HIPBLAS_STATUS_INTERNAL_ERROR nogil
cdef bint __hipblaslt_has_symbol(const char* name) noexcept nogil