6.2.12 · D1GPU Architecture

Foundations — Tensor cores and matrix operations

2,779 words13 min readBack to topic

Before you can read the parent note, you must own every symbol it throws at you. We build them here in order, each one leaning on the one before. Nothing is assumed.


1. A number is just a value — but how many bits?

The parent note keeps saying FP16, FP32, INT8, TF32. These are formats — recipes for storing one number using a fixed number of on/off switches (bits).

Figure — Tensor cores and matrix operations

Look at the figure. Each bar is one number's "budget" of bits, split into three jobs:

  • The sign bit (slate, always exactly 1 bit) decides positive or negative: means , means . This is how every floating-point format stores a negative value — one dedicated switch at the very front.
  • Exponent bits (lavender) decide how big or small the number can get — the range.
  • Mantissa bits (mint) decide how many decimal places of detail — the precision.

Before the table, meet two of its entries properly:

Format Layout (sign · exp · mantissa) Total bits What it buys
FP32 1 · 8 · 23 32 full range + full detail (the safe default)
FP16 1 · 5 · 10 16 half the memory, small range
BF16 1 · 8 · 7 16 FP32's range, coarse detail
TF32 1 · 8 · 10 (internal, 19) 19 FP32 range, FP16-ish detail
INT8 1 sign · 7 value (two's-complement) 8 whole numbers , 4× smaller than FP32

Keep this in your pocket — it powers the whole "Precision Modes" section of the parent, and links to 8.3.4-Mixed-precision-training and 8.4.2-Quantization-techniques.


2. A matrix is a grid of numbers

The parent writes A, B, C, D and calls them "4×4 tiles" or "1024×1024 matrices". A matrix is simply a rectangle of numbers arranged in rows and columns.

Figure — Tensor cores and matrix operations

In the figure, follow the red pointer to — row (second row down), column (third column across). One symbol, one cell. Once this clicks, C[i][j] in the parent is no longer scary — it is just "one cell of the output grid."


3. Matrix multiplication: the dot product in disguise

This is the heart of everything. The parent's central formula is

We must earn every symbol in it.

3a. The multiply-add (this is what a core does)

3b. The summation symbol

Worked tiny example: . That is all ever does.

3c. Now the whole formula, in pictures

Figure — Tensor cores and matrix operations

Read the formula out loud now: " equals the sum, as goes from to , of -in-row--column- times -in-row--column-." Every symbol is now a thing you can point at in the picture.


4. From one cell to a whole tile: D = A×B + C

The parent's Tensor Core operation is where all four are small grids.

4a. When the sizes don't divide evenly

The tiled loops in the parent step forward (or ) at a time. But what if , which is not a multiple of ? The last chunk would run off the edge of the matrix.

Figure — Tensor cores and matrix operations

5. Where the work lives: SM, warp, thread

The parent says a warp of 32 threads cooperates, split into groups. Two hardware words to define.

Numbers must also travel from slow memory to these engines — that path is the 6.2.8-Memory-hierarchy-in-GPUs, and it is why FP16's smaller size (section 1) matters for speed.


6. Counting speed: FLOP, FLOPS, throughput

This is the vocabulary of the parent's performance math and of the 9.1.5-Roofline-model. Quick self-check on the parent's own numbers: FMAs, and tile-ops, giving the ratio . Every piece of that is now a symbol you own.


Prerequisite map

Bits sign exp mantissa

Mixed precision FP16 FP32 INT8

Matrix as a grid

Matrix multiply

Indexing A i j

Row major vs column major

Summation symbol

Fused multiply add

Tile multiply accumulate D equals AB plus C

Partial tiles and padding

Thread warp SM

Cooperative fragment execution

Tensor Cores and matrix operations

FLOP and FLOPS

Everything above flows into the parent topic 6.2.12 Tensor cores and matrix operations (Hinglish) and its companions 7.3.6-cuBLAS-and-cuDNN and 8.3.4-Mixed-precision-training.


Equipment checklist

Cover the right side and test yourself. If any answer surprises you, re-read its section.

What is a bit, and what do the sign, exponent, and mantissa bits each control?
A bit is one on/off switch; the sign bit sets positive/negative, exponent bits set the range, mantissa bits set the precision.
How does a floating-point format store a negative number?
With a dedicated sign bit at the front — means , means .
What is BF16's layout and why is it good for training?
1 sign + 8 exponent + 7 mantissa; it copies FP32's exponent so it reaches the same wide range, trading detail for range — ideal for gradients.
What range does INT8 cover and how are negatives stored?
to , using 1 sign bit + 7 value bits in two's-complement.
What does the shape mean for a matrix?
rows going down, columns going across.
What number does refer to (0-indexed)?
The entry in the second row, third column.
What is the difference between row-major and column-major storage?
Row-major lays out row 0 then row 1 (entry at ); column-major lays out column 0 then column 1 (entry at ).
In words, what does tell you to do?
Let step through to , compute the term for each, and add them.
What is an FMA, and how many FLOPs is it?
A fused multiply-add, ; it counts as 2 FLOPs.
Write the formula for one output cell .
.
Why must the inner dimension of and match?
It is the length of the row and column you slide along together; unmatched lengths cannot be paired.
In , what job does do?
It is the accumulator — it holds the running total so partial products can be added on.
Which properties actually make tiling correct?
Associativity of addition and distributivity of scalar multiplication over the -sum — not matrix-multiply associativity, and matrix multiply is not commutative.
What is a partial tile and how is it handled?
An edge tile only partly filled with real data; you pad the missing cells with (which contribute nothing) and ignore the extra output rows/columns.
Why do dimensions that are multiples of 8 or 16 run fastest?
They avoid partial tiles, so no hardware cycles are wasted on padded arithmetic.
What is the difference between FLOP and FLOPS?
FLOP is one operation (a job); FLOPS is operations per second (a rate).
Why do smaller formats like FP16 make Tensor Cores faster?
Fewer bits means more numbers fit on the chip and move through memory faster, while a wide FP32 accumulator preserves accuracy.
Recall Quick fire — the summation drill

Compute . ::: . For matrices, how many FMAs to compute ? ::: .