Skip to content
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

Regressions in System.Threading.Tests.Perf_Lock #79408

Closed
performanceautofiler bot opened this issue Dec 8, 2022 · 9 comments
Closed

Regressions in System.Threading.Tests.Perf_Lock #79408

performanceautofiler bot opened this issue Dec 8, 2022 · 9 comments
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI tenet-performance Performance related issue tenet-performance-benchmarks Issue from performance benchmark
Milestone

Comments

@performanceautofiler
Copy link

Run Information

Architecture arm64
OS Windows 10.0.19041
Baseline 3f51e1449f78041bd4f213602f2bbfa4af321dde
Compare 4ce23f46ed20683a1b6649e9a43e09459007c9d8
Diff Diff

Regressions in System.Threading.Tests.Perf_Lock

Benchmark Baseline Test Test/Base Test Quality Edge Detector Baseline IR Compare IR IR Ratio Baseline ETL Compare ETL
ReaderWriterLockSlimPerf - Duration of single invocation 27.52 ns 31.28 ns 1.14 0.29 False

graph
Test Report

Repro

git clone https://github.com/dotnet/performance.git
py .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Threading.Tests.Perf_Lock*'

Payloads

Baseline
Compare

Histogram

System.Threading.Tests.Perf_Lock.ReaderWriterLockSlimPerf


Description of detection logic

IsRegressionChecked: Marked as regression because the three check build points were 0.05 greater than the baseline.
IsImprovementBase: Marked as not an improvement because the compare was not 5% less than the baseline, or the value was too small.
IsRegressionBase: Marked as regression because the compare was 5% greater than the baseline, and the value was not too small.
IsRegressionChecked: Marked as regression because the three check build points were 0.05 greater than the baseline.
IsRegressionWindowed: Marked as regression because 31.277895484004436 > 28.89098714960821.
IsChangePoint: Marked as a change because one of 12/2/2022 9:06:56 PM, 12/8/2022 3:49:24 AM falls between 11/29/2022 2:55:01 PM and 12/8/2022 3:49:24 AM.
IsRegressionStdDev: Marked as regression because -3.8699101464857404 (T) = (0 -32.26726895312294) / Math.Sqrt((5.026255417921273 / (22)) + (11.34885565459455 / (13))) is less than -2.034515297446192 = MathNet.Numerics.Distributions.StudentT.InvCDF(0, 1, (22) + (13) - 2, .025) and -0.14399453580674726 = (28.205789401229957 - 32.26726895312294) / 28.205789401229957 is less than -0.05.
IsImprovementBase: Marked as not an improvement because the compare was not 5% less than the baseline, or the value was too small.
IsChangeEdgeDetector: Marked not as a regression because Edge Detector said so.

Docs

Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository

@performanceautofiler performanceautofiler bot added arm64 untriaged New issue has not been triaged by the area owner labels Dec 8, 2022
@cincuranet cincuranet removed refs/heads/main untriaged New issue has not been triaged by the area owner labels Dec 8, 2022
@cincuranet cincuranet transferred this issue from dotnet/perf-autofiling-issues Dec 8, 2022
@dotnet-issue-labeler
Copy link

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.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Dec 8, 2022
@cincuranet
Copy link
Contributor

cincuranet commented Dec 8, 2022

Probably caused by #79096. Is that expected @stephentoub?

@cincuranet cincuranet added tenet-performance Performance related issue tenet-performance-benchmarks Issue from performance benchmark area-System.Threading.Tasks labels Dec 8, 2022
@ghost
Copy link

ghost commented Dec 8, 2022

Tagging subscribers to this area: @dotnet/area-system-threading-tasks
See info in area-owners.md if you want to be subscribed.

Issue Details

Run Information

Architecture arm64
OS Windows 10.0.19041
Baseline 3f51e1449f78041bd4f213602f2bbfa4af321dde
Compare 4ce23f46ed20683a1b6649e9a43e09459007c9d8
Diff Diff

Regressions in System.Threading.Tests.Perf_Lock

Benchmark Baseline Test Test/Base Test Quality Edge Detector Baseline IR Compare IR IR Ratio Baseline ETL Compare ETL
ReaderWriterLockSlimPerf - Duration of single invocation 27.52 ns 31.28 ns 1.14 0.29 False

graph
Test Report

Repro

git clone https://github.com/dotnet/performance.git
py .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Threading.Tests.Perf_Lock*'

Payloads

Baseline
Compare

Histogram

System.Threading.Tests.Perf_Lock.ReaderWriterLockSlimPerf


Description of detection logic

IsRegressionChecked: Marked as regression because the three check build points were 0.05 greater than the baseline.
IsImprovementBase: Marked as not an improvement because the compare was not 5% less than the baseline, or the value was too small.
IsRegressionBase: Marked as regression because the compare was 5% greater than the baseline, and the value was not too small.
IsRegressionChecked: Marked as regression because the three check build points were 0.05 greater than the baseline.
IsRegressionWindowed: Marked as regression because 31.277895484004436 > 28.89098714960821.
IsChangePoint: Marked as a change because one of 12/2/2022 9:06:56 PM, 12/8/2022 3:49:24 AM falls between 11/29/2022 2:55:01 PM and 12/8/2022 3:49:24 AM.
IsRegressionStdDev: Marked as regression because -3.8699101464857404 (T) = (0 -32.26726895312294) / Math.Sqrt((5.026255417921273 / (22)) + (11.34885565459455 / (13))) is less than -2.034515297446192 = MathNet.Numerics.Distributions.StudentT.InvCDF(0, 1, (22) + (13) - 2, .025) and -0.14399453580674726 = (28.205789401229957 - 32.26726895312294) / 28.205789401229957 is less than -0.05.
IsImprovementBase: Marked as not an improvement because the compare was not 5% less than the baseline, or the value was too small.
IsChangeEdgeDetector: Marked not as a regression because Edge Detector said so.

Docs

Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository

Author: performanceautofiler[bot]
Assignees: EgorBo
Labels:

area-System.Threading.Tasks, tenet-performance, tenet-performance-benchmarks, untriaged

Milestone: -

@cincuranet cincuranet changed the title [Perf] Windows/arm64: 1 Regression on 12/3/2022 2:55:34 AM Regressions in System.Threading.Tests.Perf_Lock Dec 8, 2022
@stephentoub
Copy link
Member

stephentoub commented Dec 8, 2022

@EgorBo, in this example:
SharpLab
is it expected that in the manually-inlined case we get:

L0004: cmp byte ptr [rcx+8], 0

but in the JIT-inlined case we get:

L0004: movzx eax, byte ptr [rcx+8]
L0008: test eax, eax

?

using System;

public class C
{
    private bool _disposed;
    
    public void M1()
    {
        if (_disposed)
        {
            Throw();
        }
    }
    
    public void M2()
    {
        ThrowIf(_disposed);
    }
    
    private static void ThrowIf(bool condition)
    {
        if (condition)
        {
            Throw();
        }
    }
    
    private static void Throw() => throw new ObjectDisposedException(null);
}
C.M1()
    L0000: sub rsp, 0x28
    L0004: cmp byte ptr [rcx+8], 0
    L0008: jne short L000f
    L000a: add rsp, 0x28
    L000e: ret
    L000f: call 0x00007fff66550078
    L0014: int3

C.M2()
    L0000: sub rsp, 0x28
    L0004: movzx eax, byte ptr [rcx+8]
    L0008: test eax, eax
    L000a: jne short L0011
    L000c: add rsp, 0x28
    L0010: ret
    L0011: call 0x00007fff66550078
    L0016: int3

@stephentoub stephentoub added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI and removed area-System.Threading.Tasks labels Jan 20, 2023
@ghost
Copy link

ghost commented Jan 20, 2023

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak
See info in area-owners.md if you want to be subscribed.

Issue Details

Run Information

Architecture arm64
OS Windows 10.0.19041
Baseline 3f51e1449f78041bd4f213602f2bbfa4af321dde
Compare 4ce23f46ed20683a1b6649e9a43e09459007c9d8
Diff Diff

Regressions in System.Threading.Tests.Perf_Lock

Benchmark Baseline Test Test/Base Test Quality Edge Detector Baseline IR Compare IR IR Ratio Baseline ETL Compare ETL
ReaderWriterLockSlimPerf - Duration of single invocation 27.52 ns 31.28 ns 1.14 0.29 False

graph
Test Report

Repro

git clone https://github.com/dotnet/performance.git
py .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Threading.Tests.Perf_Lock*'

Payloads

Baseline
Compare

Histogram

System.Threading.Tests.Perf_Lock.ReaderWriterLockSlimPerf


Description of detection logic

IsRegressionChecked: Marked as regression because the three check build points were 0.05 greater than the baseline.
IsImprovementBase: Marked as not an improvement because the compare was not 5% less than the baseline, or the value was too small.
IsRegressionBase: Marked as regression because the compare was 5% greater than the baseline, and the value was not too small.
IsRegressionChecked: Marked as regression because the three check build points were 0.05 greater than the baseline.
IsRegressionWindowed: Marked as regression because 31.277895484004436 > 28.89098714960821.
IsChangePoint: Marked as a change because one of 12/2/2022 9:06:56 PM, 12/8/2022 3:49:24 AM falls between 11/29/2022 2:55:01 PM and 12/8/2022 3:49:24 AM.
IsRegressionStdDev: Marked as regression because -3.8699101464857404 (T) = (0 -32.26726895312294) / Math.Sqrt((5.026255417921273 / (22)) + (11.34885565459455 / (13))) is less than -2.034515297446192 = MathNet.Numerics.Distributions.StudentT.InvCDF(0, 1, (22) + (13) - 2, .025) and -0.14399453580674726 = (28.205789401229957 - 32.26726895312294) / 28.205789401229957 is less than -0.05.
IsImprovementBase: Marked as not an improvement because the compare was not 5% less than the baseline, or the value was too small.
IsChangeEdgeDetector: Marked not as a regression because Edge Detector said so.

Docs

Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository

Author: performanceautofiler[bot]
Assignees: EgorBo
Labels:

tenet-performance, tenet-performance-benchmarks, area-CodeGen-coreclr, untriaged

Milestone: -

@JulieLeeMSFT JulieLeeMSFT removed the untriaged New issue has not been triaged by the area owner label Jan 24, 2023
@JulieLeeMSFT JulieLeeMSFT added this to the 8.0.0 milestone Jan 24, 2023
@EgorBo
Copy link
Member

EgorBo commented Mar 27, 2023

It seems like a missing oportunity for Forward Sub:

STMT00004
               [000010] -A-XG------                         *  ASG       bool  
               [000009] D------N---                         +--*  LCL_VAR   bool   V02 tmp1         
               [000001] ---XG------                         \--*  FIELD     bool   C:_disposed
               [000000] -----------                            \--*  LCL_VAR   ref    V00 this

STMT00002
               [000007] -----------                         *  JTRUE     void  
               [000006] -----------                         \--*  EQ        int   
               [000004] -----------                            +--*  LCL_VAR   int    V02 tmp1
               [000005] -----------                            \--*  CNS_INT   int    0

cc @AndyAyersMS @jakobbotsch

can we substitute bool to int?

@jakobbotsch
Copy link
Member

Currently there is an early out for it:

// Next statement seems suitable.
// See if we can forward sub without changing semantics.
//
// Bail if types disagree.
// Might be able to tolerate these by retyping.
//
if (fsv.GetNode()->TypeGet() != fwdSubNode->TypeGet())
{
JITDUMP(" mismatched types (substitution)\n");
return false;
}

I'm not sure what issues were hit without the check, I think we can allow it by potentially inserting a cast (and there is already some logic to handle that, though only for normalize-on-store -- may need to be handled for normalize-on-load too).

@jakobbotsch
Copy link
Member

I opened #83969 for it.

@EgorBo
Copy link
Member

EgorBo commented Jun 9, 2023

image

Dynamic PGO "fixed" it

@EgorBo EgorBo closed this as completed Jun 9, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jul 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI tenet-performance Performance related issue tenet-performance-benchmarks Issue from performance benchmark
Projects
None yet
Development

No branches or pull requests

5 participants