This is an archive of the discontinued LLVM Phabricator instance.

[CodeView] Replace GHASH hasher by BLAKE3
ClosedPublic

Authored by aganea on Oct 31 2022, 12:25 PM.

Details

Summary

We already discussed this in the past: SHA1 in GloballyHashedType::hashType() is coming top in the profiles. By simply replacing with BLAKE3, the link time is reduced from 15 sec to 13 sec. I am only using MSVC .OBJs in this case. As a reference, the resulting .PDB is approx 2.1GiB and .EXE is approx 250MiB.

Before:

After:

Diff Detail

Event Timeline

aganea created this revision.Oct 31 2022, 12:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 31 2022, 12:25 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
aganea requested review of this revision.Oct 31 2022, 12:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 31 2022, 12:25 PM
aganea updated this revision to Diff 472098.Oct 31 2022, 12:27 PM
rnk added a subscriber: akyrtzi.Oct 31 2022, 12:43 PM

Thanks for making the code change! In our usage with clang-cl, this should appear as a small improvement in compile times.

Please add clang and lld release notes ("switched from SHA1 to BLAKE3 for PDB type hashing / -gcodeview-ghash"):
https://github.com/llvm/llvm-project/blob/main/lld/docs/ReleaseNotes.rst#id9
https://github.com/llvm/llvm-project/blob/main/clang/docs/ReleaseNotes.rst#windows-support

@akyrtzi , FYI, thanks again for adding blake3 support.

llvm/lib/DebugInfo/CodeView/TypeHashing.cpp
79–80

Can this just be return {S.final()}?

@akyrtzi , FYI, thanks again for adding blake3 support.

I'm glad it's getting adopted :)

thieta accepted this revision.Nov 2 2022, 5:03 AM

Very nice! Thanks for adding this @aganea! I agree we should have a release note about it - otherwise it LGTM!

This revision is now accepted and ready to land.Nov 2 2022, 5:03 AM

@aganea Do you still plan to land this?

@aganea Do you still plan to land this?

Yes, tomorrow.

saudi added a subscriber: saudi.Nov 10 2022, 2:00 PM
saudi added inline comments.
llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h
65

typo

This revision was automatically updated to reflect the committed changes.
aganea marked 2 inline comments as done.
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: cfe-commits. · View Herald Transcript

LGTM, I switched to blake3 for --build-id={md5,sha1} for ELF :)