MI250X fp16 matrix multiply returns zero below 6.1e-5
On AMD MI250X, a 16-bit matrix multiply returns zero for inputs below 6.1e-5. The test, the measured numbers, where it matters for LLMs and how to avoid it.
Publisher
November 11, 2026
5 min read
On AMD's Instinct MI250X, a 16-bit floating-point matrix multiply returns exactly zero for input values smaller than about 6.1e-5. We measured this in November 2026 on LUMI-G, in AMD's own BLAS library and in a kernel we wrote ourselves. This post shows the test, the numbers, where it matters for language models, and two ways to avoid it.
The measurement
16-bit floats (fp16, or half precision) can store numbers down to about 6e-8. The numbers below 6.1e-5 are stored in a special reduced-precision form called subnormal. They are valid numbers, and a CPU or a plain GPU operation handles them normally.
The test is as small as we could make it. Take a row that holds 4,096 copies of one value x. Multiply it by a matrix of ones. The exact answer is 4,096 times x. Pick a value in the figure.
| x | 16-bit class | exact, 4,096 x | AMD library, 16-bit | our kernel, 16-bit | AMD library, bf16 |
|---|---|---|---|---|---|
| 1e-3 | normal | 4.0977 | 4.0977 | 4.0977 | 4.0938 |
| 1e-4 | normal | 0.40967 | 0.40967 | 0.40967 | 0.41016 |
| 6.2e-5 | normal | 0.25391 | 0.25391 | 0.25391 | 0.25391 |
| 3e-5 | subnormal | 0.12280 | 0 | 0 | 0.12305 |
| 1e-5 | subnormal | 0.04102 | 0 | 0 | 0.04102 |
| 1e-6 | subnormal | 0.00415 | 0 | 0 | 0.00409 |
For 6.2e-5 and above, every path returns the exact answer. For 3e-5, 1e-5 and 1e-6 both 16-bit paths return exactly 0. Three things narrow down where it happens:
- The conversion to 16-bit keeps the value. Reading the 16-bit tensor back from the GPU gives 2.998e-5 for 3e-5, as it should.
- AMD's library and our kernel agree. PyTorch's
F.linear, which calls hipBLASLt, and our hand-written kernel both return zero. Both use the GPU's 16-bit matrix instruction, so the behaviour belongs to that instruction and not to one library. - bf16 is not affected. The same product with bf16 operands returns the right answer for all six values.
A short form of the test, which you can run on any GPU:
import torch, torch.nn.functional as F
K = 4096
w = torch.ones(K, K, device="cuda", dtype=torch.float16)
for x in (1e-3, 1e-4, 6.2e-5, 3e-5, 1e-5, 1e-6):
a = torch.full((1, K), x, device="cuda").to(torch.float16)
print(x, "got", float(F.linear(a, w)[0, 0]), "exact", K * float(a[0, 0]))
The full script and its recorded output are in the repository linked below.
Where it matters: attention on long prompts
Most values in a neural network are nowhere near 6.1e-5, so most 16-bit matrix multiplies never meet this. Attention is the exception. Each token spreads its attention over all earlier tokens, and on a long prompt many of those weights are tiny. In prompts of 3,000 to 6,000 tokens served by a real model, 0.2 to 0.6% of a row's total attention weight sat below the line, and up to 8% in single rows.
We captured the inputs of 12 attention calls from a running server and recomputed each one in 64-bit, changing one thing at a time.
An interactive figure. Recomputing 12 captured attention calls in 64-bit with weights below 6.1e-5 set to zero gives a relative error of 0.25 to 1.09%. Keeping those weights gives 0.002 to 0.005%.
Rounding the weights to 16-bit while keeping the small ones costs almost nothing, 0.002 to 0.005%. Setting the small ones to zero, as the GPU's instruction does, costs 0.25 to 1.09%, and it reproduced the error of our 16-bit attention kernel on all 12 calls. Random test inputs put no weight below the line, so only inputs captured from a real server show the effect.
Two ways to avoid it
- Use bf16 for the product. bf16 has no subnormal numbers anywhere near this range, and the GPU has a bf16 matrix instruction.
- Stay in fp16 and scale first. Multiply the attention weights by 1,024 before converting them to 16-bit. That moves the line from 6.1e-5 down to about 6e-8 of the largest weight. The row sum is built from the same scaled weights, so the factor cancels in the result.
We took the second route in our prefill attention kernel. On the 12 captured calls its error is 0.165 to 0.172%, the same level as vLLM's own kernel (0.162 to 0.172%), where the unscaled kernel read 0.30 to 1.09%. The scaled kernel costs 0 to 3.4% more kernel time, and inside the served model time to first token is unchanged: 0.873 and 0.872 of stock vLLM at 14.2k tokens, against 0.872 and 0.870 before.
What we know and do not know
- Measured: one MI250X GPU (the chip family called gfx90a) on LUMI-G, six values, one job on 11 November 2026.
- Any fp16 matrix product on this GPU will ignore operand values below 6.1e-5. We have measured the effect in attention only. For other kernels it follows from the test but is not measured.
- We have not tested other AMD GPUs, and we have not looked for a setting that changes the behaviour.
- Our decode attention kernel keeps its weights in bf16, so it does not meet this.
We acknowledge the EuroHPC Joint Undertaking for awarding this project access to the EuroHPC supercomputer LUMI, hosted by CSC (Finland) and the LUMI consortium, through a EuroHPC Development Access call (EHPC-DEV-2026D11-419).