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

macOS lazily saves the AVX512 context #36330

Merged
merged 1 commit into from Jun 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/processor_x86.cpp
Expand Up @@ -545,7 +545,14 @@ static NOINLINE std::pair<uint32_t,FeatureList<feature_sz>> _get_host_cpu(void)
unset_bits(features, 32 + 27);
if (!hasavx)
features_disable_avx(features);
#ifdef _OS_DARWIN_
// See https://github.com/llvm/llvm-project/commit/82921bf2baed96b700f90b090d5dc2530223d9c0
// and https://github.com/apple/darwin-xnu/blob/a449c6a3b8014d9406c2ddbdc81795da24aa7443/osfmk/i386/fpu.c#L174
// Darwin lazily saves the AVX512 context on first use
YingboMa marked this conversation as resolved.
Show resolved Hide resolved
bool hasavx512save = hasavx;
#else
bool hasavx512save = hasavx && test_all_bits(xcr0, 0xe0);
#endif
if (!hasavx512save)
features_disable_avx512(features);
// Ignore feature bits that we are not interested in.
Expand Down