This is an archive of the discontinued LLVM Phabricator instance.

[Support] Don't require the XCR0 OSXSAVE bits when detecting skylake-avx512.
ClosedPublic

Authored by fhahn on Nov 19 2019, 11:41 AM.

Details

Summary

Darwin lazily saves the AVX512 context on first use: instead of checking
that it already does to figure out if the OS supports AVX512, trust that
the kernel will do the right thing and always assume the context save
support is available.

Diff Detail

Event Timeline

fhahn created this revision.Nov 19 2019, 11:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2019, 11:41 AM
fhahn updated this revision to Diff 230116.Nov 19 2019, 11:42 AM

clang-format

Harbormaster completed remote builds in B41189: Diff 230116.

Can we check sysctl for apple?

fhahn added a comment.Nov 19 2019, 2:43 PM

Can we check sysctl for apple?

sysctl would return AVX512 as optional, but I am not sure if that adds any value? As mentioned in the comment, Darwin will save the AXV512 context on AVX512 hardware on-demand. More details can be found here: https://github.com/apple/darwin-xnu/blob/master/osfmk/i386/fpu.c#L174

Can we check sysctl for apple?

sysctl would return AVX512 as optional, but I am not sure if that adds any value? As mentioned in the comment, Darwin will save the AXV512 context on AVX512 hardware on-demand. More details can be found here: https://github.com/apple/darwin-xnu/blob/master/osfmk/i386/fpu.c#L174

How long has that support been in Darwin. Is it possible someone might be using an old version of darwin that completely lacks avx512 support and tries to run -march=native on a recent CPU? I guess that can only happen in a hackintosh setup since any Apple system that supports avx512 would have proper kernel support.

This revision is now accepted and ready to land.Nov 19 2019, 11:26 PM
This revision was automatically updated to reflect the committed changes.