muBLASLt API Reference
This document describes the muBLASLt APIs supported in MUSA SDK 5.2. It starts with the muBLASLt programming model, then documents the supported matrix multiplication and descriptor APIs.
1. Introduction
1.1 What Is muBLASLt
muBLASLt is the lightweight matrix multiplication extension library for muBLAS. It provides descriptor-based matrix multiplication APIs that let applications describe operation attributes, matrix layouts, algorithm choices, workspace, stream execution, and floating-point emulation settings.
1.2 Document Scope in MUSA SDK 5.2
This reference describes the muBLASLt APIs supported in MUSA SDK 5.2. Use it as the compatibility reference for the functions, types, descriptor attributes, and status values documented here.
Note: Some muBLASLt declarations may appear in
mublasLt.hbut are not described in this reference. These declarations are experimental in MUSA SDK 5.2 and are provided for reference only.
1.3 Supported API Groups
| API group | Scoped APIs |
|---|---|
| Matrix multiplication | mublasLtMatmul |
| Matmul descriptor attributes | mublasLtMatmulDescSetAttribute |
| Floating-point emulation descriptors | mublasLtEmulationDescInit_internal, mublasLtEmulationDescCreate, mublasLtEmulationDescDestroy, mublasLtEmulationDescSetAttribute, mublasLtEmulationDescGetAttribute |
1.4 How to Use This Document
Start with Chapter 2 for the descriptor-based usage model. Use Chapter 3 to check status values, datatypes, descriptor attributes, function signatures, parameter lists, return values, and supported API entries.
2. Using the muBLASLt API
2.1 Matmul Operation Model
mublasLtMatmul computes:
D = alpha * op(A) * op(B) + beta * C
The operation is configured by the function arguments and the supplied descriptors. The computeDesc argument describes operation-level attributes such as transpose mode, scaling behavior, epilogue behavior, and optional emulation configuration. The Adesc, Bdesc, Cdesc, and Ddesc arguments describe the memory layout of each matrix operand.
The scalar arguments alpha and beta are passed as pointers. Their interpretation depends on descriptor settings such as scale type and pointer mode. The matrix arguments A, B, C, and D point to the input and output matrix data used by the operation.
The algo, workspace, and workspaceSizeInBytes arguments describe the algorithm configuration and available temporary storage. If the configured algorithm requires more workspace than workspaceSizeInBytes provides, mublasLtMatmul returns MUBLAS_STATUS_INVALID_VALUE.
2.2 Descriptor Attribute Model
muBLASLt uses descriptors to separate operation configuration from execution. Attribute setter APIs use the same basic pattern:
- Select a descriptor attribute enum value.
- Store the new attribute value in a buffer.
- Pass the buffer pointer and the exact value size in bytes.
- Check the returned
mublasStatus_t.
mublasLtMatmulDescSetAttribute sets attributes on a matmul operation descriptor. mublasLtEmulationDescSetAttribute and mublasLtEmulationDescGetAttribute set and query attributes on a floating-point emulation descriptor.
For setter APIs, buf must point to the new value and sizeInBytes must match the internal storage size for the selected attribute. For getter APIs, buf receives the attribute value. If sizeInBytes is 0, sizeWritten can be used to query the number of bytes required for the full value.
2.3 Floating-Point Emulation Descriptor
The emulation descriptor stores floating-point emulation settings that can be attached to a matmul descriptor through MUBLASLT_MATMUL_DESC_EMULATION_DESCRIPTOR.
Use mublasLtEmulationDescInit_internal to initialize an emulation descriptor in caller-provided storage when the storage lifetime is managed outside the library. The current header also defines the inline convenience wrapper mublasLtEmulationDescInit, which forwards sizeof(*emulationDesc) to mublasLtEmulationDescInit_internal.
Use mublasLtEmulationDescCreate to allocate a descriptor through the library, and release that descriptor with mublasLtEmulationDescDestroy when it is no longer needed. Use the set and get attribute APIs to configure or query the emulation strategy, special-values behavior, and fixed-point mantissa controls.
2.4 Stream Usage
mublasLtMatmul takes a musaStream_t argument. The stream identifies where the matrix multiplication work is issued. Keep the stream, workspace, descriptors, and data buffers valid for the duration of the queued operation.
2.5 Error Handling
The supported muBLASLt APIs return mublasStatus_t. Check the return value after each call, especially for descriptor creation, attribute updates, and matrix multiplication calls that depend on descriptor compatibility, workspace size, and device support.
For status values used by the supported APIs, see 3.1 Return Value mublasStatus_t.
3. API Reference
This chapter describes muBLASLt status values, datatypes, descriptor attributes, and library functions. Function entries include signatures, parameters, return values, and descriptions derived from public header comments. APIs that may appear in public headers but are not documented here should be treated as experimental and for reference only in this release.