Hardware intrinsic IsSupported checks may differ for nested types
Checking <Isa>.X64.IsSupported, where <Isa> refers to the classes in the System.Runtime.Intrinsics.X86 namespace, may now produce a different result to previous versions of .NET.
Tip
ISA stands for industry standard architecture.
Version introduced
5.0
Change description
In previous versions of .NET, some of the System.Runtime.Intrinsics.X86 hardware-intrinsic types, for example, System.Runtime.Intrinsics.X86.Aes, didn't expose a nested X64 class. For these types, calling <Isa>.X64.IsSupported resolved to an IsSupported property on a nested X64 class of a parent class of <Isa>. This meant that the property could return true even when <Isa>.IsSupported returns false.
In .NET 5 and later versions, all of the System.Runtime.Intrinsics.X86 types expose a nested X64 class that appropriately reports support. This ensures that the general hierarchy remains correct, and that if <Isa>.X64.IsSupported is true, then <Isa>.IsSupported can also be assumed to be true.
Reason for change
It was intended that if <Isa>.X64.IsSupported is true, <Isa>.IsSupported is also implied to be true. However, due to how member resolution works in C#, classes that didn't have a nested X64 class exposed a situation where this wasn't always the case and led to bugs in user code.
Recommended action
If necessary, adjust code that checks IsSupported to check for the appropriate ISA.
Affected APIs
- System.Runtime.Intrinsics.X86.Aes.X64.IsSupported
- System.Runtime.Intrinsics.X86.Avx.X64.IsSupported
- System.Runtime.Intrinsics.X86.Avx2.X64.IsSupported
- System.Runtime.Intrinsics.X86.Fma.X64.IsSupported
- System.Runtime.Intrinsics.X86.Pclmulqdq.X64.IsSupported
- System.Runtime.Intrinsics.X86.Sse3.X64.IsSupported
- System.Runtime.Intrinsics.X86.Ssse3.X64.IsSupported
Povratne informacije
Pošalјite i prikažite povratne informacije za