Change VEX-encoding selection to avoid AVX-SSE transition penalties#15014
Conversation
6448a36 to
fe06214
Compare
|
Tests passed on local Skylake (AVX2) and Ivy Bridge (AVX) machines. |
|
@CarolEidt @BruceForstall PTAL |
|
cc @dotnet/jit-contrib |
I believe that we explicitly do not want an additional SIMD level, as we don't want to multiply our test burden. |
CarolEidt
left a comment
There was a problem hiding this comment.
I want to be sure that:
- We are not generating AVX instructions in ngen/crossgen, and
- We aren't generating different code for AVX, aside from the encodings.
|
|
||
| // COMPlus_EnableAVX can be used to disable using AVX if available on a target machine. | ||
| opts.compCanUseAVX = false; | ||
| if (!jitFlags.IsSet(JitFlags::JIT_FLAG_PREJIT) && jitFlags.IsSet(JitFlags::JIT_FLAG_USE_AVX2)) |
There was a problem hiding this comment.
Where is this being handled now? This was the condition that caused us not to generate AVX code during crossgen, as we can't be assured that the target will be the same.
| { | ||
| assert(varTypeIsFloating(baseType)); | ||
| if (compiler->getSIMDSupportLevel() == SIMD_AVX2_Supported) | ||
| if (compiler->getSIMDSupportLevel() >= SIMD_AVX_Supported) |
There was a problem hiding this comment.
I don't believe we want to generate different code for the AVX case, to avoid multiplying our test matrix.
There was a problem hiding this comment.
But here is special. vmovss should use the sematics of "merge" (vmovss xmm1, xmm1, xmm2) rather than semtanc of "move`` (vmovss xmm1, xmm2, xmm2). Let me try to give a better solution.
@CarolEidt I see, will change. |
| if (configEnableISA(InstructionSet_AVX2)) | ||
| // COMPlus_EnableAVX is also used to control the code generation of | ||
| // System.Numerics.Vectors and floating-point arithmetics | ||
| if (configEnableISA(InstructionSet_AVX) && configEnableISA(InstructionSet_AVX2)) |
There was a problem hiding this comment.
Where is this being handled now? This was the condition that caused us not to generate AVX code during crossgen, as we can't be assured that the target will be the same.
@CarolEidt I am using InstructionSet_AVX and InstructionSet_AVX2 instead of UseAVX, which is already guarded by !jitFlags.IsSet(JitFlags::JIT_FLAG_PREJIT).
d49bb84 to
7cd4a89
Compare
|
Update
|
This PR changes VEX-encoding selection to resolve #14065.
UseAVXto two flags:UseVEXEncoding(AVX supported) andcompiler->getSIMDSupportLevel() == SIMD_AVX2_Supported.genSIMDScalarMove(constructors of Vector2/3/4).