-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Unexpected PGO schema divergence in a method that's both instrumented and optimized #85799
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsWith dynamic PGO we generally expect that the schema the jit produces when instrumenting will exactly match the one we expect to see when optimizing. I happened across this case in the asp.net collection where this isn't the case.
Here the jit is surprised to see that the schema edges (non-tree edges) don't match its own non-tree edges, and so it throws away all the profile dat. Digging back in the SPMI collection I found the compilation that produced that schema. It read in an existing static schema and then created a divergent dynamic schema:
The dynamic schema takes priority and any further jitting of this method then fails to incorporate the data. The issue seems to be that the spanning tree formation is impacted by the profile data that gets incorporated, in particular this bit of code: runtime/src/coreclr/jit/fgprofile.cpp Lines 1138 to 1141 in f924d6b
is reacting to the fact that the static profile has marked certain blocks as run rarely.
|
Conceptually simple fix, just reorder the instrumentation prep and incorporate profile phases. However they both use the We could have two fields, one for reading and one for writing, or try and remove the dependence on profile data when building a schema (that could break reading in current static profile data, but also might be the right fix). |
Otherwise the spanning tree we generate may be biased by the profile data and not match the spanning tree we generated in Tier0. Fixes dotnet#85799.
When the profile data comes from dynamic PGO, the spanning tree encoded in the schema produced by an earlier tier should exactly match the spanning tree for the current jit attempt, since the JIT and method IL are identical. (This is not the case for static PGO; that schema may have come from a different JIT and/or different version of IL). Note in release modes we won't assert; instead, we will silently throw the PGO data away. Follow-on change to dotnet#85805 to catch more issues like dotnet#85799.
When the profile data comes from dynamic PGO, the spanning tree encoded in the schema produced by an earlier tier should exactly match the spanning tree for the current jit attempt, since the JIT and method IL are identical. (This is not the case for static PGO; that schema may have come from a different JIT and/or different version of IL). Note in release modes we won't assert; instead, we will silently throw the PGO data away. Follow-on change to #85805 to catch more issues like #85799.
With dynamic PGO we generally expect that the schema the jit produces when instrumenting will exactly match the one we expect to see when optimizing. I happened across this case in the asp.net collection where this isn't the case.
Here the jit is surprised to see that the schema edges (non-tree edges) don't match its own non-tree edges, and so it throws away all the profile data.
Digging back in the SPMI collection I found the compilation that produced that schema. It read in an existing static schema and then created a divergent dynamic schema:
The dynamic schema takes priority and any further jitting of this method then fails to incorporate the data.
The issue seems to be that the spanning tree formation is impacted by the profile data that gets incorporated, in particular this bit of code:
runtime/src/coreclr/jit/fgprofile.cpp
Lines 1138 to 1141 in f924d6b
is reacting to the fact that the static profile has marked certain blocks as run rarely.
The text was updated successfully, but these errors were encountered: