rocm.bindings.hipblaslt

Contents

rocm.bindings.hipblaslt#

2026-09-24

31 min read time

Applies to Linux and Windows

Advanced Micro Devices, Inc.

Attributes#

Classes#

hipblasLtEpilogue_t

Specifies the enumeration type to set the postprocessing options for the epilogue.

hipblasLtBatchMode_t

Specify the batch mode of the matrices.

hipblasLtMatrixLayoutAttribute_t

Specifies the attributes that define the details of the matrix.

hipblasLtPointerMode_t

Pointer mode to use for alpha.

hipblasLtMatmulMatrixScale_t

Block scale mode for A and B.

hipblasLtStreamKTileSchedulingMode_t

Mode values for the HIPBLASLT_MATMUL_DESC_STREAMK_TILE_SCHEDULING_EXT

hipblasLtMatmulDescAttributes_t

Specifies the attributes that define the specifics of the matrix multiply operation.

hipblasLtMatmulPreferenceAttributes_t

This is an enumerated type used to apply algorithm search preferences while fine-tuning the heuristic function.

hipblasLtOrder_t

Enumeration for data ordering.

hipblasLtMatrixTransformDescAttributes_t

Matrix transform descriptor attributes to define details of the operation.

hipblasLtMatmulDescOpaque_t

(No short description)

hipblasLtMatrixLayoutOpaque_t

(No short description)

hipblasLtMatmulPreferenceOpaque_t

(No short description)

hipblasLtMatrixTransformDescOpaque_t

Semi-opaque descriptor for hipblasLtMatrixTransform() operation details

Functions#

has_symbol(→ bool)

hipblasLtGetVersion(handle)

(No short description, might be part of a group.)

hipblasLtGetGitRevision(handle, rev)

(No short description, might be part of a group.)

hipblasLtGetArchName()

(No short description, might be part of a group.)

hipblasLtCreate()

Create a hipBLASLt handle

hipblasLtDestroy(handle)

Destroy a hipBLASLt handle.

hipblasLtSetSmCountTarget(handle, smCountTarget)

Set the handle-level target compute-unit (CU / SM) count.

hipblasLtGetSmCountTarget(handle)

Return the handle-level target compute-unit (CU / SM) count.

hipblasLtCheckNumericsDrain(handle)

Drain the post-GEMM check-numerics flag without destroying the handle.

hipblasLtMatrixLayoutCreate(type, rows, cols, ld)

Create a matrix layout descriptor.

hipblasLtMatrixLayoutDestroy(matLayout)

Destroy a matrix layout descriptor

hipblasLtMatrixLayoutSetAttribute(matLayout, attr, ...)

Set an attribute for a matrix descriptor.

hipblasLtMatrixLayoutGetAttribute(matLayout, attr, ...)

Query an attribute from a matrix descriptor.

hipblasLtMatmulDescCreate(computeType, scaleType)

Create a matrix multiply descriptor.

hipblasLtMatmulDescDestroy(matmulDesc)

Destroy a matrix multiply descriptor.

hipblasLtMatmulDescSetAttribute(matmulDesc, attr, buf, ...)

Set attribute to a matrix multiply descriptor.

hipblasLtMatmulDescGetAttribute(matmulDesc, attr, buf, ...)

Query attribute from a matrix multiply descriptor.

hipblasLtMatmulPreferenceCreate()

Create a preference descriptor.

hipblasLtMatmulPreferenceDestroy(pref)

Destroy a preference descriptor.

hipblasLtMatmulPreferenceSetAttribute(pref, attr, buf, ...)

Set attribute in a preference descriptor.

hipblasLtMatmulPreferenceGetAttribute(pref, attr, buf, ...)

Query attribute from a preference descriptor.

hipblasLtMatmulAlgoGetHeuristic(handle, matmulDesc, ...)

Retrieve the possible algorithms.

hipblasLtMatmul(handle, matmulDesc, alpha, A, Adesc, ...)

Compute a matrix multiplication on the described inputs.

hipblasLtMatrixTransformDescCreate(scaleType)

Create a new matrix transform operation descriptor.

hipblasLtMatrixTransformDescDestroy(transformDesc)

Destroy a matrix transform operation descriptor.

hipblasLtMatrixTransformDescSetAttribute(...)

Set a matrix transform operation descriptor attribute.

hipblasLtMatrixTransformDescGetAttribute(...)

Gets the matrix transform attribute.

hipblasLtMatrixTransform(lightHandle, transformDesc, ...)

Matrix layout conversion helper.

Module Contents#

rocm.bindings.hipblaslt.has_symbol(name: str | bytes | bytearray) → bool#
rocm.bindings.hipblaslt.HIPBLASLT_VERSION_MAJOR: Any#
rocm.bindings.hipblaslt.HIPBLASLT_VERSION_MINOR: Any#
rocm.bindings.hipblaslt.HIPBLASLT_VERSION_PATCH: Any#
class rocm.bindings.hipblaslt.hipblasLtEpilogue_t#

Bases: enum.IntEnum

Specifies the enumeration type to set the postprocessing options for the epilogue.

HIPBLASLT_EPILOGUE_DEFAULT: int#
HIPBLASLT_EPILOGUE_RELU: int#
HIPBLASLT_EPILOGUE_BIAS: int#
HIPBLASLT_EPILOGUE_RELU_BIAS: int#
HIPBLASLT_EPILOGUE_GELU: int#
HIPBLASLT_EPILOGUE_GELU_BIAS: int#
HIPBLASLT_EPILOGUE_RELU_AUX: int#
HIPBLASLT_EPILOGUE_RELU_AUX_BIAS: int#
HIPBLASLT_EPILOGUE_DRELU: int#
HIPBLASLT_EPILOGUE_DRELU_BGRAD: int#
HIPBLASLT_EPILOGUE_GELU_AUX: int#
HIPBLASLT_EPILOGUE_GELU_AUX_BIAS: int#
HIPBLASLT_EPILOGUE_DGELU: int#
HIPBLASLT_EPILOGUE_DGELU_BGRAD: int#
HIPBLASLT_EPILOGUE_BGRADA: int#
HIPBLASLT_EPILOGUE_BGRADB: int#
HIPBLASLT_EPILOGUE_SIGMOID: int#
HIPBLASLT_EPILOGUE_SWISH_EXT: int#
HIPBLASLT_EPILOGUE_SWISH_BIAS_EXT: int#
HIPBLASLT_EPILOGUE_CLAMP_EXT: int#
HIPBLASLT_EPILOGUE_CLAMP_BIAS_EXT: int#
HIPBLASLT_EPILOGUE_CLAMP_AUX_EXT: int#
HIPBLASLT_EPILOGUE_CLAMP_AUX_BIAS_EXT: int#
class rocm.bindings.hipblaslt.hipblasLtBatchMode_t#

Bases: enum.IntEnum

Specify the batch mode of the matrices.

HIPBLASLT_BATCH_MODE_STRIDED: int#
HIPBLASLT_BATCH_MODE_POINTER_ARRAY: int#
class rocm.bindings.hipblaslt.hipblasLtMatrixLayoutAttribute_t#

Bases: enum.IntEnum

Specifies the attributes that define the details of the matrix.

HIPBLASLT_MATRIX_LAYOUT_BATCH_COUNT: int#
HIPBLASLT_MATRIX_LAYOUT_STRIDED_BATCH_OFFSET: int#
HIPBLASLT_MATRIX_LAYOUT_TYPE: int#
HIPBLASLT_MATRIX_LAYOUT_ORDER: int#
HIPBLASLT_MATRIX_LAYOUT_ROWS: int#
HIPBLASLT_MATRIX_LAYOUT_COLS: int#
HIPBLASLT_MATRIX_LAYOUT_LD: int#
HIPBLASLT_MATRIX_LAYOUT_BATCH_MODE: int#
class rocm.bindings.hipblaslt.hipblasLtPointerMode_t#

Bases: enum.IntEnum

Pointer mode to use for alpha.

HIPBLASLT_POINTER_MODE_HOST: int#
HIPBLASLT_POINTER_MODE_DEVICE: int#
HIPBLASLT_POINTER_MODE_ALPHA_DEVICE_VECTOR_BETA_HOST: int#
class rocm.bindings.hipblaslt.hipblasLtMatmulMatrixScale_t#

Bases: enum.IntEnum

Block scale mode for A and B.

HIPBLASLT_MATMUL_MATRIX_SCALE_SCALAR_32F: int#
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC16_UE4M3: int#
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC32_UE8M0: int#
HIPBLASLT_MATMUL_MATRIX_SCALE_OUTER_VEC_32F: int#
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC128_32F: int#
HIPBLASLT_MATMUL_MATRIX_SCALE_BLK128x128_32F: int#
HIPBLASLT_MATMUL_MATRIX_SCALE_BLK32_UE8M0_32_8_EXT: int#
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC16_UE8M0_EXT: int#
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC32_UE4M3_EXT: int#
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC16_UE5M3_EXT: int#
HIPBLASLT_MATMUL_MATRIX_SCALE_VEC32_UE5M3_EXT: int#
HIPBLASLT_MATMUL_MATRIX_SCALE_END: int#
class rocm.bindings.hipblaslt.hipblasLtStreamKTileSchedulingMode_t#

Bases: enum.IntEnum

Mode values for the HIPBLASLT_MATMUL_DESC_STREAMK_TILE_SCHEDULING_EXT attribute and the C++ ext GemmPreference::setStreamKTileSchedulingMode.

The attribute storage stays int32_t; values outside {0, 1, 2} are rejected by the setter with HIPBLAS_STATUS_INVALID_VALUE.

HIPBLASLT_STREAMK_TILE_SCHEDULING_OFF: int#
HIPBLASLT_STREAMK_TILE_SCHEDULING_ON: int#
HIPBLASLT_STREAMK_TILE_SCHEDULING_AUTO: int#
class rocm.bindings.hipblaslt.hipblasLtMatmulDescAttributes_t#

Bases: enum.IntEnum

Specifies the attributes that define the specifics of the matrix multiply operation.

HIPBLASLT_MATMUL_DESC_TRANSA: int#
HIPBLASLT_MATMUL_DESC_TRANSB: int#
HIPBLASLT_MATMUL_DESC_EPILOGUE: int#
HIPBLASLT_MATMUL_DESC_BIAS_POINTER: int#
HIPBLASLT_MATMUL_DESC_BIAS_DATA_TYPE: int#
HIPBLASLT_MATMUL_DESC_A_SCALE_POINTER: int#
HIPBLASLT_MATMUL_DESC_B_SCALE_POINTER: int#
HIPBLASLT_MATMUL_DESC_C_SCALE_POINTER: int#
HIPBLASLT_MATMUL_DESC_D_SCALE_POINTER: int#
HIPBLASLT_MATMUL_DESC_EPILOGUE_AUX_SCALE_POINTER: int#
HIPBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER: int#
HIPBLASLT_MATMUL_DESC_EPILOGUE_AUX_LD: int#
HIPBLASLT_MATMUL_DESC_EPILOGUE_AUX_BATCH_STRIDE: int#
HIPBLASLT_MATMUL_DESC_POINTER_MODE: int#
HIPBLASLT_MATMUL_DESC_AMAX_D_POINTER: int#
HIPBLASLT_MATMUL_DESC_EPILOGUE_AUX_DATA_TYPE: int#
HIPBLASLT_MATMUL_DESC_BIAS_BATCH_STRIDE: int#
HIPBLASLT_MATMUL_DESC_A_SCALE_MODE: int#
HIPBLASLT_MATMUL_DESC_B_SCALE_MODE: int#
HIPBLASLT_MATMUL_DESC_SM_COUNT_TARGET: int#
HIPBLASLT_MATMUL_DESC_COMPUTE_INPUT_TYPE_A_EXT: int#
HIPBLASLT_MATMUL_DESC_COMPUTE_INPUT_TYPE_B_EXT: int#
HIPBLASLT_MATMUL_DESC_EPILOGUE_ACT_ARG0_EXT: int#
HIPBLASLT_MATMUL_DESC_EPILOGUE_ACT_ARG1_EXT: int#
HIPBLASLT_MATMUL_DESC_STREAMK_TILE_SCHEDULING_EXT: int#
HIPBLASLT_MATMUL_DESC_MAX: int#
class rocm.bindings.hipblaslt.hipblasLtMatmulPreferenceAttributes_t#

Bases: enum.IntEnum

This is an enumerated type used to apply algorithm search preferences while fine-tuning the heuristic function.

HIPBLASLT_MATMUL_PREF_SEARCH_MODE: int#
HIPBLASLT_MATMUL_PREF_MAX_WORKSPACE_BYTES: int#
HIPBLASLT_MATMUL_PREF_SM_COUNT_TARGET: int#
HIPBLASLT_MATMUL_PREF_MAX: int#
class rocm.bindings.hipblaslt.hipblasLtOrder_t#

Bases: enum.IntEnum

Enumeration for data ordering.

HIPBLASLT_ORDER_COL: int#
HIPBLASLT_ORDER_ROW: int#
HIPBLASLT_ORDER_COL16_4R32: int#
HIPBLASLT_ORDER_COL16_4R16: int#
HIPBLASLT_ORDER_COL16_4R8: int#
HIPBLASLT_ORDER_COL16_4R4: int#
HIPBLASLT_ORDER_COL16_4R2: int#
class rocm.bindings.hipblaslt.hipblasLtMatrixTransformDescAttributes_t#

Bases: enum.IntEnum

Matrix transform descriptor attributes to define details of the operation.

HIPBLASLT_MATRIX_TRANSFORM_DESC_SCALE_TYPE: int#
HIPBLASLT_MATRIX_TRANSFORM_DESC_POINTER_MODE: int#
HIPBLASLT_MATRIX_TRANSFORM_DESC_TRANSA: int#
HIPBLASLT_MATRIX_TRANSFORM_DESC_TRANSB: int#
class rocm.bindings.hipblaslt.hipblasLtMatmulDescOpaque_t(*args, **kwargs)#

Bases: rocm.bindings.util.types.Pointer

(No short description)

data: Any#
static PROPERTIES() → list[str]#
static fromObj(pyobj) → Any#
static allocate(count: int = 1) → Any#
c_sizeof() → int#
as_c_void_p() → Any#
class rocm.bindings.hipblaslt.hipblasLtMatrixLayoutOpaque_t(*args, **kwargs)#

Bases: rocm.bindings.util.types.Pointer

(No short description)

data: Any#
static PROPERTIES() → list[str]#
static fromObj(pyobj) → Any#
static allocate(count: int = 1) → Any#
c_sizeof() → int#
as_c_void_p() → Any#
class rocm.bindings.hipblaslt.hipblasLtMatmulPreferenceOpaque_t(*args, **kwargs)#

Bases: rocm.bindings.util.types.Pointer

(No short description)

data: Any#
static PROPERTIES() → list[str]#
static fromObj(pyobj) → Any#
static allocate(count: int = 1) → Any#
c_sizeof() → int#
as_c_void_p() → Any#
class rocm.bindings.hipblaslt.hipblasLtMatrixTransformDescOpaque_t(*args, **kwargs)#

Bases: rocm.bindings.util.types.Pointer

Semi-opaque descriptor for hipblasLtMatrixTransform() operation details

data: Any#
static PROPERTIES() → list[str]#
static fromObj(pyobj) → Any#
static allocate(count: int = 1) → Any#
c_sizeof() → int#
as_c_void_p() → Any#
rocm.bindings.hipblaslt.hipblasLtMatrixTransformDesc_t#
rocm.bindings.hipblaslt.hipblasLtMatmulDesc_t#
rocm.bindings.hipblaslt.hipblasLtMatrixLayout_t#
rocm.bindings.hipblaslt.hipblasLtMatmulPreference_t#
rocm.bindings.hipblaslt.hipblasLtMatmulAlgo_t#
rocm.bindings.hipblaslt.hipblasLtMatmulHeuristicResult_t#
rocm.bindings.hipblaslt.hipblasLtGetVersion(handle)#

(No short description, might be part of a group.)

Args:
handle (Pointer/object):

(undocumented)

Returns:

A tuple of size 2 that contains (in that order):

C signature

hipblasStatus_t hipblasLtGetVersion(hipblasLtHandle_t handle, int * version)
rocm.bindings.hipblaslt.hipblasLtGetGitRevision(handle, rev)#

(No short description, might be part of a group.)

Args:
handle (Pointer/object):

(undocumented)

rev (CStr/object):

(undocumented)

Returns:

A tuple of size 1 that contains (in that order):

C signature

hipblasStatus_t hipblasLtGetGitRevision(hipblasLtHandle_t handle, char * rev)
rocm.bindings.hipblaslt.hipblasLtGetArchName()#

(No short description, might be part of a group.)

Returns:

A tuple of size 2 that contains (in that order):

C signature

hipblasStatus_t hipblasLtGetArchName(char ** archName)
rocm.bindings.hipblaslt.hipblasLtCreate()#

Create a hipBLASLt handle

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.

Returns:

A tuple of size 2 that contains (in that order):

C signature

hipblasStatus_t hipblasLtCreate(hipblasLtHandle_t * handle)
rocm.bindings.hipblaslt.hipblasLtDestroy(handle)#

Destroy a hipBLASLt handle.

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.

Args:
handle (Pointer/object) – IN:

Pointer to the hipBLASLt handle to be destroyed.

Returns:

A tuple of size 1 that contains (in that order):

C signature

hipblasStatus_t hipblasLtDestroy(const hipblasLtHandle_t handle)
rocm.bindings.hipblaslt.hipblasLtSetSmCountTarget(handle, smCountTarget)#

Set the handle-level target compute-unit (CU / SM) count.

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.

Args:
handle (Pointer/object) – IN:

hipBLASLt library context.

smCountTarget (int) – IN:

target CU/SM count; 0 for “use all CUs”.

Returns:

A tuple of size 1 that contains (in that order):

C signature

hipblasStatus_t hipblasLtSetSmCountTarget(hipblasLtHandle_t handle, int32_t smCountTarget)
rocm.bindings.hipblaslt.hipblasLtGetSmCountTarget(handle)#

Return the handle-level target compute-unit (CU / SM) count.

Returns the value previously programmed via hipblasLtSetSmCountTarget. Equivalent to cuBLAS’s cublasGetSmCountTarget.

Args:
handle (Pointer/object) – IN:

hipBLASLt library context.

Returns:

A tuple of size 2 that contains (in that order):

C signature

hipblasStatus_t hipblasLtGetSmCountTarget(hipblasLtHandle_t handle, int32_t * smCountTarget)
rocm.bindings.hipblaslt.hipblasLtCheckNumericsDrain(handle)#

Drain the post-GEMM check-numerics flag without destroying the handle.

When HIPBLASLT_CHECK_NUMERICS is set, this function performs a device-wide synchronize, reads the persistent NaN flag, and resets it. The matmul call_id of the FIRST scanned NaN observed since the previous drain (or handle creation) is written to 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 HIPBLAS_STATUS_SUCCESS with *first_nan_call_id set to 0.

Args:
handle (Pointer/object) – IN:

Pointer to the allocated hipBLASLt handle.

Returns:

A tuple of size 2 that contains (in that order):

C signature

hipblasStatus_t hipblasLtCheckNumericsDrain(hipblasLtHandle_t handle, uint32_t * first_nan_call_id)
rocm.bindings.hipblaslt.hipblasLtMatrixLayoutCreate(type, rows, cols, ld)#

Create a matrix layout descriptor.

This function creates a matrix layout descriptor by allocating the memory needed to hold its opaque structure.

Args:
type (hipDataType) – IN:

Enumerant that specifies the data precision for the matrix layout descriptor created by this function. See hipDataType.

rows (int) – IN:

Number of rows of the matrix.

cols (int) – IN:

Number of columns of the matrix.

ld (int) – IN:

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

Returns:

A tuple of size 2 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatrixLayoutCreate(hipblasLtMatrixLayout_t * matLayout, hipDataType type, uint64_t rows, uint64_t cols, int64_t ld)
rocm.bindings.hipblaslt.hipblasLtMatrixLayoutDestroy(matLayout)#

Destroy a matrix layout descriptor

This function destroys a previously created matrix layout descriptor object.

Args:
matLayout (hipblasLtMatrixLayoutOpaque_t/object) – IN:

Pointer to the structure holding the matrix layout descriptor to be destroyed by this function. see hipblasLtMatrixLayout_t .

Returns:

A tuple of size 1 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatrixLayoutDestroy(const hipblasLtMatrixLayout_t matLayout)
rocm.bindings.hipblaslt.hipblasLtMatrixLayoutSetAttribute(matLayout, attr, buf, sizeInBytes)#

Set an attribute for a matrix descriptor.

This function sets the value of the specified attribute belonging to a previously created matrix descriptor.

Args:
matLayout (hipblasLtMatrixLayoutOpaque_t/object) – IN:

Pointer to the previously created structure holding the matrix descriptor queried by this function. See hipblasLtMatrixLayout_t .

attr (hipblasLtMatrixLayoutAttribute_t) – IN:

The attribute that will be set by this function. See ref hipblasLtMatrixLayoutAttribute_t.

buf (Pointer/object) – IN:

The value to which the specified attribute should be set.

sizeInBytes (int) – IN:

Size of the buf buffer (in bytes) for verification.

Returns:

A tuple of size 1 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatrixLayoutSetAttribute(hipblasLtMatrixLayout_t matLayout, hipblasLtMatrixLayoutAttribute_t attr, const void * buf, size_t sizeInBytes)
rocm.bindings.hipblaslt.hipblasLtMatrixLayoutGetAttribute(matLayout, attr, buf, sizeInBytes)#

Query an attribute from a matrix descriptor.

This function returns the value of the queried attribute belonging to a previously created matrix descriptor.

Args:
matLayout (hipblasLtMatrixLayoutOpaque_t/object) – IN:

Pointer to the previously created structure holding the matrix descriptor queried by this function. See hipblasLtMatrixLayout_t .

attr (hipblasLtMatrixLayoutAttribute_t) – IN:

The attribute that will be retrieved by this function. See hipblasLtMatrixLayoutAttribute_t .

buf (Pointer/object) – OUT:

Memory address containing the attribute value retrieved by this function.

sizeInBytes (int) – IN:

Size of the buf buffer (in bytes) for verification.

Returns:

A tuple of size 2 that contains (in that order):

  • hipblasStatus_t: One of:
    • HIPBLAS_STATUS_SUCCESS: If the attribute’s value was successfully written to user memory.

    • HIPBLAS_STATUS_INVALID_VALUE: If p sizeInBytes is 0 and sizeWritten is NULL, or if sizeInBytes is non-zero and buf is NULL, or sizeInBytes doesn’t match the size of the internal storage for the selected attribute.

  • int:

    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.

C signature

hipblasStatus_t hipblasLtMatrixLayoutGetAttribute(hipblasLtMatrixLayout_t matLayout, hipblasLtMatrixLayoutAttribute_t attr, void * buf, size_t sizeInBytes, size_t * sizeWritten)
rocm.bindings.hipblaslt.hipblasLtMatmulDescCreate(computeType, scaleType)#

Create a matrix multiply descriptor.

This function creates a matrix multiply descriptor by allocating the memory needed to hold its opaque structure.

Args:
computeType (hipblasComputeType_t) – IN:

Enumerant that specifies the data precision for the matrix multiply descriptor this function creates. See hipblasComputeType_t.

scaleType (hipDataType) – IN:

Enumerant that specifies the data precision for the matrix transform descriptor this function creates. See hipDataType.

Returns:

A tuple of size 2 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatmulDescCreate(hipblasLtMatmulDesc_t * matmulDesc, hipblasComputeType_t computeType, hipDataType scaleType)
rocm.bindings.hipblaslt.hipblasLtMatmulDescDestroy(matmulDesc)#

Destroy a matrix multiply descriptor.

This function destroys a previously created matrix multiply descriptor object.

Args:
matmulDesc (hipblasLtMatmulDescOpaque_t/object) – IN:

Pointer to the structure holding the matrix multiply descriptor to be destroyed by this function. See hipblasLtMatmulDesc_t .

Returns:

A tuple of size 1 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatmulDescDestroy(const hipblasLtMatmulDesc_t matmulDesc)
rocm.bindings.hipblaslt.hipblasLtMatmulDescSetAttribute(matmulDesc, attr, buf, sizeInBytes)#

Set attribute to a matrix multiply descriptor.

This function sets the value of the specified attribute belonging to a previously created matrix multiply descriptor.

Args:
matmulDesc (hipblasLtMatmulDescOpaque_t/object) – IN:

Pointer to the previously created structure holding the matrix multiply descriptor queried by this function. See hipblasLtMatmulDesc_t .

attr (hipblasLtMatmulDescAttributes_t) – IN:

The attribute that will be set by this function. See ref hipblasLtMatmulDescAttributes_t.

buf (Pointer/object) – IN:

The value to which the specified attribute should be set.

sizeInBytes (int) – IN:

Size of the buf buffer (in bytes) for verification.

Returns:

A tuple of size 1 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatmulDescSetAttribute(hipblasLtMatmulDesc_t matmulDesc, hipblasLtMatmulDescAttributes_t attr, const void * buf, size_t sizeInBytes)
rocm.bindings.hipblaslt.hipblasLtMatmulDescGetAttribute(matmulDesc, attr, buf, sizeInBytes)#

Query attribute from a matrix multiply descriptor.

This function returns the value of the queried attribute belonging to a previously created matrix multiply descriptor.

Args:
matmulDesc (hipblasLtMatmulDescOpaque_t/object) – IN:

Pointer to the previously created structure holding the matrix multiply descriptor queried by this function. See hipblasLtMatmulDesc_t .

attr (hipblasLtMatmulDescAttributes_t) – IN:

The attribute that will be retrieved by this function. See hipblasLtMatmulDescAttributes_t .

buf (Pointer/object) – OUT:

Memory address containing the attribute value retrieved by this function.

sizeInBytes (int) – IN:

Size of the buf buffer (in bytes) for verification.

Returns:

A tuple of size 2 that contains (in that order):

  • hipblasStatus_t: One of:
    • HIPBLAS_STATUS_SUCCESS: If the attribute’s value was successfully written to user memory.

    • HIPBLAS_STATUS_INVALID_VALUE: If p sizeInBytes is 0 and sizeWritten is NULL, or if sizeInBytes is non-zero and buf is NULL, or sizeInBytes doesn’t match the size of the internal storage for the selected attribute.

  • int:

    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.

C signature

hipblasStatus_t hipblasLtMatmulDescGetAttribute(hipblasLtMatmulDesc_t matmulDesc, hipblasLtMatmulDescAttributes_t attr, void * buf, size_t sizeInBytes, size_t * sizeWritten)
rocm.bindings.hipblaslt.hipblasLtMatmulPreferenceCreate()#

Create a preference descriptor.

This function creates a matrix multiply heuristic search preferences descriptor by allocating the memory needed to hold its opaque structure.

Returns:

A tuple of size 2 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatmulPreferenceCreate(hipblasLtMatmulPreference_t * pref)
rocm.bindings.hipblaslt.hipblasLtMatmulPreferenceDestroy(pref)#

Destroy a preference descriptor.

This function destroys a previously created matrix multiply preferences descriptor object.

Args:
pref (hipblasLtMatmulPreferenceOpaque_t/object) – IN:

Pointer to the structure holding the matrix multiply preferences descriptor to be destroyed by this function. See ref hipblasLtMatmulPreference_t.

Returns:

A tuple of size 1 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatmulPreferenceDestroy(const hipblasLtMatmulPreference_t pref)
rocm.bindings.hipblaslt.hipblasLtMatmulPreferenceSetAttribute(pref, attr, buf, sizeInBytes)#

Set attribute in a preference descriptor.

This function sets the value of the specified attribute belonging to a previously created matrix multiply preferences descriptor.

Args:
pref (hipblasLtMatmulPreferenceOpaque_t/object) – IN:

Pointer to the previously created structure holding the matrix multiply preferences descriptor queried by this function. See ref hipblasLtMatmulPreference_t.

attr (hipblasLtMatmulPreferenceAttributes_t) – IN:

The attribute that will be set by this function. See ref hipblasLtMatmulPreferenceAttributes_t.

buf (Pointer/object) – IN:

The value to which the specified attribute should be set.

sizeInBytes (int) – IN:

Size of the buf buffer (in bytes) for verification.

Returns:

A tuple of size 1 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatmulPreferenceSetAttribute(hipblasLtMatmulPreference_t pref, hipblasLtMatmulPreferenceAttributes_t attr, const void * buf, size_t sizeInBytes)
rocm.bindings.hipblaslt.hipblasLtMatmulPreferenceGetAttribute(pref, attr, buf, sizeInBytes)#

Query attribute from a preference descriptor.

This function returns the value of the queried attribute belonging to a previously created matrix multiply heuristic search preferences descriptor.

Args:
pref (hipblasLtMatmulPreferenceOpaque_t/object) – IN:

Pointer to the previously created structure holding the matrix multiply heuristic search preferences descriptor queried by this function. See hipblasLtMatmulPreference_t .

attr (hipblasLtMatmulPreferenceAttributes_t) – IN:

The attribute that will be retrieved by this function. See hipblasLtMatmulPreferenceAttributes_t .

buf (Pointer/object) – OUT:

Memory address containing the attribute value retrieved by this function.

sizeInBytes (int) – IN:

Size of the buf buffer (in bytes) for verification.

Returns:

A tuple of size 2 that contains (in that order):

  • hipblasStatus_t: One of:
    • HIPBLAS_STATUS_SUCCESS: If the attribute’s value was successfully written to user memory.

    • HIPBLAS_STATUS_INVALID_VALUE: If p sizeInBytes is 0 and sizeWritten is NULL, or if sizeInBytes is non-zero and buf is NULL, or sizeInBytes doesn’t match the size of the internal storage for the selected attribute.

  • int:

    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.

C signature

hipblasStatus_t hipblasLtMatmulPreferenceGetAttribute(hipblasLtMatmulPreference_t pref, hipblasLtMatmulPreferenceAttributes_t attr, void * buf, size_t sizeInBytes, size_t * sizeWritten)
rocm.bindings.hipblaslt.hipblasLtMatmulAlgoGetHeuristic(handle, matmulDesc, Adesc, Bdesc, Cdesc, Ddesc, pref, requestedAlgoCount, heuristicResultsArray)#

Retrieve the possible algorithms.

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.

Args:
handle (Pointer/object) – IN:

Pointer to the allocated hipBLASLt handle for the hipBLASLt context. See hipblasLtHandle_t .

matmulDesc (hipblasLtMatmulDescOpaque_t/object) – IN:

Handle to a previously created matrix multiplication descriptor of type hipblasLtMatmulDesc_t .

Adesc (hipblasLtMatrixLayoutOpaque_t/object) – IN:

Handles to the previously created matrix layout descriptors of the type hipblasLtMatrixLayout_t .

Bdesc (hipblasLtMatrixLayoutOpaque_t/object) – IN:

Handles to the previously created matrix layout descriptors of the type hipblasLtMatrixLayout_t .

Cdesc (hipblasLtMatrixLayoutOpaque_t/object) – IN:

Handles to the previously created matrix layout descriptors of the type hipblasLtMatrixLayout_t .

Ddesc (hipblasLtMatrixLayoutOpaque_t/object) – IN:

Handles to the previously created matrix layout descriptors of the type hipblasLtMatrixLayout_t .

pref (hipblasLtMatmulPreferenceOpaque_t/object) – IN:

Pointer to the structure holding the heuristic search preferences descriptor. See hipblasLtMatmulPreference_t .

requestedAlgoCount (int) – IN:

Size of the heuristicResultsArray (in elements). This is the requested maximum number of algorithms to return.

heuristicResultsArray (Pointer/object) – OUT:

[] Array containing the algorithm heuristics and associated runtime characteristics returned by this function, in order of increasing estimated compute time.

Returns:

A tuple of size 2 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatmulAlgoGetHeuristic(hipblasLtHandle_t 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)
rocm.bindings.hipblaslt.hipblasLtMatmul(handle, matmulDesc, alpha, A, Adesc, B, Bdesc, beta, C, Cdesc, D, Ddesc, algo, workspace, workspaceSizeInBytes, stream)#

Compute a matrix multiplication on the described inputs.

This function computes the matrix multiplication of matrices A and B to produce the output matrix D, according to the following operation: D = p alpha*( A *B) + beta*( C ), where A, B, and C are input matrices, and alpha and 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.

Args:
handle (Pointer/object) – IN:

Pointer to the allocated hipBLASLt handle for the hipBLASLt context. See hipblasLtHandle_t .

matmulDesc (hipblasLtMatmulDescOpaque_t/object) – IN:

Handle to a previously created matrix multiplication descriptor of type hipblasLtMatmulDesc_t .

alpha (Pointer/object) – IN:

Pointers to the scalars used in the multiplication.

A (Pointer/object) – IN:

Pointers to the GPU memory associated with the corresponding descriptors Adesc, Bdesc, and Cdesc.

Adesc (hipblasLtMatrixLayoutOpaque_t/object) – IN:

Handles to the previously created matrix layout descriptors of the type hipblasLtMatrixLayout_t .

B (Pointer/object) – IN:

Pointers to the GPU memory associated with the corresponding descriptors Adesc, Bdesc, and Cdesc.

Bdesc (hipblasLtMatrixLayoutOpaque_t/object) – IN:

Handles to the previously created matrix layout descriptors of the type hipblasLtMatrixLayout_t .

beta (Pointer/object) – IN:

Pointers to the scalars used in the multiplication.

C (Pointer/object) – IN:

Pointers to the GPU memory associated with the corresponding descriptors Adesc, Bdesc, and Cdesc.

Cdesc (hipblasLtMatrixLayoutOpaque_t/object) – IN:

Handles to the previously created matrix layout descriptors of the type hipblasLtMatrixLayout_t .

D (Pointer/object) – OUT:

Pointer to the GPU memory associated with the descriptor Ddesc.

Ddesc (hipblasLtMatrixLayoutOpaque_t/object) – IN:

Handles to the previously created matrix layout descriptors of the type hipblasLtMatrixLayout_t .

algo (Pointer/object) – IN:

Handle for matrix multiplication algorithm to be used. See hipblasLtMatmulAlgo_t . When NULL, an implicit heuristics query with default search preferences will be performed to determine the actual algorithm to use.

workspace (Pointer/object) – IN:

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

workspaceSizeInBytes (int) – IN:

Size of the workspace.

stream (Pointer/object) – IN:

The HIP stream where all GPU work is submitted.

Returns:

A tuple of size 1 that contains (in that order):

  • hipblasStatus_t: One of:
    • HIPBLAS_STATUS_SUCCESS: If the operation completed successfully.

    • HIPBLAS_STATUS_EXECUTION_FAILED: If HIP reported an execution error from the device.

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

    • HIBLAS_STATUS_NOT_INITIALIZED: If the hipBLASLt handle has not been initialized.

C signature

hipblasStatus_t hipblasLtMatmul(hipblasLtHandle_t 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)
rocm.bindings.hipblaslt.hipblasLtMatrixTransformDescCreate(scaleType)#

Create a new matrix transform operation descriptor.

Args:
scaleType (hipDataType):

(undocumented)

Returns:

A tuple of size 2 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatrixTransformDescCreate(hipblasLtMatrixTransformDesc_t * transformDesc, hipDataType scaleType)
rocm.bindings.hipblaslt.hipblasLtMatrixTransformDescDestroy(transformDesc)#

Destroy a matrix transform operation descriptor.

Args:
transformDesc (hipblasLtMatrixTransformDescOpaque_t/object):

(undocumented)

Returns:

A tuple of size 1 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatrixTransformDescDestroy(hipblasLtMatrixTransformDesc_t transformDesc)
rocm.bindings.hipblaslt.hipblasLtMatrixTransformDescSetAttribute(transformDesc, attr, buf, sizeInBytes)#

Set a matrix transform operation descriptor attribute.

Args:
transformDesc (hipblasLtMatrixTransformDescOpaque_t/object) – IN:

The descriptor.

attr (hipblasLtMatrixTransformDescAttributes_t) – IN:

The attribute.

buf (Pointer/object) – IN:

Memory address containing the new value.

sizeInBytes (int) – IN:

Size of the buf buffer for verification (in bytes).

Returns:

A tuple of size 1 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatrixTransformDescSetAttribute(hipblasLtMatrixTransformDesc_t transformDesc, hipblasLtMatrixTransformDescAttributes_t attr, const void * buf, size_t sizeInBytes)
rocm.bindings.hipblaslt.hipblasLtMatrixTransformDescGetAttribute(transformDesc, attr, buf, sizeInBytes)#

Gets the matrix transform attribute.

Gets the attribute from the matrix transform operation descriptor.

Args:
transformDesc (hipblasLtMatrixTransformDescOpaque_t/object) – IN:

The descriptor.

attr (hipblasLtMatrixTransformDescAttributes_t) – IN:

The attribute.

buf (Pointer/object) – OUT:

Memory address containing the new value.

sizeInBytes (int) – IN:

Size of the buf buffer for verification (in bytes).

Returns:

A tuple of size 2 that contains (in that order):

  • hipblasStatus_t: One of:
    • 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.

    • HIPBLAS_STATUS_SUCCESS: If the attribute’s value was successfully written to user memory.

  • int:

    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.

C signature

hipblasStatus_t hipblasLtMatrixTransformDescGetAttribute(hipblasLtMatrixTransformDesc_t transformDesc, hipblasLtMatrixTransformDescAttributes_t attr, void * buf, size_t sizeInBytes, size_t * sizeWritten)
rocm.bindings.hipblaslt.hipblasLtMatrixTransform(lightHandle, transformDesc, alpha, A, Adesc, beta, B, Bdesc, C, stream)#

Matrix layout conversion helper.

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.

Args:
lightHandle (Pointer/object) – IN:

Pointer to the allocated hipBLASLt handle for the hipBLASLt context. See hipblasLtHandle_t .

transformDesc (hipblasLtMatrixTransformDescOpaque_t/object) – IN:

Pointer to the allocated matrix transform descriptor.

alpha (Pointer/object) – IN:

Pointer to scalar alpha. Pointer to either the host or device address.

A (Pointer/object) – IN:

Pointer to matrix A. Must be a pointer to the device address.

Adesc (hipblasLtMatrixLayoutOpaque_t/object) – IN:

Pointer to the layout for input matrix A.

beta (Pointer/object) – IN:

Pointer to scalar beta. Pointer to either the host or device address.

B (Pointer/object) – IN:

Pointer to the layout for matrix B. Must be a pointer to the device address.

Bdesc (hipblasLtMatrixLayoutOpaque_t/object) – IN:

Pointer to the layout for input matrix B.

C (Pointer/object) – IN:

Pointer to matrix C. Must be a pointer to the device address.

stream (Pointer/object) – IN:

The HIP stream where all the GPU work will be submitted.

Returns:

A tuple of size 2 that contains (in that order):

C signature

hipblasStatus_t hipblasLtMatrixTransform(hipblasLtHandle_t 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)