RC RANDOM CHAOS

VectorWare Runs Rust's Portable SIMD on the GPU — Same Source, No Rewrite

· via Hacker News

Original source

Rust SIMD on the GPU

Hacker News →

VectorWare says it has become the first to run Rust’s portable SIMD (core::simd) on GPU hardware. The insight is that NVIDIA’s SIMT execution model is really just SIMD under a different name: a 32-lane warp is a wide vector unit, so a Simd<T, N> value maps one element per lane and compiles to a single warp instruction. This extends the company’s earlier work mapping std::thread to GPU warps — threads gave concurrency across warps, and portable SIMD now exploits the parallel lanes inside each one. Because core::simd lives in core rather than std, it needs less runtime support than their earlier thread work.

The practical payoff is portability. The same Rust source — elementwise math, lane masks, select, cross-lane shuffles, and horizontal reductions — lowers to x86-64 vector instructions on a laptop and to warp shuffle, vote, and ballot instructions on the GPU with no source changes. Existing CPU code and libraries built on portable SIMD become candidates for GPU execution without a rewrite, and a Simd value stays an ordinary owned type subject to the borrow checker rather than a bespoke GPU type. To handle work wider than a warp, VectorWare encodes a warp-lane IR directly in Rust’s type system using generics, const generics, and trait bounds, so many invalid programs simply won’t compile; a companion reference interpreter (a sort of Miri for warp programs) enables deterministic simulation and differential testing.

The caveats are real. Portable SIMD is still nightly-only behind #![feature(portable_simd)] and its API may shift before stabilization. The abstraction also leaks on lane count: GPUs have a fixed width (32 on NVIDIA, 32 or 64 on AMD) while CPU vectors range from 1 to 64, so narrower vectors waste lanes and wider ones expand into extra instructions. The work targets NVIDIA today, but the team notes the approach is architecture-agnostic and should carry over to AMD wavefronts and Vulkan subgroups.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.