simd icon indicating copy to clipboard operation
simd copied to clipboard

More intrinsics?

Open rennis250 opened this issue 8 years ago • 3 comments

I've only started really learning about SIMD and how to use it about three days ago. I'm trying to convert some code from Sleef: https://github.com/shibatch/sleef to Rust-SIMD. However, some of their functions depend on instructions that don't clearly map to this crate, as far as I can tell. For example, the function listed here:

https://github.com/shibatch/sleef/blob/master/src/arch/helpersse2.h#L126

Any tips? Do more intrinsics need to be unveiled?

Best, Rob

rennis250 avatar Apr 03 '17 09:04 rennis250

Is it also somehow possible to use intrinsics directly? I suppose this isn't the best practice, but I'm just curious.

rennis250 avatar Apr 03 '17 09:04 rennis250

You can use any intrinsic you like, but most of it is undocumented and will only work on nightly Rust. There is ongoing work to fix that situation. There's a too long thread here about it, and you can also track my progress working on the proposal for std. In particular, the file that defines the Intel SSE2 vendor API should show you how to use any intrinsic you want on nightly Rust: https://github.com/BurntSushi/stdsimd/blob/master/src/x86/sse2.rs

I suppose this isn't the best practice

This crate does its best to expose a platform independent API that covers a good number of use cases, but it can never replace the total functionality offered by all of the platform dependent APIs. So I don't think you're violating any best practice here. If your requirements dictate the need for platform dependent intrinsics, then that's OK.

Do more intrinsics need to be unveiled?

It's not clear what the design scope of this crate is. Certainly, there are traits defined, like Sse3F32x4, that imply platform specific support. However, the goal there I think is to expose more high level operations using the various powers acquired by targeting particular instruction set extensions, rather than expose the intrinsic API directly.

BurntSushi avatar Apr 03 '17 11:04 BurntSushi

Thanks for the info. That helps a lot. I'm all for high-level abstraction of these types of things, which is why I think translating Sleef to Rust-SIMD could be of assistance. Sleef itself acts as a high-level abstraction over the various SIMD instruction sets, allowing one to use the same API for accelerated math with different target platforms. I'll try playing around now and see what comes out.

rennis250 avatar Apr 03 '17 11:04 rennis250