This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] introducing profi params
ClosedPublic

Authored by spupyrev on Sep 27 2022, 11:53 AM.

Details

Summary

We want to use profile inference (profi) in BOLT for stale profile matching.
To this end, I am making a few changes modifying the interface of the algorithm.
This is the first change for existing usages of profi (e.g., CSSPGO):

  • introducing an object holding the algorithmic parameters;
  • some renaming of existing options;
  • dropped unused option, SampleProfileInferEntryCount, as we don't plan to change its default value;
  • no changes in the output / tests.

Diff Detail

Event Timeline

spupyrev created this revision.Sep 27 2022, 11:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 27 2022, 11:53 AM
spupyrev requested review of this revision.Sep 27 2022, 11:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 27 2022, 11:53 AM
spupyrev edited the summary of this revision. (Show Details)Sep 27 2022, 11:56 AM
spupyrev updated this revision to Diff 463305.Sep 27 2022, 12:01 PM

fix formatting

spupyrev updated this revision to Diff 482197.Dec 12 2022, 11:16 AM

rebase & some updates

spupyrev edited the summary of this revision. (Show Details)Dec 12 2022, 11:20 AM
spupyrev added reviewers: hoy, wenlei, wlei, maksfb, rafaelauler, Amir.
spupyrev edited the summary of this revision. (Show Details)
spupyrev updated this revision to Diff 482210.Dec 12 2022, 11:36 AM

fixing assert

hoy added inline comments.Dec 16 2022, 9:57 AM
llvm/lib/Transforms/Utils/SampleProfileInference.cpp
1039

Would it make sense to move this into ProfiParams?

spupyrev added inline comments.Dec 16 2022, 10:10 AM
llvm/lib/Transforms/Utils/SampleProfileInference.cpp
1039

One earlier version of the diff had this constant in ProfiParams. Later I decided to use ProfiParams as a set of user-configurable options, while MinBaseDistance is more like a constant which shouldn't be changed.

I don't have a strong preference and see pros for both ways. What do you think?

hoy accepted this revision.Dec 16 2022, 10:19 AM

LGTM.

llvm/lib/Transforms/Utils/SampleProfileInference.cpp
1039

I see. I don't have a strong opinion either, was just wondering if it is intentional.

This revision is now accepted and ready to land.Dec 16 2022, 10:19 AM
This revision was landed with ongoing or failed builds.Jan 9 2023, 12:03 PM
This revision was automatically updated to reflect the committed changes.
Amir added a comment.Jun 5 2023, 5:54 PM

Why was this specific change needed?

introducing an object holding the algorithmic parameters;

Is it in order to specify different BOLT defaults? Or for the theoretical use case where BOLT and Clang are both invoked from the same driver, as in llvm-driver build mode?

Why was this specific change needed?

introducing an object holding the algorithmic parameters;

Is it in order to specify different BOLT defaults? Or for the theoretical use case where BOLT and Clang are both invoked from the same driver, as in llvm-driver build mode?

BOLT and CSSPGO are using different profi parameters, as they're based on different profiles. This diff allows to pass the params for the algorithm

Amir added a comment.Jun 6 2023, 9:38 AM

Why was this specific change needed?

introducing an object holding the algorithmic parameters;

Is it in order to specify different BOLT defaults? Or for the theoretical use case where BOLT and Clang are both invoked from the same driver, as in llvm-driver build mode?

BOLT and CSSPGO are using different profi parameters, as they're based on different profiles. This diff allows to pass the params for the algorithm

In that case, it's possible to override these parameters from BOLT – just like we do for some other knobs in adjustCommandLineOptions.