Fearless SIMD v1.0 is here

42 points by ohrv


melodyogonna

I was checking the docs on Crates.io, and the usage doesn't seem straightforward. 3 things stand out; I'm not a Rust expert, so forgive me if the answers are obvious.

The first example has this code:

#[simd]
fn double_u32s<S: Simd>(_: S, values: &mut [u32]) {
    for value in values {
        *value = *value * 2;
    }
}

Which takes an unused SIMD parameter; what I don't understand is why. If the parameter is not useful in simple cases, then why is it required?

I also see that compilation requires a call to a dispatch macro like so: dispatch!(level, simd => double_u32s(simd, &mut values));

This feels unnatural; I see from the docs that it is used to select the appropriate SIMD level. I would expect to just write: double_u32s(Simd::Level::new(), &mut values); but perhaps Rust doesn't provide many ways to allow hooking into the compilation pipeline.