Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More intrinsics? #6

Open
rennis250 opened this issue Apr 3, 2017 · 3 comments
Open

More intrinsics? #6

rennis250 opened this issue Apr 3, 2017 · 3 comments

Comments

@rennis250
Copy link

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
Copy link
Author

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

@BurntSushi
Copy link
Contributor

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.

@rennis250
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants