Repository navigation
Regression from hoisting out of nested loop #71059
Description
Activity
- addeduntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
on Jun 21, 2022 - changed the title
[-][Perf] Changes at 6/14/2022 2:27:40 PM[/-][+]Regression from hoisting out of nested loop[/+]on Jun 21, 2022 Some other: dotnet/perf-autofiling-issues#6211 and dotnet/perf-autofiling-issues#6276
7 remaining items
Likewise for
Benchstone.BenchI.Array2, there is no change to the generated code that would have impacted the performance.I added a flag to disable "hoisting expression out of nested loop" in kunalspathak@a29daa4 to see what the impact is on performance post #70271. Hoisting doesn't change the generated code as seen in https://www.diffchecker.com/wQsuJBye. Here, left is code generated without "hoisting out of nested loop" and right is code generated with "hoisting out of nested loop" (same as main).
In fact, we hoist fetching upper/lower bounds out of nested loops as seen below.
So, to conclude, there could be regression from hoisting changes because of increasing register pressure, but MD optimizations bring that down. Also, by verifying the code without loop hoisting, we don't see much difference and we can conclude that it has not blocked any further improvements that we see in #71059 (comment). There is no further action needed for this issue, so I am closing it.
@kunalspathak, this regression showed up in multiple configurations while working on the monthly perf report. Should this regression be triaged as "by design"?
Thanks!
Details
Benchstone.BenchI.Array2.Test
Result Ratio Alloc Delta Operating System Bit Processor Name Slower 0.86 +0 Windows 11 Arm64 Microsoft SQ1 3.0 GHz Same 1.02 +0 Windows 11 Arm64 Microsoft SQ1 3.0 GHz Same 0.94 +0 macOS Monterey 12.3 Arm64 Apple M1 Max Slower 0.89 +0 Windows 10 X64 Intel Xeon CPU E5-1650 v4 3.60GHz Same 0.90 +0 Windows 10 X64 Intel Core i7-6700 CPU 3.40GHz (Skylake) Slower 0.64 +0 Windows 10 X64 Intel Core i7-6700 CPU 3.40GHz (Skylake) Slower 0.68 +0 Windows 10 X64 Intel Core i7-8650U CPU 1.90GHz (Kaby Lake R) Slower 0.87 +0 Windows 10 X64 Intel Core i9-10900K CPU 3.70GHz Same 0.95 +0 Windows 11 X64 AMD Ryzen Threadripper PRO 3945WX 12-Cores Same 1.01 +0 Windows 11 X64 AMD Ryzen 9 3950X Slower 0.89 +0 Windows 11 X64 AMD Ryzen 9 5900X Same 0.97 +0 Windows 11 X64 AMD Ryzen 9 5950X Slower 0.66 +0 Windows 11 X64 Intel Core i7-8700 CPU 3.20GHz (Coffee Lake) Same 0.94 +0 Windows 11 X64 Intel Core i9-10900K CPU 3.70GHz Slower 0.66 -288 Windows 11 X64 11th Gen Intel Core i9-11900H 2.50GHz Same 1.03 +0 ubuntu 18.04 X64 Intel Xeon CPU E5-1650 v4 3.60GHz Same 1.04 +0 ubuntu 18.04 X64 Intel Core i7-2720QM CPU 2.20GHz (Sandy Bridge) Slower 0.77 +0 ubuntu 18.04 X64 Intel Core i7-8700 CPU 3.20GHz (Coffee Lake) Same 0.93 +0 ubuntu 20.04 X64 AMD Ryzen 9 5900X Same 1.02 +0 ubuntu 20.04 X64 Intel Core i9-10900K CPU 3.70GHz Same 1.00 +0 Windows 10 X86 Intel Xeon CPU E5-1650 v4 3.60GHz Same 1.00 +0 Windows 10 X86 Intel Core i7-6700 CPU 3.40GHz (Skylake) Same 0.99 +0 Windows 11 X86 AMD Ryzen Threadripper PRO 3945WX 12-Cores Slower 0.85 +0 macOS Big Sur 11.6.8 X64 Intel Core i5-4278U CPU 2.60GHz (Haswell) Same 0.92 -672 macOS Monterey 12.3.1 X64 Intel Core i7-5557U CPU 3.10GHz (Broadwell) Same 0.91 +0 macOS Monterey 12.4 X64 Intel Core i5-4278U CPU 2.60GHz (Haswell) I re-checked the
Array2benchmarks on unix/x64 as well as on Arm64 with/without loop hoisting and nothing pops out. The code is definitely better where we hoist certain invariants outside the nested loop. There could be JCC erratum triggering (at least for unix x64 case) that is causing it. E.g. https://www.diffchecker.com/XdBiwwH4Other diffs are included in zip file for all the methods involved in the benchmark.
I will call it as "by design".
Reacted by Mukund Raghav Sharma (Moko)- ghost locked as resolved and limited conversation to collaborators
on Sep 8, 2022 - addedruntime-coreclrspecific to the CoreCLR runtimespecific to the CoreCLR runtimeos-linuxLinux OS (any supported distro)Linux OS (any supported distro)and removed
on Dec 28, 2022

Run Information
Regressions in Benchstone.MDBenchI.MDGeneralArray
Test Report
Repro
Details
Payloads
Baseline
Compare
Histogram
Benchstone.MDBenchI.MDGeneralArray.Test
Description of detection logic
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository
Regressions in Burgers
Test Report
Repro
Details
Payloads
Baseline
Compare
Histogram
Burgers.Test3
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 Benchstone.BenchI.Array2
Test Report
Repro
Details
Payloads
Baseline
Compare
Histogram
Benchstone.BenchI.Array2.Test
Description of detection logic
Docs
Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository