Disabling avx512f for specific parts of code/binaries in project?

Hi everybody :slight_smile:

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 enable.
Is there any way to do something like that?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.