-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[RyuJIT] Change VEX-encoding selection to avoid AVX-SSE transition penalties #8966
Comments
@CarolEidt @BruceForstall Question. What is the purpose of |
FEATURE_AVX_SUPPORT is a compile-time flag that allows us to control whether the JIT will emit AVX instructions (at all). These FEATURE flags are often used when introducing a new feature that is not on be default. @BruceForstall can probably provide additional insight, but IMO this probably no longer works (i.e. if you turned it off, there are likely to be inconsistencies), so it might be best eliminated. It was a bit more useful when AVX was supported for x64 (x86/64) but not for x86(/32). |
@CarolEidt Thanks for the reply. If this flag is not useful for x64 and x86 anymore, I would like to eliminate. |
That would be great, but I'd like to hear from @BruceForstall whether he knows of any reason it should be kept. Thanks! |
@BruceForstall ping? |
I'm happy to have you eliminate this. I agree with Carol that this was mostly useful as bring-up, and when x64 and x86 didn't have parity here. Any code will still need to be under I can see only a couple potential snags: (1)
So, if you removed (2) It looks like we never changed our (internal) desktop RyuJIT/x86 build to define
We never enabled it for SIMD, either. We probably should enable both for both amd64 and x86 (in this file, 'i386'), but that's a Microsoft person should do. |
@BruceForstall @CarolEidt Thanks for the information, I will try and submit a PR later. |
Currently, RyuJIT generates AVX instructions (VEX-encoding) when AVX2 is available:
System.Numerics.Vector<T>
) has the size of 256-bit (YMM) on AVX2-capable machines and size of 128-bit (XMM) on machines that support AVX (Sandy Bridge) or blow ISA.However, we will broadly use AVX instructions via Intel hardware intrinsics even if the underlying hardware has no AVX2. Therefore, mixing use of
Avx
intrinsics and floating-point calculation (orSystem.Numerics.Vectors
) may trigger AVX-SSE transition penalties with the current codegen strategy. The new VEX-encoding selection strategy should be:System.Numerics.Vector<T>
) has the size of 256-bit (YMM) on AVX2-capable machines and size of 128-bit (XMM) on machines that support AVX (Sandy Bridge) or blow ISA. // no changeSystem.Numerics.Vectors
) is compiled to instructions that have VEX.128 prefix and operate over XMM registers on AVX-capable machines, but compiled to instructions that have VEX.256 prefix and operate over YMM registers on AVX2-capable machines.I will provide a PR after finish dotnet/coreclr#14020 .
The text was updated successfully, but these errors were encountered: