[PATCH] D147740: [NFC][llvm-profdata] Refactoring Sample Profile Reader to increase FDO build speed
Lei Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 10 10:53:28 PDT 2023
wlei added a comment.
Thanks for the improvement. I'm a bit concern if this results in any hash collision issue for CS profile. MD5 might be perfect for one function name, but for CS profile, this uses the "hash_combine_range", the context size can be very large, the probability of hash collision might be higher than non-CS profile.
================
Comment at: llvm/lib/ProfileData/SampleProfReader.cpp:661
+ if (FProfile.getContext() != FContext)
+ LLVM_DEBUG(errs() << "Hash collision detected: "
+ << FProfile.getContext().toString() << " and "
----------------
Here it checked hash collision during reading the context, it also could happen during writing time(profile generation time or merging profile time..).
================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:971
SampleContextFrames NewContext = *Contexts.insert(Context).first;
- auto Ret = ProfileMap.emplace(NewContext, std::move(*FProfile));
+ auto Ret = ProfileMap.insert(std::make_pair(
+ SampleContext(NewContext).getHashCode(), std::move(*FProfile)));
----------------
Here for profile generation time, if hash collision happens, the sample is lost.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147740/new/
https://reviews.llvm.org/D147740
More information about the llvm-commits
mailing list