-
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
PGO: class profile details we need to get right #48549
Comments
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. |
instead of null, so that we won't over-estimate likelihood of other types at a call site where we see both collectible and non-collectible types. Addresses part of dotnet#48549.
instead of null, so that we won't over-estimate likelihood of other types at a call site where we see both collectible and non-collectible types. Addresses part of #48549.
Type Histogram MergingFrom the 21301.4 optimization data collection, we have 4 Looking at the offset 52 class probe we see (summarizing details below)
What should the merged table look like? Today we simply concatenate all the tables, producing a table of size 64, and sum all the counts, giving a net count of 159290. We then histogram the table and end up determining that the dominant entry is However, on a count-weighted basis, we arguably should would estimate the likelihood of
So because Also note that since the default table size in the runtime is 8, we can guess that the hello world What would a count-weighted merge look like? If we want to keep the Since we do N-way merges as a series of pairwise merges, let's look at the two table case first. Suppose we have tables Ti with counts Ci and sizes Si. Then a count-weighted merging algorithm would be something like the following:
We have some flexibility here in choosing the merged table size, but it does not seem unreasonable to make it larger than either input table, to try and better represent the full diversity of the merge results. This algorithm randomly samples from each table proportional to the count of observations in the table. To keep this semi-deterministic, the random seed would need to be some joint property of the tables, perhaps the hash of the method name augmented by the IL offset of the probe and the total count, or something similar. However, this won't pass the associativity test; that is merging N entries will be order sensitive. If we have three tables, merge(merge(T0, T1), T2) != merge(T0, merge(T1, T2)). This seems undesirable (though the "errors" here should be random). To have a fully general associative merge we'd need to form actual histograms and then merge them on a weight-adjusted basis. This requires a new schema type, analogous to ;; techempower
;; orchard core
;; hello world ;; first time
@jakobbotsch -- FYI in case you want to look into class profile merging. |
I think we are good enough now for .NET 6 -- we can revisit if we get evidence that the table size, merging, or sampling strategies are causing particular problems. |
dotnet-pgo
. See notes below.For the latter we should also consider enabling devirtualization (at least the analysis, if not the transformation) at Tier0 as there's no need to probe the class at a virtual or interface site if we know what the class must be. Need to experiment to see what fraction of class probes fall into that category.
category:cq
theme:profile-feedback
The text was updated successfully, but these errors were encountered: