This is an archive of the discontinued LLVM Phabricator instance.

[CSSPGO] Allow the use of debug-info-for-profiling and pseudo-probe-for-profiling together
ClosedPublic

Authored by hoy on Aug 10 2021, 6:21 PM.

Details

Summary

Previoulsy debug-info-for-profiling and pseudo-probe-for-profiling are mutual exclusive because they compete the dwarf discrimnator for callsites on the IR. This changes allows to use the two switches together. The side effect is that callsite discriminators will be taken by pseudo probe, while discriminators for other instructions are still available for AutoFDO use. This is less than ideal, however, it still allows us a chance to smoothly transition from AutoFDO to CSSPGO, by collecting both profiles from a CSSPGO binary.

Diff Detail

Event Timeline

hoy created this revision.Aug 10 2021, 6:21 PM
hoy requested review of this revision.Aug 10 2021, 6:21 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 10 2021, 6:21 PM
wenlei added inline comments.Aug 10 2021, 9:48 PM
clang/lib/Driver/ToolChains/Clang.cpp
3896

Would a warning be useful to catch accidental misuse?

wmi added a comment.Aug 11 2021, 9:11 AM

Could you remind me the discriminator difference between debug info based AFDO and pseudo probe based AFDO? I forgot it. I am sure it is described in some patch but I havn't found it. Give me a pointer is good enough.

hoy added inline comments.Aug 11 2021, 9:27 AM
clang/lib/Driver/ToolChains/Clang.cpp
3896

I was thinking about that. It may be useful, but downstream may have to suppress that warning to be treated as error for a clean build. What do you think?

hoy added a comment.Aug 11 2021, 9:33 AM

Could you remind me the discriminator difference between debug info based AFDO and pseudo probe based AFDO? I forgot it. I am sure it is described in some patch but I havn't found it. Give me a pointer is good enough.

In short, unlike block pseudo probe, a callsite probe relies on the calliste discriminator to be tracked. This has a couple usage: 1. to track direct call and indirect callsite 2. to model inline contexts with a list of callsite probes.

A probe discriminator is treated as empty or null for AutoFDO since it has lowest three bits as "111".

wenlei accepted this revision.Aug 11 2021, 10:38 PM

lgtm, thanks.

clang/lib/Driver/ToolChains/Clang.cpp
3896

Fair point. We could add warning after transition.

This revision is now accepted and ready to land.Aug 11 2021, 10:38 PM
wmi accepted this revision.Aug 11 2021, 10:48 PM

Could you remind me the discriminator difference between debug info based AFDO and pseudo probe based AFDO? I forgot it. I am sure it is described in some patch but I havn't found it. Give me a pointer is good enough.

In short, unlike block pseudo probe, a callsite probe relies on the calliste discriminator to be tracked. This has a couple usage: 1. to track direct call and indirect callsite 2. to model inline contexts with a list of callsite probes.

A probe discriminator is treated as empty or null for AutoFDO since it has lowest three bits as "111".

Thanks for the explanation.