This is an archive of the discontinued LLVM Phabricator instance.

[llvm-profgen] Support a threshold to control hiding warning summaries
AcceptedPublic

Authored by wlei on May 9 2022, 12:02 PM.

Details

Reviewers
hoy
wenlei
Summary

Some small value summaries of warning are less important, add a threshold to control hiding them.

Diff Detail

Event Timeline

wlei created this revision.May 9 2022, 12:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2022, 12:02 PM
Herald added subscribers: hoy, wenlei. · View Herald Transcript
wlei requested review of this revision.May 9 2022, 12:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2022, 12:02 PM
wlei edited the summary of this revision. (Show Details)May 9 2022, 12:04 PM
wlei added reviewers: hoy, wenlei.
hoy added inline comments.May 9 2022, 3:21 PM
llvm/tools/llvm-profgen/ErrorHandling.h
54

Use <= ?

llvm/tools/llvm-profgen/PerfReader.cpp
46 ↗(On Diff #428150)

nit: use unsigned int

Wondering what's a good place to do the validation. It should be within [1,100].

wenlei added a comment.May 9 2022, 3:45 PM

I'm not sure if a universal threshold for filtering warning is a good way to deal with this. Maybe look at this from a different angle -- for some warnings, any instance is bad, for others, we can tolerate them. Hence, an alternative: for critical ones, we should always print out any non-zero value; for others, print them only under a "verbose" mode?

hoy added a comment.May 9 2022, 4:03 PM

I'm not sure if a universal threshold for filtering warning is a good way to deal with this. Maybe look at this from a different angle -- for some warnings, any instance is bad, for others, we can tolerate them. Hence, an alternative: for critical ones, we should always print out any non-zero value; for others, print them only under a "verbose" mode?

That's fair. It'd be good to treat warnings of different importance differently.

wlei updated this revision to Diff 428239.May 9 2022, 4:50 PM

Updating D125255: [llvm-profgen] Support a threshold to control hiding warning summaries

wlei added a comment.May 9 2022, 4:50 PM

I'm not sure if a universal threshold for filtering warning is a good way to deal with this. Maybe look at this from a different angle -- for some warnings, any instance is bad, for others, we can tolerate them. Hence, an alternative: for critical ones, we should always print out any non-zero value; for others, print them only under a "verbose" mode?

Sounds good.

  1. add verbose mode to enable to print all of them.
  2. add a parameter to emitWarningSummary to customize value for critical warning, default value increase to 20%.
  3. IMP, warning of "inconsistent name from symbol table and dwarf info" should be critical. changed thres to 0.
llvm/tools/llvm-profgen/ErrorHandling.h
54

fixed!

llvm/tools/llvm-profgen/PerfReader.cpp
46 ↗(On Diff #428150)

Added validation in validateCommandLine, it can be 0 to print all the number between [0,1].

wenlei added a comment.May 9 2022, 6:15 PM

add a parameter to emitWarningSummary to customize value for critical warning, default value increase to 20%.

Do we even need a threshold for emitting critical ones? If it's critical, we should always emit them?

wlei added a comment.May 9 2022, 7:44 PM

add a parameter to emitWarningSummary to customize value for critical warning, default value increase to 20%.

Do we even need a threshold for emitting critical ones? If it's critical, we should always emit them?

Sorry for the confusing, " customize value for critical warning" is wrong, I meant the parameter is used to treat warnings of different importance differently. For critical warning, the threshold is 0, then it's always emitted. For non-critical ones, developer can still set a threshold or use the default one, then emit it if it's above it.

wenlei added a comment.May 9 2022, 7:53 PM

add a parameter to emitWarningSummary to customize value for critical warning, default value increase to 20%.

Do we even need a threshold for emitting critical ones? If it's critical, we should always emit them?

Sorry for the confusing, " customize value for critical warning" is wrong, I meant the parameter is used to treat warnings of different importance differently. For critical warning, the threshold is 0, then it's always emitted. For non-critical ones, developer can still set a threshold or use the default one, then emit it if it's above it.

Ok, maybe a verbose mode is enough for enabling all warnings. I can see that a threshold for non-critical warnings could be potentially useful, but also wondering if we could just keep things very simple here. The goal is not to give user a lot of control on what to print out, but to make sure 1) the default warning printing is meaningful to average users, 2) advanced users have a way to print everything.

wlei updated this revision to Diff 428282.May 9 2022, 8:45 PM

Updating D125255: [llvm-profgen] Support a threshold to control hiding warning summaries

wlei added a comment.May 9 2022, 8:45 PM

add a parameter to emitWarningSummary to customize value for critical warning, default value increase to 20%.

Do we even need a threshold for emitting critical ones? If it's critical, we should always emit them?

Sorry for the confusing, " customize value for critical warning" is wrong, I meant the parameter is used to treat warnings of different importance differently. For critical warning, the threshold is 0, then it's always emitted. For non-critical ones, developer can still set a threshold or use the default one, then emit it if it's above it.

Ok, maybe a verbose mode is enough for enabling all warnings. I can see that a threshold for non-critical warnings could be potentially useful, but also wondering if we could just keep things very simple here. The goal is not to give user a lot of control on what to print out, but to make sure 1) the default warning printing is meaningful to average users, 2) advanced users have a way to print everything.

Sounds good to make things simple, thanks!

hoy accepted this revision.May 10 2022, 10:58 AM

LGTM with a minor suggestion.

llvm/tools/llvm-profgen/ErrorHandling.h
53

nit: IsCritical -> AlwaysEmit?

This revision is now accepted and ready to land.May 10 2022, 10:58 AM
wlei updated this revision to Diff 428551.May 10 2022, 7:24 PM

IsCritical -> AlwaysEmit

wlei updated this revision to Diff 428552.May 10 2022, 7:26 PM

Updating D125255: [llvm-profgen] Support a threshold to control hiding warning summaries

wenlei added a comment.Jun 8 2022, 8:13 AM

I think we also need to decide what should always be emitted. Now there's only one warning that is always emitted. I think we can benefit from another always emit warning that can tells us when profile/binary mismatch and/or the issues like the skylake PMU bug happens. Do we get any indicator now for these issues?

When simplifying, we still want to let user know very meaningful signal, but we don't want to present 10 signals to users, instead we want to give them a couple important signals, I think signal for profile/binary mismatch etc can be considered important?

It looks like we already have a verbose mode show-detailed-warning, maybe we can reuse that?