Skip to content

Commit

Permalink
JIT: Check ISA directly when printing JitDisasm (#112828)
Browse files Browse the repository at this point in the history
`compOpportunisticallyDependsOn` does a JIT-EE call that can otherwise
make the compilation miss when `JitDisasm` is enabled.
  • Loading branch information
jakobbotsch authored Feb 24, 2025
1 parent 1d81756 commit 9b7b032
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1827,11 +1827,14 @@ void CodeGen::genGenerateMachineCode()
printf(" for ");

#if defined(TARGET_X86)
if (compiler->canUseEvexEncoding())
// Check ISA directly here instead of using
// compOpportunisticallyDependsOn to avoid JIT-EE calls that could make
// us miss in SPMI
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_EVEX))
{
if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v2))
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v2))
{
if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v2_V512))
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v2_V512))
{
printf("X86 with AVX10.2/512");
}
Expand All @@ -1840,9 +1843,9 @@ void CodeGen::genGenerateMachineCode()
printf("X86 with AVX10.2/256");
}
}
else if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v1))
else if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v1))
{
if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v1_V512))
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v1_V512))
{
printf("X86 with AVX10.1/512");
}
Expand All @@ -1857,7 +1860,7 @@ void CodeGen::genGenerateMachineCode()
printf("X86 with AVX512");
}
}
else if (compiler->canUseVexEncoding())
else if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX))
{
printf("X86 with AVX");
}
Expand All @@ -1866,11 +1869,11 @@ void CodeGen::genGenerateMachineCode()
printf("generic X86");
}
#elif defined(TARGET_AMD64)
if (compiler->canUseEvexEncoding())
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_EVEX))
{
if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v2))
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v2))
{
if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v2_V512))
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v2_V512))
{
printf("X64 with AVX10.2/512");
}
Expand All @@ -1879,9 +1882,9 @@ void CodeGen::genGenerateMachineCode()
printf("X64 with AVX10.2/256");
}
}
else if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v1))
else if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v1))
{
if (compiler->compOpportunisticallyDependsOn(InstructionSet_AVX10v1_V512))
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v1_V512))
{
printf("X64 with AVX10.1/512");
}
Expand All @@ -1896,7 +1899,7 @@ void CodeGen::genGenerateMachineCode()
printf("X64 with AVX512");
}
}
else if (compiler->canUseVexEncoding())
else if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX))
{
printf("X64 with AVX");
}
Expand Down

0 comments on commit 9b7b032

Please sign in to comment.