-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[mono] Performance regression in many places caused by #77562 #78163
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: @dotnet/area-system-runtime-intrinsics Issue DetailsWe see many large regressions caused by #77562 Microbenchmarks issues: dotnet/perf-autofiling-issues#9599
|
/cc @tannergooding |
@radekdoulik are any of these for the intrinsic path or are they all for the software fallback? It looks like the latter in which case, this should be closed as "by design". Developers aren't expect to be using the software fallback and should realistically only be using these paths when Changes to improve code maintainability and correctness for the non-accelerated path have always been accepted here. |
I was able to reproduce the regression in browser-bench too and confirm that the regression is caused by #77562 The repro Add https://gist.github.com/radekdoulik/e4d61f21d0b592c48b664a6deafb9dc8 to the src\mono\sample\wasm\browser-bench and run the benchmark in the browser with url options On my local machine I measure these results.
With regression:
|
Sounds like a case where browser/WASM doesn't have the necessary SIMD acceleration yet and so the results should be ignored for that platform until |
We don't have SIMD enabled by default yet, so the I think the regressions here are too large and so we would like to understand what is going on. It might be a bug in the mono runtime or something else. |
In the case of things like Similar fixes were taken elsewhere as well. This results in more logic having to be done for the software fallback and means that a regression will be visible when Like I mentioned, the software fallback is not meant or expected to be used. It's there to support scenarios like the debugger and simple correctness validation on platforms without acceleration. We expose Because of this, results should likely be ignored for any target where |
@vargaz when I check the difference in
I think the important difference is the added I am going to look further into it, you might spot it faster though I guess. Also note that I am away tomorrow. This is the complete regressed functuion.
|
These regressions are also showing up on llvm-aot where we should have support for intrinsics, but there maybe something else going on preventing them from being used. @fanyang-mono Should intrinsics end up used here on llvm? I have been trying to repro to investigate but ran into some unrelated issues building. |
That makes sense. OTOH I wonder why it is now 4-6 times slower in things like |
Perhaps Mono has acceleration for The fallback was changed to be an explicit loop to help ensure consistency and correctness across the board. It also highlights if SIMD acceleration isn't enabled for the method and therefore potential missed optimization opportunities for modern hardware. |
The Vector microbenchmarks were written with generics. For the llvm-aot runs, those microbenchmarks methods would fall back to mini JIT. Mono mini JIT doesn't support SIMD intrinsics yet, so they are currently using the software fallback version. That's why they are experiencing regression as well. |
I was blind and didn't notice the I think it is incorrect. It should return |
With the #78177 the times are back to:
|
…hods containing type equality checks. For example, calls to Vector<T>.IsSupported cannot be optimized away in a method where T is T_BYTE because its written as: ``` get => (typeof(T) == typeof(byte)) || (typeof(T) == typeof(double)) || ``` and T_BYTE could be instantiated with an enum whose basetype is byte. Fixes some of the issues in dotnet#78163.
#78182) * [mono][aot] Prefer concrete instances instead of gshared ones for methods containing type equality checks. For example, calls to Vector<T>.IsSupported cannot be optimized away in a method where T is T_BYTE because its written as: ``` get => (typeof(T) == typeof(byte)) || (typeof(T) == typeof(double)) || ``` and T_BYTE could be instantiated with an enum whose basetype is byte. Fixes some of the issues in #78163. * Avoid an assert when compiling Vector<object> instances.
We see many large regressions caused by #77562
Microbenchmarks issues:
dotnet/perf-autofiling-issues#9599
dotnet/perf-autofiling-issues#9612
dotnet/perf-autofiling-issues#9636
dotnet/perf-autofiling-issues#9637
The text was updated successfully, but these errors were encountered: