Log inStart free
LESSON 27.13 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Tensor Core MMA and accumulation precision

Watch Tensor Cores multiply tiles and see which formats keep the answer.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 27.13 · TENSOR CORESFP16 · 1 MMA · 8,192 FLOPS IN 8 NS
01
Stage 1 of 6 · One MMA
One Tensor Core MMA multiplies a 16 × 16 tile by a 16 × 16 tile. It adds the result into C.
Explain it simply

The outlined tiles of A and B go into one Tensor Core instruction, an MMA, a matrix multiply and add. It does 8,192 FLOPs in 8 nanoseconds on one SM. The same work takes the CUDA cores 64 nanoseconds.

A 16 by 16 tile of A and a 16 by 16 tile of B are outlined. One MMA adds their product into the top-left 16 by 16 tile of C in 8 ns.

weights A, exponent bitsinputs B, value bits, memory timeoutputs C, math timerounding errorCUDA-core time, exact sum, unused bits
one MMAA (64 × 64)B (64 × 64)C (64 × 64, FP32)·=one MMA: D = A · B + Ctile 16 × 16 × k, k = 168,192 FLOPs in 8 nsA tile 512 B, B tile 512 BC tile stays in registerstime for 8,192 FLOPs on one SMTensor Cores: one MMA8 nsCUDA cores: 128 FLOPs per ns64 ns8 times faster: every MMA reads 512 B of A and 512 B of Bone MMAA (64 × 64)B (64 × 64)C (64 × 64, FP32)·=one MMA: D = A · B + Ctile 16 × 16 × k, k = 168,192 FLOPs in 8 nsA tile 512 B, B tile 512 BC tile stays in registerstime for 8,192 FLOPs on one SMTensor Cores: one MMA8 nsCUDA cores: 128 FLOPs per ns64 ns8 times faster: every MMA reads 512 B of A and 512 B of B
Toy: the 27.C2 matmul, 64 × 64 eighths, on a toy GPU with 4 SMs
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
D=A16×k Bk×16+C\sy{c}{out}{D} = \sy{a}{param}{A_{16\times k}}\,\sy{b}{data}{B_{k\times 16}} + \sy{c}{out}{C}
2⋅16⋅16⋅16=8,192 FLOPs in 8,192/1,024=8 ns2 \cdot 16 \cdot 16 \cdot 16 = 8{,}192\text{ FLOPs in } 8{,}192 / 1{,}024 = 8\text{ ns}

One MMA multiplies two tiles and adds into the C tile.

Common mix-ups

MYTHFP16 inputs mean the whole matmul runs in FP16.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With FP16 inputs at K = 4,096, does an FP16 accumulator keep C[0][0] at −213?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.