SME2 from scratch: Build matrix multiplication (step-by-step guide)
Learn how to build matrix multiplication using Arm SME2 (Scalable Matrix Extension) in this step-by-step tutorial. This video shows how to implement high-performance matrix multiply in Arm assembly, with no frameworks or libraries. You’ll follow a complete walkthrough of how SME2 instructions accelerate matrix multiplication, including how the hardware works and how to apply it in real code. By the end, you’ll be able to write and optimize matrix multiplication using SME2, handling data movement, loop control, and variable matrix sizes in practical scenarios. What you’ll learn: * How SME2 hardware is structured and accessed * How to load and store matrix data efficiently * How to use the Matrix Outer Product instruction for acceleration * How predicate registers enable flexible matrix sizes * How to initialize and control SME execution * When and how to transpose input matrices for performance This tutorial is based on a real Arm implementation: https://developer.arm.com/documentation/109246/0101/matmul-fp32--Single-precision-matrix-by-matrix-multiplication/matmul-opt-code 0:00:00 Introduction 0:01:00 SME Hardware 0:03:26 SME tile access 0:06:02 Matrix Outer Product and predicate-as-mask 0:07:48 Matrix outer product code walkthrough 0:10:12 Predicate Select 0:11:14 Inner loop flow 0:15:18 Memory write back algorithm 0:16:18 Memory write back code walkthrough 0:20:13 Loop control algorithm 0:21:56 Predicate-as-counter 0:24:52 Loop control code walkthrough 0:27:34 Initialisation code 0:29:30 Preprocessing the left matrix Keywords: Arm SME2, matrix multiplication, Arm assembly, scalable matrix extension, SIMD, high-performance computing, matrix multiply tutorial, low-level optimization, CPU optimization, Arm architecture