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

[Perf] Regression in floating point math tests #49158

Open
DrewScoggins opened this issue Mar 4, 2021 · 4 comments
Open

[Perf] Regression in floating point math tests #49158

DrewScoggins opened this issue Mar 4, 2021 · 4 comments
Labels
arch-x64 area-System.Runtime os-linux Linux OS (any supported distro) tenet-performance Performance related issue tenet-performance-benchmarks Issue from performance benchmark
Milestone

Comments

@DrewScoggins
Copy link
Member

Run Information

Architecture x64
OS ubuntu 18.04
Baseline ee3f7daed083477689a4c6240025afa45ffa3352
Compare e093fe0fa650d17ec34e944f2a4a9bd2f2700109

Regressions in System.MathBenchmarks.Double

Benchmark Baseline Test Test/Base Baseline IR Compare IR IR Ratio Baseline ETL Compare ETL
Max 5.45 μs 6.53 μs 1.20

graph
Historical Data in Reporting System

Repro

git clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f netcoreapp5.0 --filter 'System.MathBenchmarks.Double*'

.

Payloads

Baseline
Compare

Histogram

System.MathBenchmarks.Double.Max

[5347.644 ; 5547.693) | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
[5547.693 ; 5805.447) | @@
[5805.447 ; 5991.886) | 
[5991.886 ; 6113.254) | 
[6113.254 ; 6299.693) | @@@@@@
[6299.693 ; 6561.623) | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Docs

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

Run Information

Architecture x64
OS ubuntu 18.04
Baseline ee3f7daed083477689a4c6240025afa45ffa3352
Compare e093fe0fa650d17ec34e944f2a4a9bd2f2700109

Regressions in SciMark2.kernel

Benchmark Baseline Test Test/Base Baseline IR Compare IR IR Ratio Baseline ETL Compare ETL
benchFFT 658.41 ms 698.96 ms 1.06

graph
Historical Data in Reporting System

Repro

git clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f netcoreapp5.0 --filter 'SciMark2.kernel*'

.

Payloads

Baseline
Compare

Histogram

SciMark2.kernel.benchFFT

[655729448.035 ; 676663647.642) | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
[676663647.642 ; 692503807.843) | @@@@
[692503807.843 ; 717552396.489) | @@@@@@@@@@@@@@@

Docs

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

Run Information

Architecture x64
OS ubuntu 18.04
Baseline ee3f7daed083477689a4c6240025afa45ffa3352
Compare e093fe0fa650d17ec34e944f2a4a9bd2f2700109

Regressions in System.MathBenchmarks.Single

Benchmark Baseline Test Test/Base Baseline IR Compare IR IR Ratio Baseline ETL Compare ETL
Log2 18.51 μs 21.75 μs 1.18
Exp 22.84 μs 25.08 μs 1.10

graph
graph
Historical Data in Reporting System

Repro

git clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f netcoreapp5.0 --filter 'System.MathBenchmarks.Single*'

.

Payloads

Baseline
Compare

Histogram

System.MathBenchmarks.Single.Log2

[18412.486 ; 19092.571) | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
[19092.571 ; 19487.627) | @
[19487.627 ; 19910.370) | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
[19910.370 ; 20523.385) | @@@@
[20523.385 ; 21025.635) | 
[21025.635 ; 21946.489) | @@@@@@@@@@@@

System.MathBenchmarks.Single.Exp

[22217.514 ; 22720.791) | @@@@@@@@@@@@@@@@@@@@@@@@@@
[22720.791 ; 23284.947) | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
[23284.947 ; 23819.070) | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
[23819.070 ; 24554.329) | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
[24554.329 ; 25305.906) | @@@@@@@@@@@@@@@@@
[25305.906 ; 25858.418) | 
[25858.418 ; 26410.931) | 
[26410.931 ; 27038.848) | 
[27038.848 ; 27585.087) | @
[27585.087 ; 28137.600) | 
[28137.600 ; 28690.112) | 
[28690.112 ; 29481.753) | @

Docs

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

@DrewScoggins DrewScoggins added os-linux Linux OS (any supported distro) tenet-performance Performance related issue tenet-performance-benchmarks Issue from performance benchmark arch-x64 labels Mar 4, 2021
@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.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Mar 4, 2021
@DrewScoggins
Copy link
Member Author

Suspect that this change, #44419, is the culprit. cc @briansull

@EgorBo
Copy link
Member

EgorBo commented Mar 7, 2021

I suspect CSE led to spills here.
Example:

static double MaxTest()
{
    double x = 0;
    for (int i = 0; i < 5000; i++)
        x += 0.0004;
    return x ;
}

Before we enabled CSE for floats:

G_M17817_IG01:
       vzeroupper 
						;; bbWeight=1    PerfScore 1.00
G_M17817_IG02:
       vxorps   xmm0, xmm0
       xor      eax, eax
       align    [0 bytes]
						;; bbWeight=1    PerfScore 0.83
G_M17817_IG03:
       vaddsd   xmm0, xmm0, qword ptr [reloc @RWD00]
       inc      eax
       cmp      eax, 0x1388
       jl       SHORT G_M17817_IG03
						;; bbWeight=4    PerfScore 26.00
G_M17817_IG04:
       ret      
						;; bbWeight=1    PerfScore 1.00
RWD00  	dq	3F3A36E2EB1C432Dh	;       0.0004

After:

G_M17817_IG01:
       vzeroupper 
						;; bbWeight=1    PerfScore 1.00
G_M17817_IG02:
       vxorps   xmm0, xmm0
       xor      eax, eax
+      vmovsd   xmm1, qword ptr [reloc @RWD00]
       align    [13 bytes]
						;; bbWeight=1    PerfScore 2.83
G_M17817_IG03:
-      vaddsd   xmm0, xmm0, qword ptr [reloc @RWD00]
+      vaddsd   xmm0, xmm0, xmm1
       inc      eax
       cmp      eax, 0x1388
       jl       SHORT G_M17817_IG03
						;; bbWeight=4    PerfScore 18.00
G_M17817_IG04:
       ret      
						;; bbWeight=1    PerfScore 1.00
RWD00  	dq	3F3A36E2EB1C432Dh	;       0.0004

More registers are involved. In this case it's OK, but when we have a lot of locals it leads to spills

@briansull
Copy link
Contributor

Yes, with CSE there is always a trade off involved.
So we will get some wins and a few losses.

@tannergooding tannergooding removed the untriaged New issue has not been triaged by the area owner label Jul 12, 2021
@tannergooding tannergooding added this to the Future milestone Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-x64 area-System.Runtime os-linux Linux OS (any supported distro) tenet-performance Performance related issue tenet-performance-benchmarks Issue from performance benchmark
Projects
None yet
Development

No branches or pull requests

5 participants