This is an archive of the discontinued LLVM Phabricator instance.

[memprof] Align each rawprofile section to 8b.
ClosedPublic

Authored by snehasish on Nov 30 2021, 4:01 PM.

Details

Summary

The first 8b of each raw profile section need to be aligned to 8b since
the first item in each section is a u64 count of the number of items in
the section.
Summary of changes:

  • Assert alignment when reading counts.
  • Update test to check alignment, relax some size checks to allow padding.
  • Update raw binary inputs for llvm-profdata tests.

Diff Detail

Event Timeline

snehasish created this revision.Nov 30 2021, 4:01 PM
snehasish requested review of this revision.Nov 30 2021, 4:01 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptNov 30 2021, 4:01 PM
Herald added subscribers: llvm-commits, Restricted Project. · View Herald Transcript
snehasish added a subscriber: kda.Nov 30 2021, 4:02 PM
tejohnson added inline comments.Nov 30 2021, 4:27 PM
compiler-rt/lib/memprof/memprof_rawprofile.cpp
36

Should this be Size + 8 - Size%8?

kda added a comment.Nov 30 2021, 4:39 PM

This does appear to fix the "fast" buildbot.
Thank you.

vitalybuka added inline comments.
compiler-rt/lib/memprof/memprof_rawprofile.cpp
36

RoundUpTo(size, 8)

BTW why 8? should this be alignof(T) ?

snehasish updated this revision to Diff 390877.Nov 30 2021, 5:57 PM

Use RoundUpTo helper, add comments to clarify why 8b.

snehasish marked an inline comment as done.Nov 30 2021, 6:06 PM

PTAL, thanks!

compiler-rt/lib/memprof/memprof_rawprofile.cpp
36

Since each section in the profile starts with a u64, I hardcoded the value to 8. I added a comment to explain why.

PTAL, thanks!

It does not look like a trivial fix.
If you need to wait @davidxl review I recommend to revert original patch and squash the fix into that one to unbreak buildbots

BTW there is also https://lab.llvm.org/buildbot/#/builders/85/builds/7051/steps/7/logs/stdio

davidxl accepted this revision.Nov 30 2021, 7:42 PM

lgtm

This revision is now accepted and ready to land.Nov 30 2021, 7:42 PM

PTAL, thanks!

It does not look like a trivial fix.
If you need to wait @davidxl review I recommend to revert original patch and squash the fix into that one to unbreak buildbots

BTW there is also https://lab.llvm.org/buildbot/#/builders/85/builds/7051/steps/7/logs/stdio

The breakage above should have been fixed by https://reviews.llvm.org/rGa2ce97cc3f99c8af80b2325acf03a4c171ffb48f.
I'll go ahead and pushed this since David lgtm'ed it and keep an eye on the bot. Thanks for taking a look and your helpful suggestions.

This revision was automatically updated to reflect the committed changes.