SME course
simd-anim
A course in ARM SME. Chapter 1 builds a GEMM: the hardware, the inner pipeline, the microkernel, the roofline, and memory in flight. Chapter 2 goes past that outer product — pack, softmax, and one head of attention.
New to matrix multiply? Take the optional self-check
Giving a talk with this lab? Open the guided talk mode
The course
Chapter 1 is the five-step GEMM intro. Chapter 2 is what attention needs beyond an outer product.
Chapter 1 · GEMM
Five steps, one shape: M=4, N=4, K=2, SVL=128.
-
01
Hardware · Live
The hardware
A register, the ZA tile, and the compute unit — three names every other page uses.
Open this pageZ · ZA · ×+
-
02
SME · Live
Kernel tour
whilelt, ld1w, fmopa, st1w — the GEMM inner loop, in the order it runs.
Start this tourwhilelt → ld1w → fmopa → st1w
-
03
SME · Live
Microkernel
How pack, the K loop, and the store compose a real GEMM kernel — in every transpose state.
Play this kernelpack → ldr + fmopa ×2 → st1w / stnt1w
-
04
Performance model · Live
Roofline
Why reuse, not just FLOPs, decides speed — the memory wall in one picture.
Open this pageperformance = min(peak, supply × intensity)
-
05
Cache choreography · Live
Memory in flight
Prefetch and store traffic across two kernels, level by level — and the one slot where HBM reads and writes collide.
Open this pagepldl2keep / pldl1strm / stnt1w — across kernels
Chapter 2 · Beyond GEMM
Pack bridges out of the microkernel. Softmax is the step that is not a GEMM. Attention composes both.
-
01
Beyond GEMM · Live
Pack
An 8×8 row-major panel becomes four contiguous 4×4 runs.
Play this kernel8×8 row-major → four 4×4 runs
-
02
Beyond GEMM · Live
Softmax
Subtract the max before the exp, so a hot score stays finite and the weights still sum to 1.
Play this kernelexp(x − max) / Σ exp
-
03
Beyond GEMM · Live
Attention
One query, four keys: scores, softmax weights, then a mix with V.
Play this kernelQKᵀ → softmax → ×V
Instructions
The opcode reference, numbered to match each page. The kernel tour walks WHILELT, LD1W, FMOPA, and ST1W; the rest sit beside that path.
-
01
SME · Live
FMOPA
Outer product of z0.s and z1.s, accumulated into a 4×4 ZA tile.
Play this instructionfmopa za0.s, p0/m, p1/m, z0.s, z1.s
-
02
SVE · Live
Vector load / pack
Bring memory into a Z register, lane by lane, then pack those lanes.
Play this instructionld1w { z0.s }, p0/z, [x0]
-
03
SVE · Live
FMLA
A fused multiply-add along a predicated vector.
Play this instructionfmla z0.s, p0/m, z1.s, z2.s
-
04
SME · Live
Store
Write one horizontal slice of a ZA tile back to memory.
Play this instructionst1w { za0h.s[w12, 0] }, p0, [x0]
-
05
SVE · Live
WHILELT
Turn scalar bounds into a predicate: lane i is active while x0 + i < x1.
Play this instructionwhilelt p0.s, x0, x1
-
06
SVE · Live
ADDV
Collapse the active lanes of a vector into one scalar sum.
Play this instructionuaddv d0, p0, z0.s
-
07
SVE · Live
UZP1
Deinterleave: the even elements of two vectors gather into one.
Play this instructionuzp1 z0.s, z1.s, z2.s
-
08
SVE · Live
Gather load
Each lane reads the word its own vector index selects — duplicates included.
Play this instructionld1w { z0.s }, p0/z, [x0, z1.s, sxtw #2]
-
09
SME2 · Live
FMLAL
Half-precision operands, single-precision tile: a widening multiply-add with an indexed vector.
Play this instructionfmlal za.s[w11, 4:5], z0.h, z1.h[2]
-
10
SME · Live
ADDHA
One vector lands in every active row of the ZA tile.
Play this instructionaddha za0.s, p0/m, p1/m, z0.s
-
11
SVE · Live
TBL
Each lane picks any element of an eight-entry table — out of range gives zero.
Play this instructiontbl z0.s, { z1.s, z2.s }, z3.s
-
12
SME · Live
ADDVA
One vector lands in every active column of the ZA tile.
Play this instructionaddva za0.s, p0/m, p1/m, z0.s
-
13
SVE · Live
ZIP1
Interleave: the low halves of two vectors alternate into one.
Play this instructionzip1 z0.s, z1.s, z2.s
Words this lab uses
The four abbreviations, spelled out once so no page has to repeat them.
- SVE
- Scalable Vector Extension — the vector half of the ISA, where the z registers and p predicates come from.
- SME
- Scalable Matrix Extension — adds the ZA matrix accumulator and the outer-product instructions (fmopa, addha, st1w).
- SVL
- Streaming vector length — how many bits one vector holds, fixed by the hardware; 128 in every drawing here.
- ZA
- The SME matrix accumulator — the square tile that fmopa accumulates into and st1w writes back to memory.