-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[mono] fix SIMD instructions' availability #34319
Conversation
I would expect that this wouldn't happen in practice, but I think it is still appropriate to model the underlying checks accurately so we aren't stuck with a breaking change in the future if that ever changes. For Intel, |
MONO_CPU_X86_FULL_SSEAVX_COMBINED = MONO_CPU_X86_FMA_COMBINED | MONO_CPU_X86_AVX2, | ||
MONO_CPU_X86_AVX2_COMBINED = MONO_CPU_X86_AVX_COMBINED | MONO_CPU_X86_AVX2, | ||
MONO_CPU_X86_FMA_COMBINED = MONO_CPU_X86_AVX_COMBINED | MONO_CPU_X86_FMA, | ||
MONO_CPU_X86_FULL_SSEAVX_COMBINED = MONO_CPU_X86_FMA_COMBINED | MONO_CPU_X86_AVX2 | MONO_CPU_X86_PCLMUL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name is a bit confusing, I'm not quite sure based on the name along, what is meant to be enabled by it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tannergooding it's only used internally to be able to disable SSE/AVX like that:
mattr=-sse3
=> disable sse3, also ssse3, sse4.1, etc (but don't touch lzcnt, bmi)
see here: https://github.com/dotnet/runtime/blob/master/src/mono/mono/mini/aot-compiler.c#L8109-L8111
it also matches llvm behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it allows to do things like this mcpu=native,mattr=-avx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and to match the hierarchy specified by the Intel/AMD architecture manuals.
The failing job is known and unrelated |
Fixes: #34304
@tannergooding @davidwrighton
Now it fully matches clang/LLVM behavior, e.g. even
-mattr=+avx2
(or-mavx2
in clang) doesn't enablepcmul
andaes
. However,-mattr=+sse4.2
(-msse4.2
) enablespopcnt
(see https://godbolt.org/z/RWAp_D). The intel manual saysSo is there a CPU with AVX set but without
popcnt
? The instruction is pretty useful (it is used in BCL) users might forget to define it when they usemattr=avx
(ormattr=avx2
).However in C++ world programmers use named groups e.g.
mcpu=haswell
rather than listing these sets via attributes.