-
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
Regressions from Roslyn update #80744
Comments
Run Information
Regressions in System.Numerics.Tests.Perf_VectorOf<Int32>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Numerics.Tests.Perf_VectorOf<Int32>*' PayloadsHistogramSystem.Numerics.Tests.Perf_VectorOf<Int32>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository
Regressions in System.Runtime.Intrinsics.Tests.Perf_Vector128Of<SByte>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Runtime.Intrinsics.Tests.Perf_Vector128Of<SByte>*' PayloadsHistogramSystem.Runtime.Intrinsics.Tests.Perf_Vector128Of<SByte>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Numerics.Tests.Perf_VectorOf<SByte>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Numerics.Tests.Perf_VectorOf<SByte>*' PayloadsHistogramSystem.Numerics.Tests.Perf_VectorOf<SByte>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Runtime.Intrinsics.Tests.Perf_Vector128Of<UInt64>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Runtime.Intrinsics.Tests.Perf_Vector128Of<UInt64>*' PayloadsHistogramSystem.Runtime.Intrinsics.Tests.Perf_Vector128Of<UInt64>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Runtime.Intrinsics.Tests.Perf_Vector128Of<Int16>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Runtime.Intrinsics.Tests.Perf_Vector128Of<Int16>*' PayloadsHistogramSystem.Runtime.Intrinsics.Tests.Perf_Vector128Of<Int16>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Runtime.Intrinsics.Tests.Perf_Vector128Of<Int32>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Runtime.Intrinsics.Tests.Perf_Vector128Of<Int32>*' PayloadsHistogramSystem.Runtime.Intrinsics.Tests.Perf_Vector128Of<Int32>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository |
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. |
Windows-x64 dotnet/perf-autofiling-issues#11738 |
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak Issue DetailsRun Information
Regressions in System.Numerics.Tests.Perf_VectorOf<Byte>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Numerics.Tests.Perf_VectorOf<Byte>*' PayloadsHistogramSystem.Numerics.Tests.Perf_VectorOf<Byte>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository
Regressions in System.Numerics.Tests.Perf_VectorOf<UInt16>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Numerics.Tests.Perf_VectorOf<UInt16>*' PayloadsHistogramSystem.Numerics.Tests.Perf_VectorOf<UInt16>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Runtime.Intrinsics.Tests.Perf_Vector128Of<UInt32>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Runtime.Intrinsics.Tests.Perf_Vector128Of<UInt32>*' PayloadsHistogramSystem.Runtime.Intrinsics.Tests.Perf_Vector128Of<UInt32>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Numerics.Tests.Perf_VectorOf<Double>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Numerics.Tests.Perf_VectorOf<Double>*' PayloadsHistogramSystem.Numerics.Tests.Perf_VectorOf<Double>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Tests.Perf_HashCode
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Tests.Perf_HashCode*' PayloadsHistogramSystem.Tests.Perf_HashCode.Combine_7
Description of detection logic
Description of detection logic
Description of detection logic
Description of detection logic
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.Numerics.Tests.Perf_VectorOf<Int64>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Numerics.Tests.Perf_VectorOf<Int64>*' PayloadsHistogramSystem.Numerics.Tests.Perf_VectorOf<Int64>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Runtime.Intrinsics.Tests.Perf_Vector128Of<Byte>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Runtime.Intrinsics.Tests.Perf_Vector128Of<Byte>*' PayloadsHistogramSystem.Runtime.Intrinsics.Tests.Perf_Vector128Of<Byte>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Runtime.Intrinsics.Tests.Perf_Vector128Of<UInt16>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Runtime.Intrinsics.Tests.Perf_Vector128Of<UInt16>*' PayloadsHistogramSystem.Runtime.Intrinsics.Tests.Perf_Vector128Of<UInt16>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Numerics.Tests.Perf_VectorOf<UInt32>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Numerics.Tests.Perf_VectorOf<UInt32>*' PayloadsHistogramSystem.Numerics.Tests.Perf_VectorOf<UInt32>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Numerics.Tests.Perf_VectorOf<UInt64>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Numerics.Tests.Perf_VectorOf<UInt64>*' PayloadsHistogramSystem.Numerics.Tests.Perf_VectorOf<UInt64>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Runtime.Intrinsics.Tests.Perf_Vector128Of<Int64>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Runtime.Intrinsics.Tests.Perf_Vector128Of<Int64>*' PayloadsHistogramSystem.Runtime.Intrinsics.Tests.Perf_Vector128Of<Int64>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository Run Information
Regressions in System.Numerics.Tests.Perf_VectorOf<Int16>
Reprogit clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.Numerics.Tests.Perf_VectorOf<Int16>*' PayloadsHistogramSystem.Numerics.Tests.Perf_VectorOf<Int16>.GetHashCodeBenchmark
Description of detection logic
DocsProfiling workflow for dotnet/runtime repository
|
So it is no longer inlined:
|
So I assume Roslyn has fixed some IL bug or something like that (e.g. dotnet/roslyn#64789) so this is not actionable |
The codegen difference in the screenshot above looks like the result of dotnet/roslyn#65642, related issue in dotnet/runtime is #73606. |
Performance impact of that change, FYI @jaredpar @AlekseyTs |
Is there a suggestion on how we can emit this code better? The runtime team asked us to fix a bug which to our knowledge requires the new codegen. Until we properly spill these values codegen can't fix their bug. |
I just wanted to let you know that we also try to track perf issues after Roslyn updates 🙂 - these regressions don't look bad to me at all honestly, the HashCode.Combine is perf critical, but the big performance difference is purely because of inlining. So I assume we can close this. Unless somebody thinks it should be improved. |
A copy is only needed when the receiver could actually be changed between loading its address and the constrained call. It is not the case in the above screenshot (and probably in most cases). However, it would of course require some analysis to determine whether it was safe to omit the copy. |
We do detect some arguments "safe" for reordering, but it was not our goal to be able to accurately detect "safety" for non-trivial scenarios. I assume that the argument in the scenario is not trivial, perhaps another method call or something similar. |
@AlekseyTs maybe I am missing something, but there are no args in the above screenshot -- the IL emitted before is
|
What C# code looks like? Perhaps the IL is different due to a different reason. Due to dotnet/roslyn#66250, for example. |
So actually dotnet/roslyn#66250 might be the cause after all? |
I think so. |
We can change the runtime implementation here to avoid the conditional access to fix this regression. However, it kind of puts us down a path of never using conditional access on generically typed values that may be structs. |
@jakobbotsch what about putting some level of “trust” in the C# language features such as “readonly members” as a way to determine “this method mutates vs not”? That is, rather than doing the complex analysis on the JIT side to determine if a non inlined method does mutate x, and would therefore require a copy to be preserved, we can check for the IsReadOnlyAttribute and use that as a much cheaper way of determining the same thing. There are of course unsafe scenarios where that may change the observed output, but it will be correct in the vast majority of cases and match how C# will itself emit code in other scenarios involving the same (minus generics because no “readonly” concept exists for reference types, hence the general regression here) That should allow us to much more trivially fix this case and improve codegen in a number of other places while also taking advantage of C# metadata that already tracks the info we care about |
We likely have all information we need to eliminate this copy in the vast majority of cases even today (e.g. in the above case we can see that the copy is the last use, so nothing fundamentally prevents us from removing it). But actually doing so requires #8887. |
Once we have #8887 I think it makes good sense to experiment with using |
Run Information
Regressions in System.Numerics.Tests.Perf_VectorOf<Byte>
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Numerics.Tests.Perf_VectorOf<Byte>.GetHashCodeBenchmark
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Regressions in System.Numerics.Tests.Perf_VectorOf<UInt16>
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Numerics.Tests.Perf_VectorOf<UInt16>.GetHashCodeBenchmark
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in System.Runtime.Intrinsics.Tests.Perf_Vector128Of<UInt32>
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Runtime.Intrinsics.Tests.Perf_Vector128Of<UInt32>.GetHashCodeBenchmark
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in System.Numerics.Tests.Perf_VectorOf<Double>
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Numerics.Tests.Perf_VectorOf<Double>.GetHashCodeBenchmark
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in System.Tests.Perf_HashCode
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Tests.Perf_HashCode.Combine_7
Description of detection logic
Description of detection logic
Description of detection logic
Description of detection logic
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.Numerics.Tests.Perf_VectorOf<Int64>
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Numerics.Tests.Perf_VectorOf<Int64>.GetHashCodeBenchmark
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in System.Runtime.Intrinsics.Tests.Perf_Vector128Of<Byte>
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Runtime.Intrinsics.Tests.Perf_Vector128Of<Byte>.GetHashCodeBenchmark
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in System.Runtime.Intrinsics.Tests.Perf_Vector128Of<UInt16>
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Runtime.Intrinsics.Tests.Perf_Vector128Of<UInt16>.GetHashCodeBenchmark
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in System.Numerics.Tests.Perf_VectorOf<UInt32>
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Numerics.Tests.Perf_VectorOf<UInt32>.GetHashCodeBenchmark
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in System.Numerics.Tests.Perf_VectorOf<UInt64>
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Numerics.Tests.Perf_VectorOf<UInt64>.GetHashCodeBenchmark
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in System.Runtime.Intrinsics.Tests.Perf_Vector128Of<Int64>
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Runtime.Intrinsics.Tests.Perf_Vector128Of<Int64>.GetHashCodeBenchmark
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Run Information
Regressions in System.Numerics.Tests.Perf_VectorOf<Int16>
Test Report
Repro
Payloads
Baseline
Compare
Histogram
System.Numerics.Tests.Perf_VectorOf<Int16>.GetHashCodeBenchmark
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: