Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable AVX3 option for highway #21850

Open
jwnimmer-tri opened this issue Aug 27, 2024 · 0 comments
Open

Enable AVX3 option for highway #21850

jwnimmer-tri opened this issue Aug 27, 2024 · 0 comments
Assignees
Labels
component: build system Bazel, CMake, dependencies, memory checkers, linters priority: low type: feature request

Comments

@jwnimmer-tri
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

See this TODO:

drake/common/BUILD.bazel

Lines 379 to 382 in 50aa30c

# x86: SIMD with the improved 512VL encodings.
# TODO(jwnimmer-tri) Enable this once we support opt-out of CPU
# targets via NPY_DISABLE_CPU_FEATURES environment variable.
# "HWY_AVX3",

We should add AVX3 support so that our software can run ever faster, in case the user has that hardware.

Describe the solution you'd like

As per the TODO:

(1) Uncomment the line, so that AVX3 becomes an option that's compiled into Drake.

(2) Amend hwy_dynamic.cc to consult the environment variables DRAKE_DISABLE_CPU_FEATURES and NPY_DISABLE_CPU_FEATURES:

(a) If neither are set, then just let highway do its natural thing (probe the CPU and use the best available option), exactly how it happens today. Skip the rest of these sub-steps (b)-(d).

(b) If one or both are set, then apply a trumping order to know which environment value to use: if DRAKE_DISABLE_CPU_FEATURES is non-null, then turn it into a string and use it. Otherwise, fall back to using the NPY_DISABLE_CPU_FEATURES string.

(c) Parse the string following numpy's semantics, to understand which CPU features are verboten:

(d) Invoke highway target detection in such a way as to account for both the present hardware, as well as the verboten instruction sets. The goal is that verboten instruction sets are never dispatched to by Drake.

(3) As a related clean-up, for ODR safety we should also move the HWY_DISABLED_TARGETS definition from common into @hwy itself, so that we have a uniform definition across the entire Drake build.

@jwnimmer-tri jwnimmer-tri added type: feature request component: build system Bazel, CMake, dependencies, memory checkers, linters labels Aug 27, 2024
@jwnimmer-tri jwnimmer-tri self-assigned this Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: build system Bazel, CMake, dependencies, memory checkers, linters priority: low type: feature request
Projects
Status: No status
Development

No branches or pull requests

1 participant