This is an archive of the discontinued LLVM Phabricator instance.

[PGO] Report number of counts being dropped when a hash-mismatch happens.
ClosedPublic

Authored by xur on Jul 1 2022, 9:48 AM.

Details

Summary

This patch reports number of counts being dropped when a hash-mismatch
happens. This information will be helpful to the users -- if the dropped
counts are large, the user should redo the instrumentation build and
recollect the profile.

Diff Detail

Event Timeline

xur created this revision.Jul 1 2022, 9:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2022, 9:48 AM
xur requested review of this revision.Jul 1 2022, 9:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2022, 9:48 AM
davidxl added inline comments.Jul 6 2022, 9:48 AM
llvm/lib/ProfileData/InstrProfReader.cpp
1043

Add handling of saturation using max.

It's almost impossible for the sum of a function's raw count values to
reach the max of uint64. If that happens, there must be something wrong.
We handle saturation in BFI weight where the type is int32.

-Rong

It's almost impossible for the sum of a function's raw count values to
reach the max of uint64. If that happens, there must be something wrong.
We handle saturation in BFI weight where the type is int32.

-Rong

When adding them up, it is still possible for a large function. No fancy handling is needed, just need to cap it .

xur updated this revision to Diff 442639.Jul 6 2022, 11:09 AM

Handle overflow of sum.

davidxl accepted this revision.Jul 6 2022, 11:12 AM

lgtm

This revision is now accepted and ready to land.Jul 6 2022, 11:12 AM
This revision was landed with ongoing or failed builds.Jul 15 2022, 2:59 PM
This revision was automatically updated to reflect the committed changes.