What is SIMD?

Short for single instruction, multiple data: one instruction performs the same operation on several data elements at once. It speeds up image processing and AI calculations.

Field: CPUs and architecture

Japanese name: SIMD

How SIMD works

A SIMD (single instruction, multiple data) unit treats a wide register as a set of independent lanes. A 128-bit register holds four 32-bit values, and a 512-bit register holds sixteen; one add instruction adds all lanes in parallel. Instruction-set extensions such as x86 SSE and AVX and Arm NEON and SVE provide integer and floating-point lane operations, along with loads, shuffles and comparisons. In Flynn's taxonomy SIMD sits beside SISD, an ordinary sequential processor, and MIMD, multiple cores running independent instruction streams. Image filters, video codecs and matrix math typically speed up several-fold or more.

What makes a loop vectorizable

Compilers auto-vectorize loops that apply the same operation to each array element. The key condition is no loop-carried dependence: in a[i] = a[i-1] + b[i], each element needs the previous result, so lanes cannot run simultaneously. Data should be contiguous, and possible pointer overlap (aliasing) can make the compiler give up. A trip count unknown at compile time is not a barrier; the vector loop handles full chunks and a short remainder loop handles the rest. Media code also uses saturating arithmetic, where 8-bit signed 127 + 1 clamps to 127 instead of wrapping to −128.

Data layout: AoS vs. SoA

An array of structures (AoS) stores each record's fields together, such as x, y, z and mass. A loop that reads only x then wastes most of each cache line and needs gather or shuffle work to fill vector lanes. A structure of arrays (SoA) keeps all x values contiguous, so every fetched line is fully used, memory traffic can drop sharply, and one vector load fills the lanes directly. The same layout lets adjacent GPU threads read adjacent addresses, which coalesces their memory accesses.

SIMD vs. SIMT

With CPU SIMD, the programmer or compiler explicitly uses vector instructions, so code is usually written with the vector width in mind. GPU SIMT (single instruction, multiple threads) lets the programmer write ordinary code for one thread; the hardware groups threads, commonly 32, to run in lockstep on shared instruction issue. When threads in a group branch differently, the hardware executes each path in turn with inactive threads masked, so code still works but efficiency drops. Underneath, both rely on the same principle of amortizing one instruction over many data elements.

Try it: questions about SIMD

How does the GPU SIMT (single instruction, multiple threads) model differ from CPU SIMD instructions?

  1. ASIMT applies many instructions to one datum; SIMD applies one instruction to one datum
  2. BSIMT and SIMD are exactly the same with different names
  3. CIn SIMT each thread can be written as an independent program and the hardware handles branches; with SIMD the programmer or compiler explicitly uses fixed-width vector instructions
Show answer and explanation

Answer: C. In SIMT each thread can be written as an independent program and the hardware handles branches; with SIMD the programmer or compiler explicitly uses fixed-width vector instructions

CPU SIMD applies one instruction to a vector register holding 4 or 8 data items, so programs are written with the vector width in mind. With GPU SIMT the programmer writes ordinary code for a single thread, and the hardware bundles 32 threads to execute in lockstep. Threads may branch differently; the hardware executes the divergent paths one after another, though efficiency drops when it does.

FAQ

What does SIMD stand for and what does it do?

Single instruction, multiple data: one instruction operates on several data elements packed into a wide register, such as four 32-bit numbers in a 128-bit register.

Why does my loop not auto-vectorize?

Common reasons are a loop-carried dependence where an iteration needs the previous one's result, non-contiguous memory access, or possible pointer aliasing that the compiler cannot rule out.

What is the difference between SIMD and SIMT?

SIMD uses explicit fixed-width vector instructions on a CPU. SIMT, used by GPUs, runs scalar per-thread code on groups of threads in lockstep, with hardware handling branch divergence.

Questions that mention SIMD (4)

SIMD appears in 5 practice questions across 4 topics, including GPU Programming, Computer Arithmetic, CPUs and architecture.

  1. Which describes saturating arithmetic used in signal processing?
  2. Which scheme performs the same operation on multiple data items simultaneously with a single instruction?
  3. For a loop that sums only the x coordinates as above, why does converting to a structure of arrays (a separate array per field) tend to be faster?
  4. When processing particle data with positions x, y and z (each a 4-byte float) on a GPU, which layout is better for memory coalescing?

Books on CPUs and architecture Ad

As an Amazon Associate I earn from qualifying purchases.

Comparisons that include this term

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary