Skip to content

Expose target-cpu=native as a profile setting #2535

@bluss

Description

@bluss

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-profilesArea: profilesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions