Skip to content

Commit

Permalink
Ensure the JIT consistently does opportunistic queries for its optimi…
Browse files Browse the repository at this point in the history
…zations (#87620)
  • Loading branch information
tannergooding authored Jun 15, 2023
1 parent 6899dec commit 35996db
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 81 deletions.
16 changes: 8 additions & 8 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -9109,31 +9109,31 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

#ifdef DEBUG
//------------------------------------------------------------------------
// IsBaselineVector512IsaSupportedDebugOnly - Does the target have isa support required for Vector512.
// IsBaselineVector512IsaSupportedDebugOnly - Does isa support exist for Vector512.
//
// Returns:
// `true` if AVX512F, AVX512BW and AVX512DQ are supported.
// `true` if AVX512F, AVX512BW, AVX512CD, AVX512DQ, and AVX512VL are supported.
//
bool IsBaselineVector512IsaSupportedDebugOnly() const
{
#ifdef TARGET_XARCH
return (compIsaSupportedDebugOnly(InstructionSet_Vector512));
return compIsaSupportedDebugOnly(InstructionSet_AVX512F);
#else
return false;
#endif
}
#endif // DEBUG

//------------------------------------------------------------------------
// IsBaselineVector512IsaSupported - Does the target have isa support required for Vector512.
// IsBaselineVector512IsaSupportedOpportunistically - Does opportunistic isa support exist for Vector512.
//
// Returns:
// `true` if AVX512F, AVX512BW and AVX512DQ are supported.
// `true` if AVX512F, AVX512BW, AVX512CD, AVX512DQ, and AVX512VL are supported.
//
bool IsBaselineVector512IsaSupported() const
bool IsBaselineVector512IsaSupportedOpportunistically() const
{
#ifdef TARGET_XARCH
return (compExactlyDependsOn(InstructionSet_Vector512));
return compOpportunisticallyDependsOn(InstructionSet_AVX512F);
#else
return false;
#endif
Expand Down Expand Up @@ -9169,7 +9169,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// otherwise use VEX encoding but can be EVEX encoded to use EVEX encoding
// This requires AVX512F, AVX512BW, AVX512CD, AVX512DQ, and AVX512VL support

if (JitConfig.JitStressEvexEncoding() && IsBaselineVector512IsaSupported())
if (JitConfig.JitStressEvexEncoding() && IsBaselineVector512IsaSupportedOpportunistically())
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F));
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F_VL));
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20513,7 +20513,7 @@ GenTree* Compiler::gtNewSimdCmpOpNode(

case GT_GE:
{
if (IsBaselineVector512IsaSupported())
if (IsBaselineVector512IsaSupportedOpportunistically())
{
if (simdSize == 64)
{
Expand Down Expand Up @@ -20608,7 +20608,7 @@ GenTree* Compiler::gtNewSimdCmpOpNode(

case GT_GT:
{
if (IsBaselineVector512IsaSupported())
if (IsBaselineVector512IsaSupportedOpportunistically())
{
if (simdSize == 64)
{
Expand Down Expand Up @@ -20810,7 +20810,7 @@ GenTree* Compiler::gtNewSimdCmpOpNode(

case GT_LE:
{
if (IsBaselineVector512IsaSupported())
if (IsBaselineVector512IsaSupportedOpportunistically())
{
if (simdSize == 64)
{
Expand Down Expand Up @@ -20905,7 +20905,7 @@ GenTree* Compiler::gtNewSimdCmpOpNode(

case GT_LT:
{
if (IsBaselineVector512IsaSupported())
if (IsBaselineVector512IsaSupportedOpportunistically())
{
if (simdSize == 64)
{
Expand Down Expand Up @@ -22788,7 +22788,7 @@ GenTree* Compiler::gtNewSimdNarrowNode(
GenTree* tmp3;
GenTree* tmp4;

if (IsBaselineVector512IsaSupported())
if (IsBaselineVector512IsaSupportedOpportunistically())
{
// This is the same in principle to the other comments below, however due to
// code formatting, its too long to reasonably display here.
Expand Down
7 changes: 2 additions & 5 deletions src/coreclr/jit/hwintrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ NamedIntrinsic HWIntrinsicInfo::lookupId(Compiler* comp,
}
else if (strcmp(className, "Vector512") == 0)
{
isa = InstructionSet_Vector512;
isa = InstructionSet_AVX512F;
}
}
#endif
Expand Down Expand Up @@ -600,10 +600,7 @@ NamedIntrinsic HWIntrinsicInfo::lookupId(Compiler* comp,
}
else if (isa == InstructionSet_Vector512)
{
// We support Vector512 intrinsics when AVX512F, AVX512BW, AVX512DQ are available.
if (!comp->compOpportunisticallyDependsOn(InstructionSet_AVX512F) &&
!comp->compOpportunisticallyDependsOn(InstructionSet_AVX512BW) &&
!comp->compOpportunisticallyDependsOn(InstructionSet_AVX512DQ))
if (!comp->IsBaselineVector512IsaSupportedOpportunistically())
{
return NI_Illegal;
}
Expand Down
Loading

0 comments on commit 35996db

Please sign in to comment.