﻿# cuBLASLt bias follows logical output rows, not a framework channel name

Map cuBLASLt bias epilogues to output matrix rows, distinguish storage order from axis meaning, and verify fusion against an unfused reference.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-cublaslt-bias-epilogue-logical-row-axis/
Language: en

## A fused projection adds bias along the wrong axis

Consider replacing a framework projection and bias addition with a cuBLASLt epilogue. The multiplication may match the reference while the fused output does not. If batch and feature dimensions happen to have equal sizes, an incorrectly interpreted bias axis can survive a shape check.

The [cuBLASLt reference](https://docs.nvidia.com/cuda/cublas/index.html) defines the ordinary bias epilogue using the logical rows of output matrix D. Begin with that matrix definition rather than a framework label such as channel.

## Logical axes survive storage choices

For the documented bias epilogue, a packed bias vector matches D rows and broadcasts across columns. This is a statement about matrix coordinates. Row-major storage, transposition flags, and a reformulation of the multiplication must be traced separately.

If an adapter represents the transposed framework result, the correspondence between a D row and an application feature changes. Write that correspondence explicitly before allocating or selecting the bias vector. Reusing an existing pointer because its length fits is not enough.

## Inspect descriptor construction

The official [single-precision wrapper](https://raw.githubusercontent.com/NVIDIA/CUDALibrarySamples/master/cuBLASLt/LtSgemm/sample_cublasLt_LtSgemm.cu) illustrates operation transforms and matrix layout descriptors. Use that structure to inventory dimensions and leading dimensions; the wrapper itself is not a bias-fusion example.

The [mixed-type wrapper](https://raw.githubusercontent.com/NVIDIA/CUDALibrarySamples/master/cuBLASLt/LtFp8Matmul/sample_cublasLt_LtFp8Matmul.cu) additionally keeps C and D descriptors distinct. That distinction matters when reasoning about a postprocessing operation on D rather than assuming every matrix shares an identical interpretation.

## Support and meaning are separate checks

Consult the current support tables for the exact epilogue, storage order, data types, and batching mode. A mathematically meaningful broadcast does not guarantee support for every descriptor combination. Conversely, successful algorithm selection does not certify that the application chose the intended axis.

The [tensor-axis guide](/journal/tensor-axes-batch-sequence-hidden/) helps translate application dimensions into matrix coordinates. Keep bias data type and lifetime explicit alongside its axis; neither follows from the pointer spelling.

## Design a reference that exposes the error

Use unequal matrix dimensions and a bias pattern that varies by the intended feature. Compare the multiplication first, then the separately applied bias, and finally the fused operation. Constant bias hides axis mistakes, while square shapes can hide length mismatches.

Apply the [benchmark method](/journal/inference-benchmark-method/) only after these comparisons. Reduced kernel count is a possible consequence of fusion, not evidence of correct broadcasting or a measured speedup on an unspecified GPU.
