The interesting question for me is whether Rust makes it easier for the compiler to extract SIMD parallelism automatically given the restrictions imposed by its type system.
Using SIMD for Parallel Processing in Rust
41–43 of 43 posts
Re: Using SIMD for Parallel Processing in Rust
#42Zig actually has a very nice abstraction for SIMD in the form of vector programming. The size of the vector is agnostic to the underlying cpu architecture. The compiler or LLVM will generate code for using SIMD128, 256, or 512 registers. And you are just programming straight vectors.
Re: Using SIMD for Parallel Processing in Rust
#43Earlier quoted context omitted.
Great read! > One of my goals of writing these articles is to learn so feedback is more than welcome! When I went into the Rust playground to see the assembly output for the Cumulative Sum example, I could only get it to show the compiler warnings, not the actual assembly. I'm probably doing something wrong, but for me this was a barrier that detracted from the article. I'd suggest incorporating the assembly directly…
The function has to be made pub so it doesn't get optimized out as unusued private function. Godbolt is a better choice for looking at asm anyway. https://rust.godbolt.org/z/3Y9ovsoz9
(There's only addsd/movsd instructions, which are add/move scalar-double; we want addpd/movpd which are add/move packed-double in vectorised code.)