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

Document safety requirements #25

Open
Plecra opened this issue Sep 24, 2020 · 3 comments
Open

Document safety requirements #25

Plecra opened this issue Sep 24, 2020 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@Plecra
Copy link

Plecra commented Sep 24, 2020

It isn't clear what conditions are required to call the Avx2 searcher methods.

@zakcutner
Copy link
Contributor

Hello, thanks for bringing this up! These methods are unsafe since they are annotated with target_feature(enable = "avx2") although hopefully that may not be required soon. I can add a safety section to the docs in the meantime explaining this since that's a good point.

@zakcutner zakcutner added the documentation Improvements or additions to documentation label Sep 24, 2020
@zakcutner zakcutner self-assigned this Sep 24, 2020
@BurntSushi
Copy link

It should be possible to provide a fully safe API using the same techniques that I used in memchr: https://github.com/BurntSushi/rust-memchr/blob/10f11fbeaaec9d1c892be30718604a09b6622e8e/src/x86/mod.rs#L9-L60 --- The only thing you have to give up is that your search function can't be inlined, but that's probably true anyway, since its core implementation is using AVX.

@zakcutner
Copy link
Contributor

That's a really great idea, thanks 👍 We'll probably change around the API a bit at some point (we'd like to support SSE2 without AVX2 for example) so we can definitely add something like that in.

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

No branches or pull requests

3 participants