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

Beyond FLOPs: memory, bandwidth and communication cost

Watch FLOPs, memory, bandwidth and messages each cost time, and see which sets the pace.


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 · 3.14 · COST BAY128 FLOP · 16 NS OF COMPUTE
01
Stage 1 of 6 · Count the FLOPs
Each entry of C needs 4 multiplies and 4 adds. The 16 entries cost 128 FLOPs.
Explain it simply

A FLOP is one step of arithmetic, like one multiply or one add. For one entry of C, the chip walks along a row of A and down a column of B. That's 4 multiplies and 4 adds, and C has 16 entries. So the work is 128 FLOPs, or 16 nanoseconds at 8 FLOPs per nanosecond.

A and B are 4 × 4 matrices. C needs 16 entries of 8 FLOPs each: 128 FLOPs, 16 ns of compute.

A, B and words movedC and compute timechip resource, tilewaiting timefree fast memory
matricesone devicetime · nscost · grows as · this run12042110000101040420133423014404844279323883121216432A 4 × 4B 4 × 4C = A·B·C[0][0]: 4 mult + 4 add = 8 FLOP16 entries × 8 = 128 FLOPcompute unit8 FLOP/ns128 FLOP → 16 nscompute010203016compute2n³128 FLOPmatricesone devicetime · nscost · grows as · this run12042110000101040420133423014404844279323883121216432A 4 × 4B 4 × 4C = A·B·C[0][0]: 4 mult + 4 add = 8 FLOP16 entries × 8 = 128 FLOPcompute unit8 FLOP/ns128 FLOP → 16 nscompute010203016compute2n³128 FLOP
Toy: float32 C = A·B · chip 8 FLOP/ns, fast memory 48 words, 16 B/ns · link 8 B/ns + 2 ns
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
F=2 n3\sy{F}{out}{F} = 2\,\sy{n}{data}{n}^3
F=2×43=128 FLOP;128/8=16 nsF = 2 \times 4^3 = 128\ \text{FLOP};\quad 128 / 8 = 16\ \text{ns}

The work grows with the cube of the matrix size.

Common mix-ups

MYTHTwo loops with the same FLOPs take the same time.

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

Predict, then reveal
3 CHECKS · PRO
Q01If the matrix size doubles, how many times more FLOPs does C cost?

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.