Skip to content

Prevent Building Release On X86 without SSE3 #3485

Closed as not planned
Closed as not planned
@tustvold

Description

@tustvold

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

I was messing around with simd-json and noticed that it fails to compile if there is no SIMD target_feature set, and wondered if we wanted to do something similar.

Specifically I am thinking of returning an error if compiling in release mode for x86 without sse3 enabled. These instructions were first introduced in 2004 and all computers in the latest steam hardware survey support them. They are, however, not enabled by default.

Describe the solution you'd like

Add the following to arrow-buffer

#[cfg(all(target_arch = "x86_64", not(target_feature = "sse3")))]
fn please_compile_with_simd_target_feature() -> ! {} // E.g. RUSTFLAGS="-C target-cpu=haswell"

If the user compiles without any options set they will get

error[E0308]: mismatched types
  --> arrow-buffer/src/lib.rs:21:49
   |
21 | fn please_compile_with_simd_target_feature() -> ! {} // E.g. RUSTFLAGS="-C target-cpu=haswell"
   |    ---------------------------------------      ^ expected `!`, found `()`
   |    |
   |    implicitly returns `()` as its body has no tail or `return` expression
   |
   = note:   expected type `!`
           found unit type `()`

For more information about this error, try `rustc --explain E0308`.

The UX isn't fantastic, but I think it is better than what currently happens which is people silently get poor out of the box performance.

Describe alternatives you've considered

We could not do this

Additional context

Tagging a few people as this will have downstream implications

@alamb @andygrove @viirya @thinkharderdev @jhorstmann @Dandandan

Metadata

Metadata

Assignees

No one assigned

    Labels

    development-processRelated to development process of arrow-rsenhancementAny new improvement worthy of a entry in the changelog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions