-
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
[Perf] Linux/arm64: 10 Regressions on 12/12/2022 1:43:17 AM #79876
Comments
Likely caused by 3689fbe |
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: @BrzVlad Issue DetailsRun Information
Regressions in System.Collections.CtorDefaultSizeNonGeneric
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Collections.CtorDefaultSizeNonGeneric*' PayloadsHistogramSystem.Collections.CtorDefaultSizeNonGeneric.Hashtable
Description of detection logic
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository
Regressions in System.Collections.Tests.Perf_BitArray
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Collections.Tests.Perf_BitArray*' PayloadsHistogramSystem.Collections.Tests.Perf_BitArray.BitArrayLengthCtor(Size: 4)
Description of detection logic
Description of detection logic
Description of detection logic
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Collections.CtorGivenSize<Int32>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Collections.CtorGivenSize<Int32>*' PayloadsHistogramSystem.Collections.CtorGivenSize<Int32>.Stack(Size: 512)
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Text.Tests.Perf_StringBuilder
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Text.Tests.Perf_StringBuilder*' PayloadsHistogramSystem.Text.Tests.Perf_StringBuilder.ctor_capacity(length: 100)
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Collections.CtorGivenSizeNonGeneric
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Collections.CtorGivenSizeNonGeneric*' PayloadsHistogramSystem.Collections.CtorGivenSizeNonGeneric.Queue(Size: 512)
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Tests.Perf_Random
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Tests.Perf_Random*' PayloadsHistogramSystem.Tests.Perf_Random.Next_int
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository
|
On interpreter I see two problems with the change. First is that we don't inline the throw helpers since they call other methods and are not marked as aggressive inlining. @stephentoub I assume CoreCLR generates more or less identical code with your change and does not suffer from these 2 problems ? |
Correct, e.g. this: using System.Runtime.CompilerServices;
internal class Program
{
static void Main()
{
while (true)
{
Test1(1);
Test2(1);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Test1(int value)
{
if (value < 0)
throw new ArgumentOutOfRangeException(nameof(value));
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Test2(int value)
{
ArgumentOutOfRangeException.ThrowIfNegative(value);
}
} produces this: ; Assembly listing for method Program:Test1(int)
; Emitting BLENDED_CODE for X64 CPU with AVX - Windows
; Tier-1 compilation
; optimized code
; rsp based frame
; partially interruptible
; No PGO data
G_M000_IG01: ;; offset=0000H
56 push rsi
4883EC20 sub rsp, 32
G_M000_IG02: ;; offset=0005H
85C9 test ecx, ecx
7C06 jl SHORT G_M000_IG04
G_M000_IG03: ;; offset=0009H
4883C420 add rsp, 32
5E pop rsi
C3 ret
G_M000_IG04: ;; offset=000FH
48B978DF9217FC7F0000 mov rcx, 0x7FFC1792DF78
E8D204B05F call CORINFO_HELP_NEWSFAST
488BF0 mov rsi, rax
B901000000 mov ecx, 1
48BAB81D8C17FC7F0000 mov rdx, 0x7FFC178C1DB8
E83BD5AF5F call CORINFO_HELP_STRCNS
488BD0 mov rdx, rax
488BCE mov rcx, rsi
FF1547E65300 call [System.ArgumentOutOfRangeException:.ctor(System.String):this]
488BCE mov rcx, rsi
E8A731A05F call CORINFO_HELP_THROW
CC int3
; Total bytes of code 74
; Assembly listing for method Program:Test2(int)
; Emitting BLENDED_CODE for X64 CPU with AVX - Windows
; Tier-1 compilation
; optimized code
; rsp based frame
; partially interruptible
; No PGO data
; 0 inlinees with PGO data; 1 single block inlinees; 1 inlinees without PGO data
G_M000_IG01: ;; offset=0000H
56 push rsi
4883EC20 sub rsp, 32
8BF1 mov esi, ecx
G_M000_IG02: ;; offset=0007H
85F6 test esi, esi
7C06 jl SHORT G_M000_IG04
G_M000_IG03: ;; offset=000BH
4883C420 add rsp, 32
5E pop rsi
C3 ret
G_M000_IG04: ;; offset=0011H
B901000000 mov ecx, 1
48BAB81D8C17FC7F0000 mov rdx, 0x7FFC178C1DB8
E8EBD4AF5F call CORINFO_HELP_STRCNS
488BC8 mov rcx, rax
8BD6 mov edx, esi
FF15D0295400 call [System.ArgumentOutOfRangeException:ThrowNegative[int](System.String,int)]
CC int3
; Total bytes of code 49 It's almost identical in the non-exceptional path: the only difference is an extra We could mark all of these as AggressiveInlining if it would help the interpreter. |
Presumably, LSRA limitation? cc @kunalspathak static void Foo(int a, int b)
{
if (a < 0)
Bar(b, a);
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Bar(int a, int b) { } ; Method Program:Foo(int,int)
8BC1 mov eax, ecx ;; <--
85C0 test eax, eax
7D0A jge SHORT G_M21919_IG05
8BCA mov ecx, edx
8BD0 mov edx, eax
FF2578779B00 tail.jmp [Program:Bar(int,int)]
G_M21919_IG05:
C3 ret
; Total bytes of code: 17 |
@BrzVlad follow-up on the issue |
@stephentoub I agree that we should mark these throw helpers with aggressive inlining. @EgorBo Do you know how exactly does coreclr optimizes operations from: |
Not near the computer to check this, but presumably you're talking about constant propagation during inlining (of a throw helper in this case). |
What about all of the myriad of other throw helpers we and others write? It sounds like the mono interpreter has a problem inlining the general pattern of: static void ThrowIf(bool condition)
{
if (condition) Throw();
}
static void Throw() => throw new Exception(); ? If so, wouldn't it be more comprehensive to address that in the interpreter? Presumably this is a pattern that shows up even outside of throw helpers fairly frequently, with a simple wrapper function that conditional delegates to something else. |
@BrzVlad could we address such pattern in the interpreter as @stephentoub suggested? If so, I can convert this issue to the |
We recently tweaked the interpreter to inline by default methods doing calls #83548. I don't think this issue serves any purpose anymore. |
Thanks, closing it. |
Run Information
Regressions in System.Collections.CtorDefaultSizeNonGeneric
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Collections.CtorDefaultSizeNonGeneric.Hashtable
Description of detection logic
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Regressions in System.Collections.Tests.Perf_BitArray
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Collections.Tests.Perf_BitArray.BitArrayLengthCtor(Size: 4)
Description of detection logic
Description of detection logic
Description of detection logic
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in System.Collections.CtorGivenSize<Int32>
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Collections.CtorGivenSize<Int32>.Stack(Size: 512)
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in System.Text.Tests.Perf_StringBuilder
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Text.Tests.Perf_StringBuilder.ctor_capacity(length: 100)
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in System.Collections.CtorGivenSizeNonGeneric
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Collections.CtorGivenSizeNonGeneric.Queue(Size: 512)
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in System.Tests.Perf_Random
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Tests.Perf_Random.Next_int
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
The text was updated successfully, but these errors were encountered: