HeadlinesBriefing favicon HeadlinesBriefing.com

Rust SIMD on GPU: Vector Ware's Breakthrough

Hacker News •
×

Vector Ware has enabled Rust's portable SIMD (`core::simd`) to run on the GPU, marking a major step toward GPU-native software development. By mapping `Simd<T, N>` vectors to GPU warp lanes, developers can write high-performance GPU code using familiar Rust abstractions.

GPUs execute in the SIMT model (Single Instruction, Multiple Thread), where a warp issues one instruction across 32 lanes. This is directly analogous to SIMD on CPUs. A `Simd<i16, 32>` vector gives each warp lane one element, and operations like addition compile to a single warp instruction.

Vector Ware achieved this by treating the GPU as a vector target for `core::simd`. The same SIMD code that lowers to x86-64 on a laptop now lowers to warp operations on the GPU with no source changes. This completes the parallelism hierarchy: CPU threads have SIMD lanes; GPU threads (warps) have warp lanes, both driven by `core::simd`.

Key features demonstrated include elementwise arithmetic, comparison masks, selections, and horizontal reductions. Scalar values remain uniform across lanes, while SIMD values are varying. Lane count mismatches are handled via Rust's type system, encoding an IR for the warp machine. This allows developers to write GPU kernels with standard `fn main()` and no GPU-specific annotations, outputting results via std support.