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
JIT: Slow spills to stack in a loop on Linux vs Windows #58522
here is the assembly diff for EnumerateItAll method between Win-x64 and Linux-x64: https://www.diffchecker.com/NorefcMS
Windows one looks much better and there are no spills in the Loop body leading to much better performance.
I've not investigated this one yet - from my understanding RangeEnumerator is passed by stack on win-x64 ABI and via registers on lin-x64. Is there anything we can do here for Linux or it's a dup for some "first class structs promotion" issue? cc @dotnet/jit-contrib @kunalspathak
Seems like this runs into a limitation of #36862 where if the number of fields of a multi-reg struct arg doesn't match the number of registers then the struct is not promoted. Here we have 3 int fields taking up 12 bytes, passed in 2 8-byte registers.
Would be easier to verify if the struct promotion code left a better debug trail.
Activity
WhiteBlackGoose commentedon Sep 2, 2021
To add a bit more details:
Here's the original method:
At the point where
returnhappens, it emits acallon Windows, but ajmpon Linux.Here's the full codegen for both linux and windows: gist.
Sorry if those details are irrelevant 😅, hope they add something to the discussion.
AndyAyersMS commentedon Sep 7, 2021
Seems like this runs into a limitation of #36862 where if the number of fields of a multi-reg struct arg doesn't match the number of registers then the struct is not promoted. Here we have 3
intfields taking up 12 bytes, passed in 2 8-byte registers.Would be easier to verify if the struct promotion code left a better debug trail.
AndyAyersMS commentedon Sep 7, 2021
Actually we hit an earlier bail out; we only support promotion on x64 if there are 1 or 2 fields:
runtime/src/coreclr/jit/lclvars.cpp
Lines 1958 to 1962 in 83f6621
jakobbotsch commentedon May 25, 2023
Codegen with physical promotion enabled:
We still spill as part of homing, but most importantly the loop ends up optimized.