Expose target-cpu=native as a profile setting #2535
Labels
A-profiles
Area: profiles
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
S-needs-design
Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
For a lot of projects you want that the compiler uses every cpu feature available. Not just numerics, but loops that copy or search in general can profit from using wider registers or vector instructions.
target-cpu=native makes plain old Rust code much more powerful. We don't need to write simd intrinsics, simd types, we can write one version of the code that works everywhere but the compiler can compile it well. It's not perfect, not always a replacement for hand implemented vectorization, but it's pretty good.
As of this writing, matrixmultiply is in plain rust. It should compile with any settings, but using
-C target-cpu=native
is a big benefit (more than 50% increase in throughput if you have avx). It would therefore be great if projects using it had an easy way to just flip the switch that they want the compiler to use all available cpu features.The text was updated successfully, but these errors were encountered: