You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
System.Collections.Sort<BigStruct>.LinqQuery has regressed on all configs except Windows 64 bit #66776
I guess there are sample events but not ones that perfview recognizes?
In case of EventPipe we just get different CPU samples (events emitted by the .NET Runtime, not the OS). In PerfView you need to open the "Thread Time" view (not "CPU Stacks" like usual):
Or you can take the .speedscope file generated by BDN:
Despire this, perf on windows generally seems better (around 53us). Note the store above is misaligned (as is the store in linux's CompareAnyKeys) if that matters.
Also note that in Compare the struct copy is really not needed. Seems like forward sub (or morph's copy prop) should get this case, but neither one sees the use:
;; tmp1 is single use
***** BB03
STMT00003 ( 0x010[E-] ... ??? )
[000027] -A--------- * ASG struct (copy)
[000025] D------N--- +--* LCL_VAR struct<System.Collections.BigStruct, 32> V04 tmp1
[000013] n---------- \--* OBJ struct<System.Collections.BigStruct, 32>
[000012] ----------- \--* ADDR byref
[000010] -------N--- \--* LCL_VAR struct<System.Collections.BigStruct, 32> V02 arg2
***** BB03
STMT00009 ( INL01 @ 0x000[E-] ... ??? ) <- INLRT @ 0x010[E-]
[000058] -A--------- * ASG int
[000057] D------N--- +--* LCL_VAR int V06 tmp3
[000022] ----------- \--* FIELD int _int1
[000021] ----------- \--* ADDR byref
[000020] -------N--- \--* LCL_VAR struct<System.Collections.BigStruct, 32> V04 tmp1
;; fwd sub
[000027]: no next stmt use
;; morph
In BB01 New Local Copy Assertion: V04 == V02, index = #01
fgMorphTree BB01, STMT00009 (before)
[000058] -A--------- * ASG int
[000057] D------N--- +--* LCL_VAR int V06 tmp3
[000022] ----------- \--* LCL_FLD int V04 tmp1 [+12]
Activity
AndyAyersMS commentedon Mar 17, 2022
#59287 is locked so doesn't get cross linked. That seems unfortunate.
That change should have purely impacted jit diagnostics, so it's unlikely to have caused regressions.
AndyAyersMS commentedon Aug 8, 2022
Digging through it looks like we expected this to be resolved -- see dotnet/perf-autofiling-issues#1501 (comment)
But that only fixed issues on Windows, Ubuntu did not benefit. So we still have a regression.
(Windows is slightly worse off too)
AndyAyersMS commentedon Aug 8, 2022
Looks like this is still unassigned. I'll take it for now.
AndyAyersMS commentedon Aug 8, 2022
Can reproduce running locally (via wsl2)
AndyAyersMS commentedon Aug 8, 2022
@adamsitnik is it expected that with
-p EPI won't get cpu sample events? If so, any way to enable these via the command line?AndyAyersMS commentedon Aug 8, 2022
Hmm, I guess there are sample events but not ones that perfview recognizes?
AndyAyersMS commentedon Aug 9, 2022
From the above I can get a crude profile of sorts. But not sure it is helping me spot which method(s) have regressed.
adamsitnik commentedon Aug 9, 2022
In case of EventPipe we just get different CPU samples (events emitted by the .NET Runtime, not the OS). In PerfView you need to open the "Thread Time" view (not "CPU Stacks" like usual):
Or you can take the
.speedscopefile generated by BDN:and open it with speedscope
AndyAyersMS commentedon Aug 9, 2022
Still didn't find that very helpful. But here's perf (via WSL2) on the two:
If this is credible then the issue is in this bit of code.
versus
AndyAyersMS commentedon Aug 9, 2022
Note with AVX/AVX2 disabled 6 and 7 match perf (and match 6 with avx enabled)
BenchmarkDotNet=v0.13.1.1823-nightly, OS=ubuntu 20.04
Intel Core i7-8700 CPU 3.20GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
.NET SDK=7.0.100-rc.1.22408.1
[Host] : .NET 6.0.7 (6.0.722.32202), X64 RyuJIT
Job-KAQRRV : .NET 6.0.7 (6.0.722.32202), X64 RyuJIT
Job-SXOIEW : .NET 7.0.0 (7.0.22.40308), X64 RyuJIT
EnvironmentVariables=COMPlus_EnableAVX2=0,COMPlus_EnableAVX=0 PowerPlanMode=00000000-0000-0000-0000-000000000000 InvocationCount=5000
IterationTime=250.0000 ms MaxIterationCount=20 MinIterationCount=15
MinWarmupIterationCount=6 UnrollFactor=1 WarmupCount=-1
Going to modify the jit so I can do this per-method and see if just disabling AVX for the comparer explains the perf loss.
AndyAyersMS commentedon Aug 9, 2022
Looks like the regression comes from the use of YMM registers in the two hottest methods above
System.Linq.EnumerableSorter2[BigStruct,BigStruct][System.Collections.BigStruct,System.Collections.BigStruct]:CompareAnyKeys(int,int)`System.Collections.Generic.GenericComparer1[BigStruct][System.Collections.BigStruct]::Compare`In both cases there is a YMM store closely followed by a narrower load:
AndyAyersMS commentedon Aug 10, 2022
On windows, there is similar codegen in
Comparebut not inCompareAnyKeys-- the latter because of ABI differences.Despire this, perf on windows generally seems better (around 53us). Note the store above is misaligned (as is the store in linux's
CompareAnyKeys) if that matters.Also note that in
Comparethe struct copy is really not needed. Seems like forward sub (or morph's copy prop) should get this case, but neither one sees the use:AndyAyersMS commentedon Aug 11, 2022
Verified this is mitigated with the preliminary changes from #73719.
This is beyond the scope of what we can fix for .net7, so I think we're going to have to live with this regression.
AndyAyersMS commentedon Aug 31, 2022
This should be fixed by #74384.
AndyAyersMS commentedon Sep 2, 2022
(ubuntu x64)