Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BOLT] CDSplit main logic part 2/2 #74032

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

ShatianWang
Copy link
Contributor

This diff implements the main splitting logic of CDSplit. CDSplit processes functions in a binary in parallel. For each function BF, it assumes that all other functions are hot-cold split. For each possible hot-warm split point of BF, it computes its corresponding SplitScore, and chooses the split point with the best SplitScore. The SplitScore of each split point is computed in the following way: each call edge or jump edge has an edge score that is proportional to its execution count, and inversely proportional to its distance. The SplitScore of a split point is a sum of edge scores over a fixed set of edges whose distance can change due to hot-warm splitting BF. This set contains all cover calls in the form of X->Y or Y->X given function order [... X ... BF ... Y ...]; we refer to the sum of edge scores over the set of cover calls as CoverCallScore. This set also contains all jump edges (branches) within BF as well as all call edges originated from BF; we refer to the sum of edge scores over this set of edges as LocalScore. CDSplit finds the split index maximizing CoverCallScore + LocalScore.

This diff implements the main splitting logic of CDSplit.
CDSplit processes functions in a binary in parallel. For each
function BF, it assumes that all other functions are hot-cold split. For
each possible hot-warm split point of BF, it computes its corresponding
SplitScore, and chooses the split point with the best SplitScore. The
SplitScore of each split point is computed in the following way: each
call edge or jump edge has an edge score that is proportional to its
execution count, and inversely proportional to its distance. The
SplitScore of a split point is a sum of edge scores over a fixed set of
edges whose distance can change due to hot-warm splitting BF. This set
contains all cover calls in the form of X->Y or Y->X given function
order [... X ... BF ... Y ...]; we refer to the sum of edge scores over
the set of cover calls as CoverCallScore. This set also contains all
jump edges (branches) within BF as well as all call edges originated
from BF; we refer to the sum of edge scores over this set of edges as
LocalScore. CDSplit finds the split index maximizing CoverCallScore +
LocalScore.
@ShatianWang ShatianWang marked this pull request as ready for review December 1, 2023 03:27
Copy link
Contributor

@maksfb maksfb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ShatianWang ShatianWang merged commit 4483cf2 into llvm:main Dec 1, 2023
5 checks passed
@ShatianWang ShatianWang deleted the 113023GHCommit6V2 branch December 1, 2023 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants