This repository was archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Change VEX-encoding selection to avoid AVX-SSE transition penalties #15014
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2500,43 +2500,6 @@ void Compiler::compSetProcessor() | |
| // | ||
| CLANG_FORMAT_COMMENT_ANCHOR; | ||
|
|
||
| #ifdef _TARGET_XARCH_ | ||
| opts.compCanUseSSE4 = false; | ||
| if (!jitFlags.IsSet(JitFlags::JIT_FLAG_PREJIT) && jitFlags.IsSet(JitFlags::JIT_FLAG_USE_SSE41) && | ||
| jitFlags.IsSet(JitFlags::JIT_FLAG_USE_SSE42)) | ||
| { | ||
| if (JitConfig.EnableSSE3_4() != 0) | ||
| { | ||
| opts.compCanUseSSE4 = true; | ||
| } | ||
| } | ||
|
|
||
| // 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)) | ||
| { | ||
| if (JitConfig.EnableAVX() != 0) | ||
| { | ||
| opts.compCanUseAVX = true; | ||
| } | ||
| } | ||
|
|
||
| if (!compIsForInlining()) | ||
| { | ||
| if (opts.compCanUseAVX) | ||
| { | ||
| codeGen->getEmitter()->SetUseAVX(true); | ||
| // Assume each JITted method does not contain AVX instruction at first | ||
| codeGen->getEmitter()->SetContainsAVX(false); | ||
| codeGen->getEmitter()->SetContains256bitAVX(false); | ||
| } | ||
| else if (opts.compCanUseSSE4) | ||
| { | ||
| codeGen->getEmitter()->SetUseSSE4(true); | ||
| } | ||
| } | ||
| #endif // _TARGET_XARCH_ | ||
|
|
||
| #ifdef _TARGET_AMD64_ | ||
| opts.compUseFCOMI = false; | ||
| opts.compUseCMOV = true; | ||
|
|
@@ -2620,7 +2583,9 @@ void Compiler::compSetProcessor() | |
| } | ||
| if (jitFlags.IsSet(JitFlags::JIT_FLAG_USE_AVX2)) | ||
| { | ||
| 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)) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@CarolEidt I am using |
||
| { | ||
| opts.setSupportedISA(InstructionSet_AVX2); | ||
| } | ||
|
|
@@ -2697,6 +2662,31 @@ void Compiler::compSetProcessor() | |
| } | ||
| } | ||
| } | ||
|
|
||
| opts.compCanUseSSE4 = false; | ||
| if (!jitFlags.IsSet(JitFlags::JIT_FLAG_PREJIT) && jitFlags.IsSet(JitFlags::JIT_FLAG_USE_SSE41) && | ||
| jitFlags.IsSet(JitFlags::JIT_FLAG_USE_SSE42)) | ||
| { | ||
| if (JitConfig.EnableSSE3_4() != 0) | ||
| { | ||
| opts.compCanUseSSE4 = true; | ||
| } | ||
| } | ||
|
|
||
| if (!compIsForInlining()) | ||
| { | ||
| if (canUseVexEncoding()) | ||
| { | ||
| codeGen->getEmitter()->SetUseVEXEncoding(true); | ||
| // Assume each JITted method does not contain AVX instruction at first | ||
| codeGen->getEmitter()->SetContainsAVX(false); | ||
| codeGen->getEmitter()->SetContains256bitAVX(false); | ||
| } | ||
| else if (CanUseSSE4()) | ||
| { | ||
| codeGen->getEmitter()->SetUseSSE4(true); | ||
| } | ||
| } | ||
| #endif | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.