SVE and SME on AArch64 (original) (raw)

Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rust Project Goals

SVE and SME on AArch64

Summary

Over the next six months, we will continue our efforts from the 2025H1 goal to merge nightly support for SVE and establish a path towards stabilisation:

Motivation

AArch64 is an important architecture for Rust, with two tier 1 targets and over thirty targets in lower tiers. It is widely used by some of Rust's largest stakeholders and as a systems language, it is important that Rust is able to leverage all of the hardware capabilities provided by the architecture, including new SIMD extensions: SVE and SME.

SIMD types and instructions are a crucial element of high-performance Rust applications and allow for operating on multiple values in a single instruction. Many processors have SIMD registers of a known fixed length and provide intrinsics which operate on these registers. Arm's Neon extension is well-supported by Rust and provides 128-bit registers and a wide range of intrinsics.

Instead of releasing more extensions with ever increasing register bit widths, recent versions of AArch64 have a Scalable Vector Extension (SVE), with vector registers whose width depends on the CPU implementation and bit-width-agnostic intrinsics for operating on these registers. By using SVE, code won't need to be re-written using new architecture extensions with larger registers, new types and intrinsics, but instead will work on newer processors with different vector register lengths and performance characteristics.

SVE has interesting and challenging implications for Rust, introducing value types with sizes that can only be known at runtime, requiring significant work on the language and compiler. Arm has since introduced Scalable Matrix Extensions (SME), building on SVE to add new capabilities to efficiently process matrices, with even more interesting implications for Rust.

Hardware is generally available with SVE, and key Rust stakeholders want to be able to use these architecture features from Rust. In a recent discussion on SVE, Amanieu, co-lead of the library team, said:

I've talked with several people in Google, Huawei and Microsoft, all of whom have expressed a rather urgent desire for the ability to use SVE intrinsics in Rust code, especially now that SVE hardware is generally available.

While SVE is specifically an AArch64 extension, the infrastructure for scalable vectors in Rust should also enable Rust to support for RISC-V's "V" Vector Extension, and this goal will endeavour to extend Rust in an architecture-agnostic way. SVE is supported in C through Arm's C Language Extensions (ACLE) but requires a change to the C standard (documented in pages 122-126 of the 2024Q3 ACLE), so Rust has an opportunity to be the first systems programming language with native support for these hardware capabilities.

The status quo

SVE is currently entirely unsupported by Rust, but progress is being made - see the tracking issues for the Sized Hierarchy prerequisite (rust#144404) and for Scalable Vectors themselves (rust#145052).

The next 6 months

The primary objective of this initial goal is to land a nightly experiment with SVE, have both RFCs accepted and establish a path towards stabilisation:

  1. Resolve any and all follow-ups to rust#137944 now that it has been merged
  2. Merge a pull request with Part II of [rust#3729]'s implementation
  3. Rewrite rfcs#3838 in light of rfcs#3729 to defer to rfcs#3729's solutions for how scalable vectors will fit in the Rust type system
  4. Rebase rust#143924 on top of Part II of the Sized Hierarchy work, enabling it to be merged experimentally
  5. Merge stdarch#1509 adding SVE types and intrinsics
  6. Identify and start addressing remaining stabilisation blockers

The "shiny future" we are working towards

Adding support for Scalable Matrix Extensions in Rust is the next logical step following SVE support. There are still many unknowns regarding what this will involve and part of this goal or the next goal will be understanding these unknowns better.

Design axioms

Ownership and team asks

Here is a detailed list of the work to be done and who is expected to do it. This table includes the work to be done by owners and the work to be done by Rust teams (subject to approval by the team in an RFC/FCP).

Definitions

Definitions for terms used above:

Frequently asked questions

None yet.