This is an archive of the discontinued LLVM Phabricator instance.

[PGO] Better handling of profile hash mismatch
ClosedPublic

Authored by xur on Apr 2 2019, 2:49 PM.

Details

Summary

We currently assume profile hash conflicts will be caught by an upfront check and we assert for the cases that escape the check. The assumption is not always true as there are chances of conflict. This patch prints a warning and skips annotating the function for the escaped cases,.

Diff Detail

Repository
rL LLVM

Event Timeline

xur created this revision.Apr 2 2019, 2:49 PM
davidxl added inline comments.Apr 10 2019, 10:07 AM
lib/Transforms/Instrumentation/PGOInstrumentation.cpp
1010 ↗(On Diff #193368)

update the comments about the return value.

1042 ↗(On Diff #193368)

document on how this can happen.

1155 ↗(On Diff #193368)

What is the possible cause of it? It is better emit the information so that users can take some actions -- otherwise the message is not useful.

xur marked 3 inline comments as done.Apr 10 2019, 10:24 AM
xur added inline comments.
lib/Transforms/Instrumentation/PGOInstrumentation.cpp
1155 ↗(On Diff #193368)

this is profile mismatch, usually from stale profile (source change), or using the profile generated from other binaries. Is this the standard message for mismatch? We have the check here for the cases that escapes funchash conflict detection.

davidxl added inline comments.Apr 10 2019, 10:32 AM
lib/Transforms/Instrumentation/PGOInstrumentation.cpp
1155 ↗(On Diff #193368)

When there is a hash conflict, it means the function name is also the same. Perhaps add more information: " the profile may be stale or there is a function name collision".

xur updated this revision to Diff 194563.Apr 10 2019, 12:22 PM

Integrated David's comments.

davidxl accepted this revision.Apr 10 2019, 12:43 PM
This revision is now accepted and ready to land.Apr 10 2019, 12:43 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2019, 1:52 PM