Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upExpose target-cpu=native as a profile setting #2535
Comments
This comment has been minimized.
This comment has been minimized.
|
Re #2112 (comment) this falls between the two scenarios in the comment. Neither testing nor required, just a very good thing to use when it's available. |
This comment has been minimized.
This comment has been minimized.
|
Yeah I don't think we've quite figured out a great way to deal with these sorts of options today. There's To me this is essentially the same question of exposing |
This comment has been minimized.
This comment has been minimized.
|
I'd really like if I could set this to be the default for all my builds locally since I typically don't care about distributing binaries. |
This comment has been minimized.
This comment has been minimized.
|
@retep998 That seems to be possible using build.rustflags in the user-wide cargo config. |
bluss commentedMar 31, 2016
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=nativeis 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.