AI Hardware & Software Stack

How many floating-point operations (counting multiplies and adds separately) does multiplying an M × K matrix by a K × N matrix take, roughly?

  1. AMNK
  2. BM + N + K
  3. C2MNK
Show answer and explanation

Answer: C. 2MNK

The result has M × N elements, each an inner product of length K requiring K multiplications and about K additions, about 2MNK operations in all. AI workloads are often estimated with this formula, and performance is expressed in operations per second (FLOPS). Counting a multiply-add as one operation halves it to MNK, so it matters which convention is used.

  • A. That counts each multiply-add as one.
  • B. The operation count is far larger.
  • C. Correct. Each element needs K multiplies and adds.