Library requiring simd


I am developing a library that requires avx and fma instructions to be fast, If simd isn’t enabled it performs bad and I don’t want to implement other versions of my functions without simd. Should I use compiler_error macro to fail compilation if avx and fma isn’t enabled or is telling users to enable target-cpu=native is enough?

library is here:

Also It would be great if someone wanted to write non simd versions of functions

1 Like

Personally I use cfg'd compile_errors. Your library should not allow execution of SIMD intrinsics without compile- or run-time checks of required target feature.


Putting this prevents docs from building also so It wont build on, Do you know a solution to this?

For aesni I add the following lines to Cargo.toml:

rustc-args = ["-C", "target-feature=+aes,+ssse3"]
rustdoc-args = ["-C", "target-feature=+aes,+ssse3"]
1 Like

thanks !