Look at any compiled AI graph and you'll see two ops
Open a Triton kernel, an XLA HLO dump, or PyTorch's torch.compile output and skim the operations. Convolutions, attention, MLPs, RNNs, GNNs — every learned layer ultimately decomposes into combinations of two primitives:
| Primitive | Math | Where you actually see it |
|---|---|---|
| Dot Product | y = Σ xᵢ · wᵢ | Attention scores, cosine similarity in vector search, output of any single neuron |
| Matrix Multiply (GEMM) | C = α·A·B + β·C | Dense / Linear layers, Q-K-V projections, MLP blocks, embedding lookups when batched |
Convolutions become GEMMs after im2col or implicit-gemm. Softmax is element-wise math + a reduction. Layer normalization is two reductions and an element-wise scale. The 'real' compute, the part where 90% of FLOPs are spent, is GEMM.
That's why hardware vendors and library authors pour decades of work into one shape — fast GEMM. Tensor Cores on NVIDIA, the matrix coprocessor on Apple, AMX on M1+, AMD Matrix Cores. They're all bigger, faster GEMM accelerators bolted onto the GPU.
Once you internalize this, model design feels different. 'Should I add another head?' becomes 'how does this change my GEMM shape?' Padding, batching, hidden-size choices — they all collapse to whether you're feeding the GEMM library shapes it can vectorize cleanly.