33using System . IO ;
44using System . Linq ;
55using System . Text ;
6+ using BenchmarkDotNet . ConsoleArguments ;
67using BenchmarkDotNet . Environments ;
78using BenchmarkDotNet . Extensions ;
9+ using BenchmarkDotNet . Jobs ;
810using BenchmarkDotNet . Loggers ;
911using BenchmarkDotNet . Portability ;
1012using BenchmarkDotNet . Portability . Cpu ;
@@ -219,8 +221,20 @@ private string GetCurrentInstructionSet(Platform platform)
219221 => string . Join ( "," , GetCurrentProcessInstructionSets ( platform ) ) ;
220222
221223 // based on https://github.com/dotnet/runtime/blob/ce61c09a5f6fc71d8f717d3fc4562f42171869a0/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs#L727
222- private static IEnumerable < string > GetCurrentProcessInstructionSets ( Platform platform )
224+ private IEnumerable < string > GetCurrentProcessInstructionSets ( Platform platform )
223225 {
226+ if ( ! ConfigParser . TryParse ( TargetFrameworkMoniker , out RuntimeMoniker runtimeMoniker ) )
227+ {
228+ throw new NotSupportedException ( $ "Invalid TFM: '{ TargetFrameworkMoniker } '") ;
229+ }
230+
231+ if ( platform == RuntimeInformation . GetCurrentPlatform ( ) // "native" does not support cross-compilation (so does BDN for now)
232+ && runtimeMoniker >= RuntimeMoniker . NativeAot80 )
233+ {
234+ yield return "native" ; // added in .NET 8 https://github.com/dotnet/runtime/pull/87865
235+ yield break ;
236+ }
237+
224238 switch ( platform )
225239 {
226240 case Platform . X86 :
@@ -242,7 +256,7 @@ private static IEnumerable<string> GetCurrentProcessInstructionSets(Platform pla
242256 if ( HardwareIntrinsics . IsX86PclmulqdqSupported ) yield return "pclmul" ;
243257 if ( HardwareIntrinsics . IsX86PopcntSupported ) yield return "popcnt" ;
244258 if ( HardwareIntrinsics . IsX86AvxVnniSupported ) yield return "avxvnni" ;
245- if ( HardwareIntrinsics . IsX86SerializeSupported ) yield return "serialize" ;
259+ if ( HardwareIntrinsics . IsX86SerializeSupported && runtimeMoniker > RuntimeMoniker . NativeAot70 ) yield return "serialize" ; // https://github.com/dotnet/BenchmarkDotNet/issues/2463#issuecomment-1809625008
246260 break ;
247261 case Platform . Arm64 :
248262 if ( HardwareIntrinsics . IsArmBaseSupported ) yield return "base" ;
0 commit comments