[llvm] [memprof] Add call stack IDs to IndexedAllocationInfo (PR #85888)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 20 13:26:57 PDT 2024


================
@@ -445,14 +448,20 @@ Error RawMemProfReader::mapRawProfileToRecords() {
       Callstack.append(Frames.begin(), Frames.end());
     }
 
+    auto InsertResult =
+        CallStackToCallStackId.insert({Callstack, CallStacks.size()});
----------------
snehasish wrote:

As discussed offline, it might be better to use a content hash (I.e. hash of the frame IDs) as the call stack ID. You can refactor and reuse the frame ID hashing implementation here [1]  which is suitable for IDs meant to be persisted to disk. Factoring it out would also mean we can reuse it for @teresajohnson's use case of tagging callstacks with statistics. 

[1] https://github.com/llvm/llvm-project/blob/84115494d6475e1aea3cdd1163d3a88243b75f36/llvm/include/llvm/ProfileData/MemProf.h#L237-L253 

https://github.com/llvm/llvm-project/pull/85888


More information about the llvm-commits mailing list