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

experiment with how to pick the right SIMD implementation #163

Open
folkertdev opened this issue Aug 26, 2024 · 3 comments
Open

experiment with how to pick the right SIMD implementation #163

folkertdev opened this issue Aug 26, 2024 · 3 comments

Comments

@folkertdev
Copy link
Collaborator

we currently use the stdlib macros in many places. I believe this is reasonably fast for us (we don't do it in tight loops), but still those macros have overhead. We might benefit from a different approach. I came across

https://crates.io/crates/multiversion

which apparently has some tricks up its sleeve.

@gdonval
Copy link

gdonval commented Feb 27, 2025

Wouldn't std::Simd be a great way to fully generalize SIMD implementations? Then multiversion can be used as intended (to automatically compile multiple runtime version and do the dispatch).

@bjorn3
Copy link
Collaborator

bjorn3 commented Feb 27, 2025

std::simd::Simd isn't stable yet, so zlib-rs can't use it yet.

@folkertdev
Copy link
Collaborator Author

And even if it were, std::simd::Simd is supposed to be cross-platform, and it's implied that it generates decent code on all platforms it supports. We do have some very target-specific SIMD instructions that I don't think the standard library ever will nor should support.

What we would like to see is native multi-versioning https://rust-lang.github.io/rust-project-goals/2025h1/simd-multiversioning.html. We're making do with const generics at the moment.

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

4 participants
@gdonval @folkertdev @bjorn3 and others