Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CPUID for AVX10.2 #109302

Merged
merged 5 commits into from
Nov 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add CPUID for AVX10.2
  • Loading branch information
khushal1996 committed Nov 20, 2024
commit 1d1317af7c5af5c8302f4116a1734b8fe205031b
1 change: 1 addition & 0 deletions src/coreclr/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
@@ -771,6 +771,7 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512F_VL, W("EnableAVX512F
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512VBMI, W("EnableAVX512VBMI"), 1, "Allows AVX512VBMI+ hardware intrinsics to be disabled")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX512VBMI_VL, W("EnableAVX512VBMI_VL"), 1, "Allows AVX512VBMI_VL+ hardware intrinsics to be disabled")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX10v1, W("EnableAVX10v1"), 1, "Allows AVX10v1+ hardware intrinsics to be disabled")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVX10v2, W("EnableAVX10v2"), 1, "Allows AVX10v2+ hardware intrinsics to be disabled")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableAVXVNNI, W("EnableAVXVNNI"), 1, "Allows AVXVNNI+ hardware intrinsics to be disabled")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableBMI1, W("EnableBMI1"), 1, "Allows BMI1+ hardware intrinsics to be disabled")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableBMI2, W("EnableBMI2"), 1, "Allows BMI2+ hardware intrinsics to be disabled")
154 changes: 104 additions & 50 deletions src/coreclr/inc/corinfoinstructionset.h
Original file line number Diff line number Diff line change
@@ -84,31 +84,36 @@ enum CORINFO_InstructionSet
InstructionSet_VectorT256=39,
InstructionSet_VectorT512=40,
InstructionSet_APX=41,
InstructionSet_X86Base_X64=42,
InstructionSet_SSE_X64=43,
InstructionSet_SSE2_X64=44,
InstructionSet_SSE3_X64=45,
InstructionSet_SSSE3_X64=46,
InstructionSet_SSE41_X64=47,
InstructionSet_SSE42_X64=48,
InstructionSet_AVX_X64=49,
InstructionSet_AVX2_X64=50,
InstructionSet_AES_X64=51,
InstructionSet_BMI1_X64=52,
InstructionSet_BMI2_X64=53,
InstructionSet_FMA_X64=54,
InstructionSet_LZCNT_X64=55,
InstructionSet_PCLMULQDQ_X64=56,
InstructionSet_POPCNT_X64=57,
InstructionSet_AVXVNNI_X64=58,
InstructionSet_X86Serialize_X64=59,
InstructionSet_AVX512F_X64=60,
InstructionSet_AVX512BW_X64=61,
InstructionSet_AVX512CD_X64=62,
InstructionSet_AVX512DQ_X64=63,
InstructionSet_AVX512VBMI_X64=64,
InstructionSet_AVX10v1_X64=65,
InstructionSet_AVX10v1_V512_X64=66,
InstructionSet_AVX10v2=42,
InstructionSet_AVX10v2_V512=43,
InstructionSet_X86Base_X64=44,
InstructionSet_SSE_X64=45,
InstructionSet_SSE2_X64=46,
InstructionSet_SSE3_X64=47,
InstructionSet_SSSE3_X64=48,
InstructionSet_SSE41_X64=49,
InstructionSet_SSE42_X64=50,
InstructionSet_AVX_X64=51,
InstructionSet_AVX2_X64=52,
InstructionSet_AES_X64=53,
InstructionSet_BMI1_X64=54,
InstructionSet_BMI2_X64=55,
InstructionSet_FMA_X64=56,
InstructionSet_LZCNT_X64=57,
InstructionSet_PCLMULQDQ_X64=58,
InstructionSet_POPCNT_X64=59,
InstructionSet_AVXVNNI_X64=60,
InstructionSet_X86Serialize_X64=61,
InstructionSet_AVX512F_X64=62,
InstructionSet_AVX512BW_X64=63,
InstructionSet_AVX512CD_X64=64,
InstructionSet_AVX512DQ_X64=65,
InstructionSet_AVX512VBMI_X64=66,
InstructionSet_AVX10v1_X64=67,
InstructionSet_AVX10v1_V512_X64=68,
InstructionSet_APX_X64=69,
InstructionSet_AVX10v2_X64=70,
InstructionSet_AVX10v2_V512_X64=71,
#endif // TARGET_AMD64
#ifdef TARGET_X86
InstructionSet_X86Base=1,
@@ -152,31 +157,36 @@ enum CORINFO_InstructionSet
InstructionSet_VectorT256=39,
InstructionSet_VectorT512=40,
InstructionSet_APX=41,
InstructionSet_X86Base_X64=42,
InstructionSet_SSE_X64=43,
InstructionSet_SSE2_X64=44,
InstructionSet_SSE3_X64=45,
InstructionSet_SSSE3_X64=46,
InstructionSet_SSE41_X64=47,
InstructionSet_SSE42_X64=48,
InstructionSet_AVX_X64=49,
InstructionSet_AVX2_X64=50,
InstructionSet_AES_X64=51,
InstructionSet_BMI1_X64=52,
InstructionSet_BMI2_X64=53,
InstructionSet_FMA_X64=54,
InstructionSet_LZCNT_X64=55,
InstructionSet_PCLMULQDQ_X64=56,
InstructionSet_POPCNT_X64=57,
InstructionSet_AVXVNNI_X64=58,
InstructionSet_X86Serialize_X64=59,
InstructionSet_AVX512F_X64=60,
InstructionSet_AVX512BW_X64=61,
InstructionSet_AVX512CD_X64=62,
InstructionSet_AVX512DQ_X64=63,
InstructionSet_AVX512VBMI_X64=64,
InstructionSet_AVX10v1_X64=65,
InstructionSet_AVX10v1_V512_X64=66,
InstructionSet_AVX10v2=42,
InstructionSet_AVX10v2_V512=43,
InstructionSet_X86Base_X64=44,
InstructionSet_SSE_X64=45,
InstructionSet_SSE2_X64=46,
InstructionSet_SSE3_X64=47,
InstructionSet_SSSE3_X64=48,
InstructionSet_SSE41_X64=49,
InstructionSet_SSE42_X64=50,
InstructionSet_AVX_X64=51,
InstructionSet_AVX2_X64=52,
InstructionSet_AES_X64=53,
InstructionSet_BMI1_X64=54,
InstructionSet_BMI2_X64=55,
InstructionSet_FMA_X64=56,
InstructionSet_LZCNT_X64=57,
InstructionSet_PCLMULQDQ_X64=58,
InstructionSet_POPCNT_X64=59,
InstructionSet_AVXVNNI_X64=60,
InstructionSet_X86Serialize_X64=61,
InstructionSet_AVX512F_X64=62,
InstructionSet_AVX512BW_X64=63,
InstructionSet_AVX512CD_X64=64,
InstructionSet_AVX512DQ_X64=65,
InstructionSet_AVX512VBMI_X64=66,
InstructionSet_AVX10v1_X64=67,
InstructionSet_AVX10v1_V512_X64=68,
InstructionSet_APX_X64=69,
InstructionSet_AVX10v2_X64=70,
InstructionSet_AVX10v2_V512_X64=71,
#endif // TARGET_X86

};
@@ -342,6 +352,12 @@ struct CORINFO_InstructionSetFlags
AddInstructionSet(InstructionSet_AVX10v1_X64);
if (HasInstructionSet(InstructionSet_AVX10v1_V512))
AddInstructionSet(InstructionSet_AVX10v1_V512_X64);
if (HasInstructionSet(InstructionSet_APX))
AddInstructionSet(InstructionSet_APX_X64);
if (HasInstructionSet(InstructionSet_AVX10v2))
AddInstructionSet(InstructionSet_AVX10v2_X64);
if (HasInstructionSet(InstructionSet_AVX10v2_V512))
AddInstructionSet(InstructionSet_AVX10v2_V512_X64);
#endif // TARGET_AMD64
#ifdef TARGET_X86
#endif // TARGET_X86
@@ -522,6 +538,18 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins
resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512);
if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512))
resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512_X64);
if (resultflags.HasInstructionSet(InstructionSet_APX) && !resultflags.HasInstructionSet(InstructionSet_APX_X64))
resultflags.RemoveInstructionSet(InstructionSet_APX);
if (resultflags.HasInstructionSet(InstructionSet_APX_X64) && !resultflags.HasInstructionSet(InstructionSet_APX))
resultflags.RemoveInstructionSet(InstructionSet_APX_X64);
if (resultflags.HasInstructionSet(InstructionSet_AVX10v2) && !resultflags.HasInstructionSet(InstructionSet_AVX10v2_X64))
resultflags.RemoveInstructionSet(InstructionSet_AVX10v2);
if (resultflags.HasInstructionSet(InstructionSet_AVX10v2_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX10v2))
resultflags.RemoveInstructionSet(InstructionSet_AVX10v2_X64);
if (resultflags.HasInstructionSet(InstructionSet_AVX10v2_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX10v2_V512_X64))
resultflags.RemoveInstructionSet(InstructionSet_AVX10v2_V512);
if (resultflags.HasInstructionSet(InstructionSet_AVX10v2_V512_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX10v2_V512))
resultflags.RemoveInstructionSet(InstructionSet_AVX10v2_V512_X64);
if (resultflags.HasInstructionSet(InstructionSet_SSE) && !resultflags.HasInstructionSet(InstructionSet_X86Base))
resultflags.RemoveInstructionSet(InstructionSet_SSE);
if (resultflags.HasInstructionSet(InstructionSet_SSE2) && !resultflags.HasInstructionSet(InstructionSet_SSE))
@@ -622,6 +650,10 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins
resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512);
if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL))
resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512);
if (resultflags.HasInstructionSet(InstructionSet_AVX10v2) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1))
resultflags.RemoveInstructionSet(InstructionSet_AVX10v2);
if (resultflags.HasInstructionSet(InstructionSet_AVX10v2_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512))
resultflags.RemoveInstructionSet(InstructionSet_AVX10v2_V512);
if (resultflags.HasInstructionSet(InstructionSet_Vector128) && !resultflags.HasInstructionSet(InstructionSet_SSE))
resultflags.RemoveInstructionSet(InstructionSet_Vector128);
if (resultflags.HasInstructionSet(InstructionSet_Vector256) && !resultflags.HasInstructionSet(InstructionSet_AVX))
@@ -736,6 +768,10 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins
resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512);
if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL))
resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512);
if (resultflags.HasInstructionSet(InstructionSet_AVX10v2) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1))
resultflags.RemoveInstructionSet(InstructionSet_AVX10v2);
if (resultflags.HasInstructionSet(InstructionSet_AVX10v2_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512))
resultflags.RemoveInstructionSet(InstructionSet_AVX10v2_V512);
if (resultflags.HasInstructionSet(InstructionSet_Vector128) && !resultflags.HasInstructionSet(InstructionSet_SSE))
resultflags.RemoveInstructionSet(InstructionSet_Vector128);
if (resultflags.HasInstructionSet(InstructionSet_Vector256) && !resultflags.HasInstructionSet(InstructionSet_AVX))
@@ -948,6 +984,16 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet)
return "VectorT512";
case InstructionSet_APX :
return "APX";
case InstructionSet_APX_X64 :
return "APX_X64";
case InstructionSet_AVX10v2 :
return "AVX10v2";
case InstructionSet_AVX10v2_X64 :
return "AVX10v2_X64";
case InstructionSet_AVX10v2_V512 :
return "AVX10v2_V512";
case InstructionSet_AVX10v2_V512_X64 :
return "AVX10v2_V512_X64";
#endif // TARGET_AMD64
#ifdef TARGET_X86
case InstructionSet_X86Base :
@@ -1032,6 +1078,10 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet)
return "VectorT512";
case InstructionSet_APX :
return "APX";
case InstructionSet_AVX10v2 :
return "AVX10v2";
case InstructionSet_AVX10v2_V512 :
return "AVX10v2_V512";
#endif // TARGET_X86

default:
@@ -1105,6 +1155,8 @@ inline CORINFO_InstructionSet InstructionSetFromR2RInstructionSet(ReadyToRunInst
case READYTORUN_INSTRUCTION_VectorT256: return InstructionSet_VectorT256;
case READYTORUN_INSTRUCTION_VectorT512: return InstructionSet_VectorT512;
case READYTORUN_INSTRUCTION_Apx: return InstructionSet_APX;
case READYTORUN_INSTRUCTION_Avx10v2: return InstructionSet_AVX10v2;
case READYTORUN_INSTRUCTION_Avx10v2_V512: return InstructionSet_AVX10v2_V512;
#endif // TARGET_AMD64
#ifdef TARGET_X86
case READYTORUN_INSTRUCTION_X86Base: return InstructionSet_X86Base;
@@ -1145,6 +1197,8 @@ inline CORINFO_InstructionSet InstructionSetFromR2RInstructionSet(ReadyToRunInst
case READYTORUN_INSTRUCTION_VectorT256: return InstructionSet_VectorT256;
case READYTORUN_INSTRUCTION_VectorT512: return InstructionSet_VectorT512;
case READYTORUN_INSTRUCTION_Apx: return InstructionSet_APX;
case READYTORUN_INSTRUCTION_Avx10v2: return InstructionSet_AVX10v2;
case READYTORUN_INSTRUCTION_Avx10v2_V512: return InstructionSet_AVX10v2_V512;
#endif // TARGET_X86

default:
10 changes: 5 additions & 5 deletions src/coreclr/inc/jiteeversionguid.h
Original file line number Diff line number Diff line change
@@ -43,11 +43,11 @@ typedef const GUID *LPCGUID;
#define GUID_DEFINED
#endif // !GUID_DEFINED

constexpr GUID JITEEVersionIdentifier = { /* 9014d652-5dc7-4edf-9285-6644d0898fb5 */
0x9014d652,
0x5dc7,
0x4edf,
{0x92, 0x85, 0x66, 0x44, 0xd0, 0x89, 0x8f, 0xb5}
constexpr GUID JITEEVersionIdentifier = { /* 15b8f677-894e-4671-9dc8-fc4e2c50e269 */
0x15b8f677,
0x894e,
0x4671,
{0x9d, 0xc8, 0xfc, 0x4e, 0x2c, 0x50, 0xe2, 0x69}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
2 changes: 2 additions & 0 deletions src/coreclr/inc/readytoruninstructionset.h
Original file line number Diff line number Diff line change
@@ -58,6 +58,8 @@ enum ReadyToRunInstructionSet
READYTORUN_INSTRUCTION_Apx=48,
READYTORUN_INSTRUCTION_Pclmulqdq_V256=49,
READYTORUN_INSTRUCTION_Pclmulqdq_V512=50,
READYTORUN_INSTRUCTION_Avx10v2=51,
READYTORUN_INSTRUCTION_Avx10v2_V512=52,

};

5 changes: 5 additions & 0 deletions src/coreclr/jit/hwintrinsic.cpp
Original file line number Diff line number Diff line change
@@ -807,6 +807,8 @@ static const HWIntrinsicIsaRange hwintrinsicIsaRangeArray[] = {
{ NI_Illegal, NI_Illegal }, // VectorT256
{ NI_Illegal, NI_Illegal }, // VectorT512
{ NI_Illegal, NI_Illegal }, // APX
{ NI_Illegal, NI_Illegal }, // AVX10v2
{ NI_Illegal, NI_Illegal }, // AVX10v2_V512
{ FIRST_NI_X86Base_X64, LAST_NI_X86Base_X64 },
{ FIRST_NI_SSE_X64, LAST_NI_SSE_X64 },
{ FIRST_NI_SSE2_X64, LAST_NI_SSE2_X64 },
@@ -832,6 +834,9 @@ static const HWIntrinsicIsaRange hwintrinsicIsaRangeArray[] = {
{ NI_Illegal, NI_Illegal }, // AVX512VBMI_X64
{ FIRST_NI_AVX10v1_X64, LAST_NI_AVX10v1_X64 },
{ NI_Illegal, NI_Illegal }, // AVX10v1_V512_X64
{ NI_Illegal, NI_Illegal }, // APX_X64
tannergooding marked this conversation as resolved.
Show resolved Hide resolved
{ NI_Illegal, NI_Illegal }, // AVX10v2_X64
{ NI_Illegal, NI_Illegal }, // AVX10v2_V512_X64
#elif defined (TARGET_ARM64)
{ FIRST_NI_ArmBase, LAST_NI_ArmBase },
{ FIRST_NI_AdvSimd, LAST_NI_AdvSimd },
1 change: 1 addition & 0 deletions src/coreclr/jit/jitconfigvalues.h
Original file line number Diff line number Diff line change
@@ -400,6 +400,7 @@ RELEASE_CONFIG_INTEGER(EnableAVX512F_VL, "EnableAVX512F_VL",
RELEASE_CONFIG_INTEGER(EnableAVX512VBMI, "EnableAVX512VBMI", 1) // Allows AVX512VBMI+ hardware intrinsics to be disabled
RELEASE_CONFIG_INTEGER(EnableAVX512VBMI_VL, "EnableAVX512VBMI_VL", 1) // Allows AVX512VBMI_VL+ hardware intrinsics to be disabled
RELEASE_CONFIG_INTEGER(EnableAVX10v1, "EnableAVX10v1", 1) // Allows AVX10v1+ hardware intrinsics to be disabled
RELEASE_CONFIG_INTEGER(EnableAVX10v2, "EnableAVX10v2", 1) // Allows AVX10v2+ hardware intrinsics to be disabled
RELEASE_CONFIG_INTEGER(EnableAVXVNNI, "EnableAVXVNNI", 1) // Allows AVXVNNI+ hardware intrinsics to be disabled
RELEASE_CONFIG_INTEGER(EnableBMI1, "EnableBMI1", 1) // Allows BMI1+ hardware intrinsics to be disabled
RELEASE_CONFIG_INTEGER(EnableBMI2, "EnableBMI2", 1) // Allows BMI2+ hardware intrinsics to be disabled
10 changes: 10 additions & 0 deletions src/coreclr/tools/Common/Compiler/HardwareIntrinsicHelpers.cs
Original file line number Diff line number Diff line change
@@ -80,6 +80,7 @@ private static class XArchIntrinsicConstants
public const int Evex = 0x80000;
public const int Apx = 0x100000;
public const int Vpclmulqdq = 0x200000;
public const int Avx10v2 = 0x400000;

public static void AddToBuilder(InstructionSetSupportBuilder builder, int flags)
{
@@ -145,6 +146,10 @@ public static void AddToBuilder(InstructionSetSupportBuilder builder, int flags)
if ((flags & Avx512) != 0)
builder.AddSupportedInstructionSet("vpclmul_v512");
}
if ((flags & Avx10v2) != 0)
builder.AddSupportedInstructionSet("avx10v2");
if (((flags & Avx10v2) != 0) && ((flags & Avx512) != 0))
builder.AddSupportedInstructionSet("avx10v2_v512");
}

public static int FromInstructionSet(InstructionSet instructionSet)
@@ -210,6 +215,11 @@ public static int FromInstructionSet(InstructionSet instructionSet)
InstructionSet.X64_APX => Apx,
InstructionSet.X64_PCLMULQDQ_V256 => Vpclmulqdq,
InstructionSet.X64_PCLMULQDQ_V512 => (Vpclmulqdq | Avx512),
InstructionSet.X64_APX_X64 => Apx,
InstructionSet.X64_AVX10v2 => Avx10v2,
InstructionSet.X64_AVX10v2_X64 => Avx10v2,
InstructionSet.X64_AVX10v2_V512 => (Avx10v2 | Avx512),
InstructionSet.X64_AVX10v2_V512_X64 => (Avx10v2 | Avx512),

// Baseline ISAs - they're always available
InstructionSet.X64_SSE => 0,
Original file line number Diff line number Diff line change
@@ -61,6 +61,8 @@ public enum ReadyToRunInstructionSet
Apx=48,
Pclmulqdq_V256=49,
Pclmulqdq_V512=50,
Avx10v2=51,
Avx10v2_V512=52,

}
}
Original file line number Diff line number Diff line change
@@ -123,6 +123,11 @@ public static class ReadyToRunInstructionSetHelper
case InstructionSet.X64_VectorT256: return ReadyToRunInstructionSet.VectorT256;
case InstructionSet.X64_VectorT512: return ReadyToRunInstructionSet.VectorT512;
case InstructionSet.X64_APX: return ReadyToRunInstructionSet.Apx;
case InstructionSet.X64_APX_X64: return ReadyToRunInstructionSet.Apx;
case InstructionSet.X64_AVX10v2: return ReadyToRunInstructionSet.Avx10v2;
case InstructionSet.X64_AVX10v2_X64: return ReadyToRunInstructionSet.Avx10v2;
case InstructionSet.X64_AVX10v2_V512: return ReadyToRunInstructionSet.Avx10v2_V512;
case InstructionSet.X64_AVX10v2_V512_X64: return ReadyToRunInstructionSet.Avx10v2_V512;

default: throw new Exception("Unknown instruction set");
}
@@ -198,6 +203,11 @@ public static class ReadyToRunInstructionSetHelper
case InstructionSet.X86_VectorT256: return ReadyToRunInstructionSet.VectorT256;
case InstructionSet.X86_VectorT512: return ReadyToRunInstructionSet.VectorT512;
case InstructionSet.X86_APX: return ReadyToRunInstructionSet.Apx;
case InstructionSet.X86_APX_X64: return null;
case InstructionSet.X86_AVX10v2: return ReadyToRunInstructionSet.Avx10v2;
case InstructionSet.X86_AVX10v2_X64: return null;
case InstructionSet.X86_AVX10v2_V512: return ReadyToRunInstructionSet.Avx10v2_V512;
case InstructionSet.X86_AVX10v2_V512_X64: return null;

default: throw new Exception("Unknown instruction set");
}
Loading