In this article
Validate cuBLASLt query count, candidate state and workspace requirements against the actual descriptors and available device buffer.
A cuBLASLt integration requests an algorithm and immediately launches the first result, despite a changed workspace budget and no usable candidate. Treat heuristic discovery as a checked selection step. The returned array is conditional on descriptors, preferences and candidate status; a successful query is not a measured guarantee that an arbitrary first entry will run correctly.
Preserve the complete problem
Record operation and matrix descriptors, data and compute types, transformations, leading dimensions, epilogue and relevant pointer alignment. A logical matrix shape alone is an incomplete selection identity. Reusing a candidate after changing a descriptor requires the documented compatibility check or a fresh selection, rather than assuming that the same multiplication dimensions preserve every implementation constraint.
Set a real workspace budget
CUBLASLT_MATMUL_PREF_MAX_WORKSPACE_BYTES limits allowed scratch storage during search. Match it to an actual device allocation that the operation may use. A preference does not allocate the buffer. A candidate found with a generous budget cannot simply be launched with less storage because the service later needs more memory for another model component.
Inspect all result boundaries
Check the query status, returnAlgoCount and each considered result’s state before reading its algorithm and workspace requirement. The API defines other result fields as valid only for successful candidate state. An initialized output structure is not evidence that a candidate was returned. Preserve unsupported selection as a diagnosed condition with a valid fallback, not an unexamined launch attempt.
Treat ranking as an estimate
The API returns candidates in estimated compute-time order. That estimate is not an application benchmark. Test valid candidates with representative data, checked results and the actual stream and memory contract. Account for selection overhead separately from repeated execution. The official sample illustrates descriptor setup, budget propagation and an empty-result check; it is a starting contract, not a universal tuning result.
Cache with compatible conditions
If discovery is reused, retain the conditions that made the selection valid, including the library and target environment. Invalidate stale application records when those conditions change. Acceptance means a supported candidate executes correctly within the real budget. It does not prove the best possible algorithm for every shape or authorize silently changing numerical semantics to obtain a faster candidate.
Primary references
NVIDIA cuBLAS and cuBLASLt API Reference.
NVIDIA cuBLASLt Matrix Multiplication Sample.
CUDA Runtime Memory Management.
Related reading: Tensor Core fragments: distributing a matrix operation across threads; Reproducible inference stacks: preserving a GPU pilot’s result.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.