6.1.11 · D1Parallelism & Multicore

Foundations — Vector - SIMD instructions (SSE, AVX, NEON)

1,695 words8 min readBack to topic

This page is the workshop bench. Before you can read the parent note Vector - SIMD instructions (SSE, AVX, NEON), you need to feel every symbol it throws at you. We build each one from nothing: plain words → a picture → why the topic can't live without it.


1. A "bit" and a "byte" — the atoms of everything

Why start here? Because every "register width" the parent brags about — 128-bit, 256-bit, 512-bit — is just how many switches sit in a row. If you don't picture the row of switches, "256-bit register" is a spell, not a fact.

Look at the red byte in the figure: 8 switches, and the pattern shown reads as the number 20. That single number will later be "the brightness we add to a pixel."

Recall Why 8 bits gives 256 values

Each bit doubles the count of patterns. 1 bit → 2 patterns, 2 bits → 4, ... 8 bits → . ✅


2. A "register" — the CPU's tiny desk

Picture a whiteboard the CPU writes one number on, erases, writes the next. A scalar register holds exactly one number.

The whole trick of SIMD is: make the whiteboard so wide it holds a whole row of numbers, and let one command act on the entire row.


3. A "lane" — one slot in the wide desk

Why the topic needs this word: the parent says "operates on all lanes." That is the entire SIMD promise. One instruction fires the starting pistol; all four runners step forward together.


4. "Float", "double", "8-bit int" — what kind of number sits in a lane

Why it matters: the format decides how many lanes fit. Same 128-bit box, different tenants:

Box width Lane size Lanes ()
128 bits 32-bit float 4
128 bits 64-bit double 2
128 bits 8-bit uint 16

Read across: a narrower number means more lanes means bigger speed-up. That single table explains why image code (8-bit pixels) gets 16× while double-precision science gets only 2×.


5. "Packed" and "contiguous" — how the row gets loaded

Why the topic needs this: SIMD's single grab (movaps) works only if the data is already in a neat row. Scattered data must be gathered first, which is slow. This is the seed of Cache Optimization and Loop Vectorization — arrange your data as a row and the hardware rewards you.


6. Sigma — "add up a whole list"

Why the topic needs it: this exact expression is the dot product in Example 2. When the parent multiplies lane-by-lane and then "horizontally sums," it is literally computing this . Meet the symbol before it ambushes you.

Recall What does the

under and over sigma mean? Bottom = where the counter starts, top = where it stops. It says "do this for every from start to stop and add the results." ✅


7. Ceiling — "always round up"

Why the topic needs it: if you have 10 numbers but lanes come in groups of 8, you need 2 instructions — the second one still fires even though it only carries 2 real numbers. You can't do "1.25 instructions." The ceiling captures that leftover-group truth, and it's exactly why the parent warns about loop remainders.


8. Speed-up — the payoff number

Now every piece of the parent's boxed result is a symbol you have already met: is time, is lane count from §3, and the ceiling from §7 is why it's approximately and not exactly .


9. Same-instruction rule — the golden constraint

This constraint places SIMD inside Flynn's Taxonomy as the SIMD class (one instruction stream, many data streams), and makes it the hardware engine behind Data Paralelism.


Prerequisite map

Bit and byte

Register width

Lanes

Number formats float double uint8

Packed contiguous load

Lane count w

Speedup S approx w

Ceiling round up

Sum symbol

Dot product example

SIMD instructions topic

Same instruction rule

Everything on the left is a plain picture; everything flows right into the parent topic. If any left-hand box is fuzzy, re-read that section before moving on. This map also shows the on-ramps to Loop Vectorization, Auto-vectorization, and Instruction-Level Parallelism — all of which reuse these same atoms.


Equipment checklist

Cover the right side and answer out loud; reveal to check.

What is a byte, in switches?
A bundle of 8 bits, holding one of patterns.
What is a register?
The CPU's fastest tiny storage box, holding the numbers it works on right now, with a width in bits.
What is a lane?
One equal slice of a wide register; each lane holds one independent number.
How many 32-bit float lanes fit in a 128-bit register?
lanes.
How many 8-bit lanes fit in 128 bits?
lanes.
What does "packed / contiguous" mean?
Numbers sit next to each other in memory and get loaded in one grab.
Read in words.
Add ; the counter walks from 0 to 3.
What does equal and why?
2, because a leftover partial group still needs a whole instruction.
What does measure and what is its ideal value?
How many times faster SIMD is; ideally , the lane count.
Why can't SIMD run an if/else per element?
One instruction drives all lanes at once — every lane must do the identical operation.

Next stop: Vector - SIMD instructions (SSE, AVX, NEON) — you now own every symbol it uses.