-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Description
This is a tracking issue for the not-yet-accepted RFC for "Scalable Vectors" (rust-lang/rfcs#3838).
The feature gate for the issue is #![feature(rustc_attrs)]
.
This feature is part of the "Scalable Vectors" project goal from 2025h1 and 2025h2.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted. Repeated discussions on the tracking issue may lead to the tracking issue getting locked.
Background and motivation
Quoting from rust-lang/rust-project-goals#270:
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 compilation time, requiring significant work on the language and compiler.
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.
Dependencies
- Tracking Issue for Sized Hierarchy #144404
- Hierarchy of Sized traits rfcs#3729 extends Rust's concept of sizedness to better support exotically sized types, like scalable vectors. In particular, it introduces the concept of "const sizedness" - whether the size of a type can be determined in a const context. "const sizedness" enables separating the characteristics of
Sized
types that enable them to implementCopy
and act like value types from the characteristics that enable their size to be computed statically at compile-time. Scalable vectors are non-constSized
.
- Hierarchy of Sized traits rfcs#3729 extends Rust's concept of sizedness to better support exotically sized types, like scalable vectors. In particular, it introduces the concept of "const sizedness" - whether the size of a type can be determined in a const context. "const sizedness" enables separating the characteristics of
Steps
- Experimentation implementation of
rustc_scalable_vector
rfcs#3838 inrustc_scalable_vector(N)
#143924- Experimental implementation will help resolve the unresolved questions in the RFC
- Implement unstable intrinsics
- As
rustc_scalable_vector
rfcs#3838 proposes internal infrastructure for defining scalable vector types in the standard library'sstd::arch
, it's hard to evaluate without having some scalable vector types and intrinsics defined - We'll update or re-open SVE types and intrinsics stdarch#1509 with these
- As
- Wait for stabilisation of prerequisites (i.e. Tracking Issue for Sized Hierarchy #144404)
- Adjust documentation (see instructions on rustc-dev-guide)
- Style updates for any new syntax (nightly-style-procedure)
- Style team decision on new formatting
- Formatting for new syntax has been added to the Style Guide
- (non-blocking) Formatting has been implemented in
rustfmt
- Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
-
rustc_scalable_vector
rfcs#3838 has open questions about how scalable vectors can work when thetarget_feature
must be present for the types to exist- This will require experimentation to determine how to resolve
Implementation history
- RFC: Add a scalable representation to allow support for scalable vectors rfcs#3268 and Support for a scalable simd representation #118917 were previous attempts at trying to design and implement scalable vectors in Rust
- This informed our current approach and led to our work on Tracking Issue for Sized Hierarchy #144404
- SVE types and intrinsics stdarch#1509 similarly is an implementation of SVE types of intrinsics that will be updated
-
rustc_scalable_vector(N)
#143924- This pull request has an initial incomplete implementation of scalable vectors, it needs updating in line with recent revisions to
rustc_scalable_vector
rfcs#3838 prior to being merged - Tracking Issue for Sized Hierarchy #144404 is not yet sufficiently implemented to resolve the sizedness issues with scalable vectors, so this implementation incorrectly makes these vectors
Sized
temporarily
- This pull request has an initial incomplete implementation of scalable vectors, it needs updating in line with recent revisions to
Metadata
Metadata
Assignees
Labels
Type
Projects
Status