Skip to content

Problem with AVX512 detection on macOS. #1854

@dbabokin

Description

@dbabokin

macOS has different way dealing with AVX512 than Windows and Linux:

  1. By default AVX512 is off in the newly created thread, which means CPUID flags will indicate AVX512 availability, but OS support check (XCR0) will not succeed.
  2. AVX512 can be enabled either by calling thread_set_state() or by executing any AVX512 instruction, which would cause #UD exception handled by the OS.

This results in ISPC auto-dispatch routing to AVX2 execution instead fo AVX512.

Arguments for not enabling AVX512 as part of the dispatch:

  • user need to opt-in for AVX512 explicitly, if AVX512 assumed to be called.

Arguments for enabling AVX512 as part of the dispatch:

  • if AVX512 target was built and is part of available targets for auto-dispatch, the user assumes to run AVX512 when it's available.

I'm leaning towards enabling AVX512 by default by disabling OS support check (XCR0) on macOS, so execution would trigger OS enabling the AVX512 as a result of execution of ISPC code.

Here's the link to Darwin code with comments on implementation on-demand AVX512 support: link to apple/darwin-xpu

Metadata

Metadata

Assignees

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