-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[Bolt] issue about using std::hash in YamlProfileReader and its test case #65241
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
Comments
@llvm/issue-subscribers-bolt |
Thanks for bringing this up. We should fix this since it fails with libcxx, perhaps by switching to xxh3 just like in couple other places in llvm. |
std::hash is C++ STL implementation-specific. Switch to xxh3 as the fast and STL-independent alternative for basic block hashes which are exposed to users in YAML profile. Fixes llvm#65241.
Hi @aaupov , it looks like a sound solution, and it would be nicer if you could also fix the other two std::hash usages in |
Yes, but modifying stale matching hashes creates a problem that checked in tests no longer match the intended way. Leaving the issue open. |
@llvm/issue-subscribers-good-first-issue
it seems that bolt tries to match block counts based on hashes generated from std::hash when the data is yaml format. However, std::hash does not guarantee the result will be the same from different setups.
I recently used a llvm-bolt linked against libc++, and it failed on test case X86/reader-stale-yaml.test, since the std::hash results are different from these two libraries... <img width="505" alt="image" src="https://github.com/llvm/llvm-project/assets/47880367/6e7dd792-37ba-48d7-80c8-6b84897f3a94"> |
std::hash and ADT/Hashing::hash_value are non-deterministic functions whose results might vary across implementation/process/execution. Using xxh3 instead for computing hashes of BinaryFunctions and BinaryBasicBlock for stale profile matching. (A possible alternative is to use ADT/StableHashing.h based on FNV hashing but xxh3 seems to be more popular in LLVM) This is to address #65241.
it seems that bolt tries to match block counts based on hashes generated from std::hash when the data is yaml format. However, std::hash does not guarantee the result will be the same from different setups.
I recently used a llvm-bolt linked against libc++, and it failed on test case X86/reader-stale-yaml.test, since the std::hash results are different from these two libraries...
The text was updated successfully, but these errors were encountered: