Skip to content

Commit 917a050

Browse files
committed
Rework how EVEX+AVX512+AVX10 are supported by the JIT to greatly simplify things
1 parent d896e85 commit 917a050

39 files changed

+1554
-3619
lines changed

src/coreclr/inc/clrconfigvalues.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -682,16 +682,8 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableHWIntrinsic, W("EnableHWIntri
682682
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAES, W("EnableAES"), 1, "Allows AES+ hardware intrinsics to be disabled")
683683
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX, W("EnableAVX"), 1, "Allows AVX+ hardware intrinsics to be disabled")
684684
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX2, W("EnableAVX2"), 1, "Allows AVX2+ hardware intrinsics to be disabled")
685-
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512BW, W("EnableAVX512BW"), 1, "Allows AVX512BW+ hardware intrinsics to be disabled")
686-
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512BW_VL, W("EnableAVX512BW_VL"), 1, "Allows AVX512BW_VL+ hardware intrinsics to be disabled")
687-
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512CD, W("EnableAVX512CD"), 1, "Allows AVX512CD+ hardware intrinsics to be disabled")
688-
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512CD_VL, W("EnableAVX512CD_VL"), 1, "Allows AVX512CD_VL+ hardware intrinsics to be disabled")
689-
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512DQ, W("EnableAVX512DQ"), 1, "Allows AVX512DQ+ hardware intrinsics to be disabled")
690-
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512DQ_VL, W("EnableAVX512DQ_VL"), 1, "Allows AVX512DQ_VL+ hardware intrinsics to be disabled")
691-
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512F, W("EnableAVX512F"), 1, "Allows AVX512F+ hardware intrinsics to be disabled")
692-
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512F_VL, W("EnableAVX512F_VL"), 1, "Allows AVX512F_VL+ hardware intrinsics to be disabled")
685+
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512, W("EnableAVX512"), 1, "Allows AVX512+ hardware intrinsics to be disabled")
693686
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512VBMI, W("EnableAVX512VBMI"), 1, "Allows AVX512VBMI+ hardware intrinsics to be disabled")
694-
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512VBMI_VL, W("EnableAVX512VBMI_VL"), 1, "Allows AVX512VBMI_VL+ hardware intrinsics to be disabled")
695687
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX10v1, W("EnableAVX10v1"), 1, "Allows AVX10v1+ hardware intrinsics to be disabled")
696688
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX10v2, W("EnableAVX10v2"), 0, "Allows AVX10v2+ hardware intrinsics to be disabled")
697689
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVXVNNI, W("EnableAVXVNNI"), 1, "Allows AVXVNNI+ hardware intrinsics to be disabled")

src/coreclr/inc/corinfoinstructionset.h

Lines changed: 106 additions & 340 deletions
Large diffs are not rendered by default.

src/coreclr/inc/jiteeversionguid.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737

3838
#include <minipal/guid.h>
3939

40-
constexpr GUID JITEEVersionIdentifier = { /* 7ce8764d-ac60-4e05-a6e4-448c1eb8cf35 */
41-
0x7ce8764d,
42-
0xac60,
43-
0x4e05,
44-
{0xa6, 0xe4, 0x44, 0x8c, 0x1e, 0xb8, 0xcf, 0x35}
40+
constexpr GUID JITEEVersionIdentifier = { /* b7ac86be-0964-4559-a23b-bc3076c9be80 */
41+
0xb7ac86be,
42+
0x0964,
43+
0x4559,
44+
{0xa2, 0x3b, 0xbc, 0x30, 0x76, 0xc9, 0xbe, 0x80}
4545
};
4646

4747
#endif // JIT_EE_VERSIONING_GUID_H

src/coreclr/inc/readytoruninstructionset.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,18 @@ enum ReadyToRunInstructionSet
3737
READYTORUN_INSTRUCTION_Rcpc=26,
3838
READYTORUN_INSTRUCTION_Movbe=27,
3939
READYTORUN_INSTRUCTION_X86Serialize=28,
40-
READYTORUN_INSTRUCTION_Avx512F=29,
41-
READYTORUN_INSTRUCTION_Avx512F_VL=30,
42-
READYTORUN_INSTRUCTION_Avx512BW=31,
43-
READYTORUN_INSTRUCTION_Avx512BW_VL=32,
44-
READYTORUN_INSTRUCTION_Avx512CD=33,
45-
READYTORUN_INSTRUCTION_Avx512CD_VL=34,
46-
READYTORUN_INSTRUCTION_Avx512DQ=35,
47-
READYTORUN_INSTRUCTION_Avx512DQ_VL=36,
40+
READYTORUN_INSTRUCTION_Avx512=29,
4841
READYTORUN_INSTRUCTION_Avx512Vbmi=37,
49-
READYTORUN_INSTRUCTION_Avx512Vbmi_VL=38,
5042
READYTORUN_INSTRUCTION_VectorT128=39,
5143
READYTORUN_INSTRUCTION_VectorT256=40,
5244
READYTORUN_INSTRUCTION_VectorT512=41,
5345
READYTORUN_INSTRUCTION_Rcpc2=42,
5446
READYTORUN_INSTRUCTION_Sve=43,
5547
READYTORUN_INSTRUCTION_Avx10v1=44,
56-
READYTORUN_INSTRUCTION_Avx10v1_V512=46,
57-
READYTORUN_INSTRUCTION_EVEX=47,
5848
READYTORUN_INSTRUCTION_Apx=48,
5949
READYTORUN_INSTRUCTION_Pclmulqdq_V256=49,
6050
READYTORUN_INSTRUCTION_Pclmulqdq_V512=50,
6151
READYTORUN_INSTRUCTION_Avx10v2=51,
62-
READYTORUN_INSTRUCTION_Avx10v2_V512=52,
6352
READYTORUN_INSTRUCTION_Gfni=53,
6453
READYTORUN_INSTRUCTION_Gfni_V256=54,
6554
READYTORUN_INSTRUCTION_Gfni_V512=55,

src/coreclr/jit/codegencommon.cpp

Lines changed: 24 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,91 +1826,40 @@ void CodeGen::genGenerateMachineCode()
18261826

18271827
printf(" for ");
18281828

1829-
#if defined(TARGET_X86)
1829+
#if defined(TARGET_XARCH)
1830+
#if defined(TARGET_64BIT)
1831+
printf("generic X64");
1832+
#else
1833+
printf("generic X86");
1834+
#endif
1835+
18301836
// Check ISA directly here instead of using
18311837
// compOpportunisticallyDependsOn to avoid JIT-EE calls that could make
18321838
// us miss in SPMI
1833-
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_EVEX))
1834-
{
1835-
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v2))
1836-
{
1837-
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v2_V512))
1838-
{
1839-
printf("X86 with AVX10.2/512");
1840-
}
1841-
else
1842-
{
1843-
printf("X86 with AVX10.2/256");
1844-
}
1845-
}
1846-
else if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v1))
1847-
{
1848-
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v1_V512))
1849-
{
1850-
printf("X86 with AVX10.1/512");
1851-
}
1852-
else
1853-
{
1854-
printf("X86 with AVX10.1/256");
1855-
}
1856-
}
1857-
else
1858-
{
1859-
assert(compiler->compIsaSupportedDebugOnly(InstructionSet_AVX512F));
1860-
printf("X86 with AVX512");
1861-
}
1862-
}
1863-
else if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX))
1864-
{
1865-
printf("X86 with AVX");
1866-
}
1867-
else
1839+
1840+
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX))
18681841
{
1869-
printf("generic X86");
1842+
printf(" + VEX");
18701843
}
1871-
#elif defined(TARGET_AMD64)
1872-
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_EVEX))
1873-
{
1874-
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v2))
1875-
{
1876-
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v2_V512))
1877-
{
1878-
printf("X64 with AVX10.2/512");
1879-
}
1880-
else
1881-
{
1882-
printf("X64 with AVX10.2/256");
1883-
}
1884-
}
1885-
else if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v1))
1886-
{
1887-
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX10v1_V512))
1888-
{
1889-
printf("X64 with AVX10.1/512");
1890-
}
1891-
else
1892-
{
1893-
printf("X64 with AVX10.1/256");
1894-
}
1895-
}
1896-
else
1897-
{
1898-
assert(compiler->compIsaSupportedDebugOnly(InstructionSet_AVX512F));
1899-
printf("X64 with AVX512");
1900-
}
1901-
}
1902-
else if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX))
1844+
1845+
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_AVX512))
19031846
{
1904-
printf("X64 with AVX");
1847+
printf(" + EVEX");
19051848
}
1906-
else
1849+
1850+
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_APX))
19071851
{
1908-
printf("generic X64");
1852+
printf(" + APX");
19091853
}
19101854
#elif defined(TARGET_ARM)
19111855
printf("generic ARM");
19121856
#elif defined(TARGET_ARM64)
19131857
printf("generic ARM64");
1858+
1859+
if (compiler->opts.compSupportsISA.HasInstructionSet(InstructionSet_Sve))
1860+
{
1861+
printf(" + SVE");
1862+
}
19141863
#elif defined(TARGET_LOONGARCH64)
19151864
printf("generic LOONGARCH64");
19161865
#elif defined(TARGET_RISCV64)
@@ -1921,15 +1870,15 @@ void CodeGen::genGenerateMachineCode()
19211870

19221871
if (TargetOS::IsWindows)
19231872
{
1924-
printf(" - Windows");
1873+
printf(" on Windows");
19251874
}
19261875
else if (TargetOS::IsApplePlatform)
19271876
{
1928-
printf(" - Apple");
1877+
printf(" on Apple");
19291878
}
19301879
else if (TargetOS::IsUnix)
19311880
{
1932-
printf(" - Unix");
1881+
printf(" on Unix");
19331882
}
19341883

19351884
printf("\n");

src/coreclr/jit/codegenxarch.cpp

Lines changed: 28 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ void CodeGen::genSetRegToConst(regNumber targetReg, var_types targetType, simd_t
522522
case TYP_SIMD64:
523523
{
524524
simd64_t val64 = *(simd64_t*)val;
525-
if (val64.IsAllBitsSet() && compiler->compOpportunisticallyDependsOn(InstructionSet_AVX512F))
525+
if (val64.IsAllBitsSet() && compiler->compOpportunisticallyDependsOn(InstructionSet_AVX512))
526526
{
527527
emit->emitIns_SIMD_R_R_R_I(INS_vpternlogd, attr, targetReg, targetReg, targetReg,
528528
static_cast<int8_t>(0xFF), INS_OPTS_NONE);
@@ -5723,12 +5723,8 @@ void CodeGen::genCodeForStoreInd(GenTreeStoreInd* tree)
57235723
case NI_SSE41_X64_Extract:
57245724
case NI_AVX_ExtractVector128:
57255725
case NI_AVX2_ExtractVector128:
5726-
case NI_AVX512F_ExtractVector128:
5727-
case NI_AVX512F_ExtractVector256:
5728-
case NI_AVX512DQ_ExtractVector128:
5729-
case NI_AVX512DQ_ExtractVector256:
5730-
case NI_AVX10v1_V512_ExtractVector128:
5731-
case NI_AVX10v1_V512_ExtractVector256:
5726+
case NI_AVX512_ExtractVector128:
5727+
case NI_AVX512_ExtractVector256:
57325728
{
57335729
// These intrinsics are "ins reg/mem, xmm, imm8"
57345730
ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
@@ -5753,59 +5749,35 @@ void CodeGen::genCodeForStoreInd(GenTreeStoreInd* tree)
57535749
break;
57545750
}
57555751

5756-
case NI_AVX512F_ConvertToVector256Int32:
5757-
case NI_AVX512F_ConvertToVector256UInt32:
5758-
case NI_AVX512F_VL_ConvertToVector128UInt32:
5759-
case NI_AVX512F_VL_ConvertToVector128UInt32WithSaturation:
5760-
case NI_AVX10v1_ConvertToVector128UInt32:
5761-
case NI_AVX10v1_ConvertToVector128UInt32WithSaturation:
5752+
case NI_AVX512_ConvertToVector128UInt32:
5753+
case NI_AVX512_ConvertToVector128UInt32WithSaturation:
5754+
case NI_AVX512_ConvertToVector256Int32:
5755+
case NI_AVX512_ConvertToVector256UInt32:
57625756
{
57635757
assert(!varTypeIsFloating(baseType));
57645758
FALLTHROUGH;
57655759
}
57665760

5767-
case NI_AVX512F_ConvertToVector128Byte:
5768-
case NI_AVX512F_ConvertToVector128ByteWithSaturation:
5769-
case NI_AVX512F_ConvertToVector128Int16:
5770-
case NI_AVX512F_ConvertToVector128Int16WithSaturation:
5771-
case NI_AVX512F_ConvertToVector128SByte:
5772-
case NI_AVX512F_ConvertToVector128SByteWithSaturation:
5773-
case NI_AVX512F_ConvertToVector128UInt16:
5774-
case NI_AVX512F_ConvertToVector128UInt16WithSaturation:
5775-
case NI_AVX512F_ConvertToVector256Int16:
5776-
case NI_AVX512F_ConvertToVector256Int16WithSaturation:
5777-
case NI_AVX512F_ConvertToVector256Int32WithSaturation:
5778-
case NI_AVX512F_ConvertToVector256UInt16:
5779-
case NI_AVX512F_ConvertToVector256UInt16WithSaturation:
5780-
case NI_AVX512F_ConvertToVector256UInt32WithSaturation:
5781-
case NI_AVX512F_VL_ConvertToVector128Byte:
5782-
case NI_AVX512F_VL_ConvertToVector128ByteWithSaturation:
5783-
case NI_AVX512F_VL_ConvertToVector128Int16:
5784-
case NI_AVX512F_VL_ConvertToVector128Int16WithSaturation:
5785-
case NI_AVX512F_VL_ConvertToVector128Int32:
5786-
case NI_AVX512F_VL_ConvertToVector128Int32WithSaturation:
5787-
case NI_AVX512F_VL_ConvertToVector128SByte:
5788-
case NI_AVX512F_VL_ConvertToVector128SByteWithSaturation:
5789-
case NI_AVX512F_VL_ConvertToVector128UInt16:
5790-
case NI_AVX512F_VL_ConvertToVector128UInt16WithSaturation:
5791-
case NI_AVX512BW_ConvertToVector256Byte:
5792-
case NI_AVX512BW_ConvertToVector256ByteWithSaturation:
5793-
case NI_AVX512BW_ConvertToVector256SByte:
5794-
case NI_AVX512BW_ConvertToVector256SByteWithSaturation:
5795-
case NI_AVX512BW_VL_ConvertToVector128Byte:
5796-
case NI_AVX512BW_VL_ConvertToVector128ByteWithSaturation:
5797-
case NI_AVX512BW_VL_ConvertToVector128SByte:
5798-
case NI_AVX512BW_VL_ConvertToVector128SByteWithSaturation:
5799-
case NI_AVX10v1_ConvertToVector128Byte:
5800-
case NI_AVX10v1_ConvertToVector128ByteWithSaturation:
5801-
case NI_AVX10v1_ConvertToVector128Int16:
5802-
case NI_AVX10v1_ConvertToVector128Int16WithSaturation:
5803-
case NI_AVX10v1_ConvertToVector128Int32:
5804-
case NI_AVX10v1_ConvertToVector128Int32WithSaturation:
5805-
case NI_AVX10v1_ConvertToVector128SByte:
5806-
case NI_AVX10v1_ConvertToVector128SByteWithSaturation:
5807-
case NI_AVX10v1_ConvertToVector128UInt16:
5808-
case NI_AVX10v1_ConvertToVector128UInt16WithSaturation:
5761+
case NI_AVX512_ConvertToVector128Byte:
5762+
case NI_AVX512_ConvertToVector128ByteWithSaturation:
5763+
case NI_AVX512_ConvertToVector128Int16:
5764+
case NI_AVX512_ConvertToVector128Int16WithSaturation:
5765+
case NI_AVX512_ConvertToVector128Int32:
5766+
case NI_AVX512_ConvertToVector128Int32WithSaturation:
5767+
case NI_AVX512_ConvertToVector128SByte:
5768+
case NI_AVX512_ConvertToVector128SByteWithSaturation:
5769+
case NI_AVX512_ConvertToVector128UInt16:
5770+
case NI_AVX512_ConvertToVector128UInt16WithSaturation:
5771+
case NI_AVX512_ConvertToVector256Byte:
5772+
case NI_AVX512_ConvertToVector256ByteWithSaturation:
5773+
case NI_AVX512_ConvertToVector256Int16:
5774+
case NI_AVX512_ConvertToVector256Int16WithSaturation:
5775+
case NI_AVX512_ConvertToVector256Int32WithSaturation:
5776+
case NI_AVX512_ConvertToVector256SByte:
5777+
case NI_AVX512_ConvertToVector256SByteWithSaturation:
5778+
case NI_AVX512_ConvertToVector256UInt16:
5779+
case NI_AVX512_ConvertToVector256UInt16WithSaturation:
5780+
case NI_AVX512_ConvertToVector256UInt32WithSaturation:
58095781
{
58105782
// These intrinsics are "ins reg/mem, xmm"
58115783
ins = HWIntrinsicInfo::lookupIns(intrinsicId, baseType);
@@ -7411,7 +7383,7 @@ void CodeGen::genFloatToIntCast(GenTree* treeNode)
74117383
noway_assert((dstSize == EA_ATTR(genTypeSize(TYP_INT))) || (dstSize == EA_ATTR(genTypeSize(TYP_LONG))));
74127384

74137385
// We shouldn't be seeing uint64 here as it should have been converted
7414-
// into a helper call by either front-end or lowering phase, unless we have AVX512F/AVX10.x
7386+
// into a helper call by either front-end or lowering phase, unless we have AVX512
74157387
// accelerated conversions.
74167388
assert(!varTypeIsUnsigned(dstType) || (dstSize != EA_ATTR(genTypeSize(TYP_LONG))) ||
74177389
compiler->canUseEvexEncodingDebugOnly());

0 commit comments

Comments
 (0)