[PATCH] D109036: [CSSPGO] Sort function offset table to speed up profile loading.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 31 23:19:27 PDT 2021


hoy marked an inline comment as done.
hoy added inline comments.


================
Comment at: llvm/lib/ProfileData/SampleProfReader.cpp:813
+
+      if (OrderedFuncOffsets.get()) {
+        for (auto &NameOffset : *OrderedFuncOffsets)
----------------
wenlei wrote:
> When suggesting the removal of ordered switch, I was thinking about always have ordered offset table for extbin CSSPGO profile. The simplification in implementation is the main reason I think removing that switch is better.
> 
> The idea is that we don't need unnecessary flexibility, so we can make assumptions about CSSPGO profile and avoid the complexity of handling the combinations of different input. With that, we either assert SecFlagOrdered is always on for extbin CSSPGO profile, or remove SecFlagOrdered completely and make that an implicit assumption for extbin CSSPGO profile.  
Sounds good. This makes it cleaner.


================
Comment at: llvm/lib/ProfileData/SampleProfWriter.cpp:176
+  if (FunctionSamples::ProfileIsCS) {
+    // Sort the contexts before writing them out.
+    std::map<SampleContext, uint64_t> OrderedFuncOffsetTable(
----------------
wenlei wrote:
> In the comment here, it would be good to point out the need for sorting due to how importing works in prelink. Basically part of the comment from readFuncProfiles. 
Comment added.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109036/new/

https://reviews.llvm.org/D109036



More information about the llvm-commits mailing list