-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[arm64] These benchmarks are faster on Rosetta-x64 than on native arm64 #60616
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsThe following simple benchmarks are faster on Rosetta (x64 emulation) than on arm64 (native) Apple M1 mac mini. I think it's a clear sign something can be improved on arm64 side: using System;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
public enum MyEnum
{
A,B,C,D,E,F
}
public class Program
{
static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
[Benchmark]
[Arguments(MyEnum.F)]
public string EnumToString(MyEnum e) => e.ToString();
[Benchmark]
[Arguments(10000)]
public char[] AllocateUninit(int len) => GC.AllocateUninitializedArray<char>(len);
private static readonly int[] _array = Enumerable.Range(1, 1000).ToArray();
[Benchmark]
public void ArrayReverse() => Array.Reverse(_array);
} Rosetta (.NET 6.0 rc2 osx-x64):
Native (.NET 6.0 rc2 osx-arm64):
PS: I'm sure we'll find more such cases if we run the whole dotnet/performance suite on Rosetta vs native - I already launched a script to do so - it should finish in two days. /cc @dotnet/jit-contrib @dotnet/gc
|
That is strange, the sysctl that we call reports 4MB L2 cache size on my M1. |
Yes, I was wrong - the function reports 4Mb, I only wanted to note that wiki says it's 12Mb for performance cores, but I'm pretty sure it's not the reason for these issues. |
That's true. It seems that the OS reports the conservative value used by the energy efficient cores. I have checked and there doesn't seem to be other way to get the cache size using the sysctl, so I don't know if there is a way to get the performance core cache size. |
More benchmarks which are slower on arm64 M1 in comparison with M1-Rosetta on the same CPU:
|
Fixed with #64576 |
The following simple benchmarks are faster on Rosetta (x64 emulation) than on arm64 (native) on the same CPU "Apple M1 mac mini". I think it's a clear sign something can be improved on arm64 side:
Rosetta (.NET 6.0 rc2 osx-x64):
Native (.NET 6.0 rc2 osx-arm64):
AllocateUninit
andEnumToString
most likely are GC issues - not sure it's the same as #60166 as that function reports 2MB for LLC size (however, it might be less than the actual, see https://en.wikipedia.org/wiki/Apple_M1)PS: I'm sure we'll find more such cases if we run the whole dotnet/performance suite on Rosetta vs native - I already launched a script to do so - it should finish in two days.
/cc @dotnet/jit-contrib @dotnet/gc
The text was updated successfully, but these errors were encountered: