Back to blog
ai-engineering

MI250X GEMM: a 128-byte offset beats hipBLASLt on 8 shapes

A hand-scheduled FP16 GEMM on AMD MI250X beats AMD's hipBLASLt by 1-9%. Placing matrix B 128 bytes off A made it win on all 8 shapes, in 256 of 256 reads.

HA

November 8, 2026

5 min read

MI250X GEMM: a 128-byte offset beats hipBLASLt on 8 shapes

In short: matrix multiplication is the basic arithmetic behind every AI model, and AMD's hipBLASLt library is the standard way to do it on AMD GPUs. Our hand-tuned version is 1–9% faster on large sizes. We also found something surprising: where the data sits in memory decides whether we win. Shifting one of the two matrices by 128 bytes made our version faster on all 8 sizes we tested, every single time.

On AMD's Instinct MI250X, a hand-scheduled FP16 matrix multiplication launched through TileLang beats AMD's hipBLASLt by 1–9% on large shapes at the power cap (job medians). And one detail decides whether it wins reliably: where the second matrix sits in memory. With B placed at an address offset of exactly 128 bytes (mod 256) from A, our kernel was faster than hipBLASLt on all 8 tested shapes, in 256 of 256 reads, at 1.008–1.104× per read.

Setup: LUMI-G (AMD MI250X, gfx90a), FP16 inputs, random data, our kernel and hipBLASLt timed in the same process; the placement results ran in a C++ harness with a direct hipBLASLt call, on all 8 GCDs of a node at the 500 W power cap, 2 jobs on 2 nodes, 16 reads per shape and job, with an earlier 128×256 tile, November 2026. Ratios are our throughput over hipBLASLt's, so above 1.0 means we are faster.

FP16 GEMM throughput ratio, ours ÷ hipBLASLt
ShapeB placed at A − B = 128 mod 256Unplaced
4096³1.078–1.0891.055
8192³1.068–1.0701.030–1.036
12288³1.0571.042–1.044
16384³1.045–1.0471.016
6144³1.016–1.0230.998–1.005
4096×17408×51201.0571.045–1.049
32768×1024×20481.089–1.0931.057–1.059
16384×4096×40961.056–1.0601.035–1.038

MI250X on LUMI, 8 GCDs at the 500 W cap, 2 nodes, FP16, C++ harness, 128×256 tile. Marks show the range across the 2 job medians.

What the hand schedule changed

Compiled TileLang reads about 0.83–1.08× hipBLASLt on random data, mostly behind. Making GPU occupancy controllable from TileLang lifted 8192³ from about 53 to 101–103 TFLOPS, but that was not enough. The schedule that wins is written by hand and launched through TileLang. Three changes moved it most:

  • A wider row stride in shared memory (LDS): 128 bytes gave 107 TFLOPS, 144 bytes 117, 160 bytes 120. We think this avoids bank conflicts, but we have not traced it.
  • Memory operations placed between matrix-core (MFMA) instructions instead of in bursts: +13.8%, in two jobs.
  • A tile-choice rule with factors fitted to about 30 shapes, plus fixed size floors below which hipBLASLt runs instead.

Through our real benchmark script at the power cap, median of 16 reads on 8 GCDs: 3072³ 1.016×, 6144³ 1.063× and 12288³ 1.075× with B placed; 1.005×, 1.054× and 1.069× without (one job, with a newer 256×192 tile; at 3072³ unplaced, 3 of 16 reads fell below 1, range 0.997–1.018).

The 128-byte effect

Our kernel had two speeds on the same shape, a fast one and one a few percent slower, and it switched between them when we reallocated A or B, never C. hipBLASLt stayed flat. Shifting B so that A − B is exactly 128 mod 256 bytes put our kernel in the fast mode at every read so far. Other offsets with that bit set (144, 160, 192, 224, 240) did not; at 16384³ some other shifts (256 bytes, 8–24 KiB) helped partly, and 128 helped most.

  • 16384³: 1.045–1.047× placed, 1.016× unplaced (some reads down to 0.966×)
  • 8192³: 1.068–1.070× placed, 1.030–1.036× unplaced
  • 4096³: 1.078–1.089× placed, 1.055× unplaced
  • 32768×1024×2048: 1.089–1.093× placed, 1.057–1.059× unplaced

In all 816 reads without a shift, A and B were 2 MiB aligned, so plain tensors did not land on the favourable offset. We infer that the switching comes from higher address bits, but we did not read physical addresses. Why the hardware cares is still open.

When it pays off

Placing B costs a copy: 0.92 ms at 16384³, about 1.3% of the multiplication there, and relatively more at smaller sizes. Copying on every call costs more than placement gains at 4096³ (1.029× against 1.055× unplaced) and drops 6144³ below hipBLASLt (0.986×); both copy costs are extrapolated from 16384³. The gain is real only when B lives long, as model weights do, or is allocated placed from the start.

Limits

  • This is hand-written assembly, not compiler output. Compiled TileLang stays mostly behind hipBLASLt, and placement does not rescue it.
  • Three shapes stay below hipBLASLt even with B placed (one GCD, 2 jobs): 7168×3584×4096 (0.951–0.987×), 2816³ (0.968–0.998×) and 1024×7680×2048 (0.979–0.997×).
  • Below 1536×1536 or with a short side under 1024, the rule hands the call to hipBLASLt (our older tile read 0.56–0.60× at 1024³). A newer small tile now wins at 1536³ and 2048³ (1.03–1.07×, one GCD).
  • hipBLASLt runs at a lower clock (1028–1145 MHz against our 1094–1251 MHz) but uses more of its clock-limited peak (about 91–93% against 85% at 8192³). We did not measure energy, so these results compare throughput only.

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

Sources

Tags

gpu-kernelsllm-opsperformance
HA

About the author

Hamza Abdagić

View profile