Skip to content

target-feature detection run-time #366

Description

@gnzlbg

I've submitted an RFC (rust-lang/rfcs#2725) that allows #![no_std] applications to use the target-feature detection macros, and customize the detection run-time. A

For embedded devices, you often know all features available at compile-time, so doing run-time detection is probably moot, unless you want to ship the same binary to different embedded devices, or have an heterogeneous device and want some code to use features of certain cores when available.

Either way, the RFC should cover these use cases, but thought some of you might be interesting in triple-checking that it would work for their use cases as well.

Activity

  1. tarcieri commented on May 26, 2021

    @tarcieri

    For anyone looking for an interim/stopgap solution for portable CPU feature detection which is at least no_std on x86/x86-64, the RustCrypto Project's cpufeatures crate provides this:

    https://github.com/RustCrypto/utils/tree/master/cpufeatures

    We also support aarch64, but runtime CPU feature detection on ARM64 requires privileged instructions and thus can only be performed using operating system-provided APIs. We presently support runtime detection of a limited number of CPU features on these platforms (with runtime detection limited to Linux and macOS). If we don't support the feature you're interested in (or you're interested in e.g. 32-bit ARM) please open an issue with a request and we can get it added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions