On 29 October 2026 two Qualcomm engineers, Namish Kukreja and Usman Nadeem, published a guide on the company’s developer blog to writing fast kernels for SVE and SME, the AArch64 vector and matrix extensions, with Ripple, an open-source API built on LLVM. The pitch is hard to ignore: ordinary C with a handful of annotations that lands within 1–2% of hand-written assembly on large matrix multiplications.
One clarification first, because this is a Linux site: “kernel” here does not mean the operating system kernel. In HPC and machine learning, a compute kernel is the small, heavily tuned function that does the heavy lifting: a matrix-vector product, a convolution, a dot product. Ripple is a tool for writing those. The Linux kernel shows up further down for a different reason: without it, no program could use SVE or SME at all.
The problem: vectors whose size you don’t know at compile time
With NEON, Arm’s classic SIMD unit, registers are always 128 bits wide. x86 works in a similar way: SSE is 128 bits, AVX2 is 256 and AVX-512 is 512, and every step means recompiling or shipping several versions of the same code (the same logic behind the x86-64-v2, v3 and v4 levels).
SVE breaks with that. The architecture allows registers anywhere from 128 to 2048 bits, in multiples of 128, and leaves the choice to each chip designer. The same binary has to work at any width: this is vector-length agnostic (VLA) programming. To make it possible, SVE has instructions that read the width at run time (rdvl, cntw) and predicates, mask registers that say which lanes are active, so a loop’s leftover elements can be handled without a separate scalar tail.
For compiler writers and intrinsics users that has awkward consequences. An SVE vector type has no fixed sizeof, so it can’t go into a struct or a normal array. The block size used to tile a matrix, which is what performance hinges on, depends on a number nobody knows until the program runs.
SME (Scalable Matrix Extension) adds another layer. It brings a streaming mode with its own vector length (the SVL, which need not match the regular SVE length) and a two-dimensional storage array called ZA, a square matrix of SVL × SVL bits where outer products are accumulated. At a 512-bit SVL, ZA is 64 × 64 bytes and, for 32-bit data, splits into four 16 × 16 tiles. Entering and leaving streaming mode isn’t free, and not every instruction is available inside it.
Four ways to vectorize, and where Ripple fits
- Auto-vectorization. You write a normal loop and the compiler tries to turn it into vector code. When it works it costs nothing; when it doesn’t (dependencies it can’t rule out, irregular access, reductions), there’s no easy way to tell it what you want. Nobody expects it to discover a matrix multiply on ZA tiles by itself.
- Intrinsics or assembly. Full control, paid for with long code tied to one specific extension and hard to maintain. That’s what libraries such as Arm’s KleidiAI do.
- ISPC, Intel’s SPMD compiler. It uses its own C-derived language with new keywords and compiles each function on the assumption that many program instances run at once, one per lane.
- Ripple. Qualcomm calls it “a compiler-interpreted API” for two models: SPMD (Single Program, Multiple Data, as in CUDA or OpenCL) and loop annotation (as in OpenMP). It doesn’t change C or C++ syntax: you declare the shape of a block of “processing elements” with
ripple_set_block_shape(), get each lane’s index withripple_id()and, in the loop model, just putripple_parallel()before afor. Scalar, vector and tensor code can live in the same function.
ISPC came up directly in the LLVM RFC thread. Benoit Meister, who wrote the proposal, pointed to two differences: Ripple supports multi-dimensional block shapes, like CUDA, and it is still C, with no new keywords. The division of labour is explicit: the programmer picks block shapes, data layout and which extensions to use; the compiler takes care of masking, epilogues, register allocation and instruction scheduling.
One technical detail matters: Ripple adds no new instructions or types to LLVM IR. It emits standard IR, so on AArch64 it reuses the existing backend. You turn it on with -fenable-ripple and pick extensions with the usual -march, for example -march=armv9.2-a+sve2+sme. Streaming mode and ZA state are controlled with the standard ACLE attributes (__arm_locally_streaming, __arm_new("za")), and SME operations are exposed through a small header-only vector library (in compiler-rt/lib/ripple/aarch64) with functions to zero an accumulator, accumulate an outer product or read back a tile slice.
The examples: GEMV and GEMM, the two halves of an LLM
Qualcomm’s post uses two very specific operations. GEMV (matrix times vector) dominates the token-generation phase of a language model; GEMM (matrix times matrix) dominates prompt processing.
For GEMV, the Ripple code is the textbook scalar loop plus three additions: include ripple.h, set the block size and mark which dimension is parallel. The float acc accumulator looks like a scalar, but Ripple expands it into a vector the size of the block. With 32-float blocks (two 512-bit vectors), the inner loop comes down to two fmla instructions per iteration.
For GEMM, the kernel is a Ripple re-implementation of a KleidiAI micro-kernel built on SME’s FMOPA instructions. A single outerProductAccumulate_f32 call on 32-wide blocks becomes four FMOPAs, one per 16 × 16 tile (za0 to za3), which together act as a 32 × 32 accumulator. The matrix edge is handled by a plain if that Ripple turns into a predicated store.
The numbers, as Qualcomm reports them
All of these figures are Qualcomm’s. The post doesn’t say which chip they were measured on; it does say the test suite can be cross-compiled and run under QEMU.
- Lines of code: the Ripple GEMM kernels are 57 lines of C (FP32) and 71 (INT8), comments and blank lines included, against 318 and 464 for the assembly reference implementations. The FP32 GEMV is about 17 lines against roughly 1,200 lines of assembly, a 98.5% reduction.
- FP32 GEMV: within 5% of the hand-optimized SME reference kernel on square sizes from 1K to 40K.
- FP32 GEMM: within about 1–2% of hand-written SME assembly on large matrices and 5–10% on very small ones.
- INT8 GEMM: within about 1–2% on large matrices; the gap is wider on small sizes, which Qualcomm says it’s closing with LLVM code-generation work.
The authors stress that their GEMM kernels use no software pipelining, interleaving or manual unrolling. There’s also a catch worth keeping in mind: the SME examples are not vector-length agnostic. They assume a fixed 512-bit SVL (-msve-streaming-vector-bits=512), and the library ships verify_ripple_sme_api_fixed_vscale() to check it at run time. For a different SVL, Qualcomm’s answer is to change the block size and rebuild.
Where the project stands in LLVM
Ripple was put to the community in an RFC posted on the LLVM forum on 9 September 2025, with the stated aim of landing in the main tree. The reception was friendly but cautious: Sjoerd Meijer noted that the core, Ripple.cpp, is around 8,000 lines and would need to be split into small patches for review, and Nikita Popov asked for larger examples and real-world use before bundling a new programming paradigm with Clang. The authors agreed to split the work.
As of today Ripple is not in llvm-project. It lives in a public LLVM fork at github.com/qualcomm/ripple, whose first tagged release is from 19 December 2025, with the examples in ripple-test-suite (BSD-3-Clause-Clear) and an online manual. You have to build that clang to try it.
What the Linux kernel does to make this work
SVE and SME registers are per-thread state that the OS must save and restore, and they’re much bigger than NEON’s. The kernel documentation (sve.rst and sme.rst) spells out the contract:
- Z0–Z31, P0–P15, FFR and the vector length are tracked per thread. With SME, so are the streaming-mode bit (PSTATE.SM), the ZA bit (PSTATE.ZA), the SVL, the ZA matrix and, with SME2, the ZT0 register.
- On every system call the low 128 bits of the Z registers (the part shared with NEON) survive and everything else, predicates included, comes back zeroed. Streaming mode is switched off, but ZA is kept if it was live.
- Signal handlers start with streaming mode and ZA off, and the signal frame gains new records (
sve_context,za_context) that may not fit in the classic reserved space. - Each process can pick its vector length with
prctl(PR_SVE_SET_VL, …)andprctl(PR_SME_SET_VL, …), optionally deferred to the nextexecve(). System defaults live in/proc/sys/abi/sve_default_vector_lengthand/proc/sys/abi/sme_default_vector_length; for SVE the boot default is 64 bytes (512 bits) or the hardware maximum, whichever is smaller.
Checked against the headers in Linus Torvalds’ tree: HWCAP_SVE first appears in Linux 4.15, the SVE2 hwcaps in 5.2, SME in 5.19 and SME2 in 6.3. Any current distribution is well past all of them.
Which CPUs have SVE or SME
- AWS Graviton: per AWS’s technical guide, Graviton3 (Neoverse V1) has two 256-bit SVE units; Graviton4 (Neoverse V2) and Graviton5 (Neoverse V3) have four 128-bit Neon/SVE units, with SVE2 from Graviton4 on.
- NVIDIA Grace: 72 Neoverse V2 cores with 4 × 128-bit SVE2 each, according to NVIDIA’s tuning guide.
- Arm C1 (the Lumex platform, announced in September 2025): Arm describes it as an SME2-enabled Armv9.3 CPU cluster.
- Apple M4: has SME and SME2 but no regular SVE outside streaming mode; that’s how LLVM’s
apple-m4processor definition lists it, and macOS reports it throughsysctl hw.optional.arm.FEAT_SME. An M2 Max, like the one used for the tests in this article, returns 0 for all of those keys. - Qualcomm: the post doesn’t say which Snapdragon these kernels were measured on. The first-generation Oryon in Snapdragon X laptops has no SVE (LLVM defines it as Armv8.6 without that extension).
- Ampere Altra uses Neoverse N1 cores, without SVE.
On Linux, checking is easy:
grep -o -w -E 'sve|sve2|sme|sme2' /proc/cpuinfo | sort -u
cat /proc/sys/abi/sve_default_vector_length # only exists with SVE
From C, getauxval(AT_HWCAP) carries the HWCAP_SVE bit, while HWCAP2_SVE2, HWCAP2_SME and HWCAP2_SME2 are in getauxval(AT_HWCAP2). Mind the split: SVE itself is in AT_HWCAP, not AT_HWCAP2.
Hands-on: SVE with clang on Debian 13
To see what VLA code really looks like, this loop was built with Debian 13’s clang 19.1.7 in a linux/arm64 container, using clang -O2 -march=armv8-a+sve:
void saxpy(size_t n, float a, const float *x, float *y) {
for (size_t i = 0; i < n; i++)
y[i] = a * x[i] + y[i];
}
The auto-vectorizer does handle it. Here’s the main loop from llvm-objdump:
60: mov z1.s, s0 // broadcast a across the vector
64: ptrue p0.s // predicate with every lane active
6c: rdvl x10, #0x2 // bytes in two vectors, read at run time
7c: ld1w { z2.s }, p0/z, [x13]
80: ld1w { z3.s }, p0/z, [x12]
84: subs x11, x11, x8
88: ld1w { z4.s }, p0/z, [x13, #0x1, mul vl]
8c: ld1w { z5.s }, p0/z, [x12, #0x1, mul vl]
90: add x13, x13, x10
94: fmad z2.s, p0/m, z1.s, z3.s
98: movprfx z3, z5
9c: fmla z3.s, p0/m, z1.s, z4.s
a0: st1w { z2.s }, p0, [x12]
a4: st1w { z3.s }, p0, [x12, #0x1, mul vl]
a8: add x12, x12, x10
ac: b.ne 0x7c
There isn’t a hard-coded 16, 32 or 64 anywhere: the stride comes from rdvl, and mul vl addressing scales by whatever the vector length turns out to be. You can also see where the auto-vectorizer stops: instead of finishing the loop with a whilelo predicate, clang 19 keeps a separate scalar loop (ldr s1 / fmadd / str s1) for the leftover elements. That’s exactly the kind of decision Ripple wants to hand back to the programmer.
Then the binary was run. In the container, which sits on an Apple M2 Max, /proc/cpuinfo shows no sve and the program dies with “Illegal instruction” (SIGILL). Under qemu-aarch64 -cpu max at 128, 256 and 512 bits, the very same executable gives the right answer every time, and a tiny program using getauxval() and svcntb() reports sve=1 sve2=1 sme=1 plus the selected length in each case. That’s “vector-length agnostic” in practice.
Who should care
Ripple isn’t something a sysadmin will touch, but it does shape what runs on their servers. Inference engines, linear-algebra libraries and codecs live on kernels like these, and today they rely on hand-written assembly for each extension. If a tool lets people write them in C and stay within a couple of points of assembly, software is more likely to make use of SVE on Graviton or Grace and SME on the Arm laptops and phones that already have it. What’s missing is LLVM accepting the project and numbers measured on real SME hardware. Meanwhile the code is out and runs under QEMU.
How we tested this
Ripple itself wasn’t built: that means compiling the clang from Qualcomm’s fork, and the performance figures are the company’s own. What was tested is the SVE part, in a native arm64 debian:13 container under Docker Desktop on a Mac with an Apple M2 Max, using Debian’s clang 19.1.7 and llvm-objdump plus qemu-aarch64 10.0.13 from the qemu-user package. The screenshot above is from a second run on 3 November 2026: saxpy has a main that sums the result so it can be checked, and vl is a dozen-line program that prints the getauxval() bits and what svcntb() returns.
The M2 Max has no SVE, so running natively only shows the SIGILL. The correct results at 128, 256 and 512 bits come from the emulator, which says nothing about performance, and SME was never executed: only its bit in AT_HWCAP2 was read.
docker run --rm -it -v "$PWD":/w -w /w debian:13 bash
apt update && apt install -y clang-19 llvm-19 qemu-user
clang-19 -O2 -march=armv8-a+sve -o saxpy saxpy.c
llvm-objdump-19 -d --no-show-raw-insn --disassemble-symbols=saxpy saxpy
for b in 16 32 64; do qemu-aarch64 -cpu max,sve-default-vector-length=$b ./saxpy; done
sve-default-vector-length is in bytes: 16, 32 and 64 mean 128, 256 and 512 bits. On an x86-64 PC, add --platform linux/arm64 to the docker run; the whole container then runs under emulation, and you most likely won’t see the SIGILL.
Sources: Qualcomm Developer Blog: How to write fast AArch64 SVE/SME Kernels with Ripple and LLVM · Ripple RFC on LLVM Discourse · qualcomm/ripple · qualcomm/ripple-test-suite · Ripple user manual · Kernel documentation: SVE and SME · Arm Architecture Reference Manual · Arm: Lumex CSS · AWS Graviton Technical Guide · NVIDIA Grace Performance Tuning Guide
