so I have a project with both a lib and several binaries utilizing this library. I’m compiling everything with
rustflags = ["-C", "target-cpu=native"] in
.cargo/config. Yesterday I noticed that in one of the binaries the avx512f feature is actually causing the code to run significantly slower - like 30% slower. So I added
"-C", "target-feature=-avx512f" to the rustc flags. Sadly, that worsened performance in another binary, again quite significantly.
So I’m looking for a way to either pass different flags to rustc depending on which binary is being build (probably a bad idea, because I think that would imply rebuilding the lib and all dependencies for the different binaries) or even better somehow tell the compiler to just not use avx512f in the relevant parts of the code. So something like the unconditional code generation from RFC2045
#[target_feature(enable = "avx512f")] but with
disable instead of
Is there any way to do something like that?