This is an archive of the discontinued LLVM Phabricator instance.

In machine block placement, use 60% instead of 80% as the hot branch probability threshold when profile data is available.
Needs ReviewPublic

Authored by congh on Oct 15 2015, 3:50 PM.

Details

Reviewers
djasper
davidxl
Summary

Currently the machine block placement pass in LLVM uses 80% as the hot branch probability. However, I found that when profile data is available, we can decrease this threshold to get better performance. I modified this threshold into 50%/60%/70%, and use them to measure frontend stalls for SPEC2000 benchmarks. The average number of stalls generally decreases as we use smaller threshold. Below is my experiment results:

Hot branch prob threshold | # of frontend stalls change comparing to when using 80%
50% | +0.6%
60% | -2.2%
70% | -1.8%

Here we can see by using 60% we can get the smallest number of frontend stalls for SPEC2000. Hence in this patch I use 60% as the threshold when profile data is available.

Diff Detail

Event Timeline

congh updated this revision to Diff 37530.Oct 15 2015, 3:50 PM
congh retitled this revision from to In machine block placement, use 60% instead of 80% as the hot branch probability threshold when profile data is available..
congh updated this object.
congh added reviewers: djasper, davidxl.
congh added a subscriber: llvm-commits.

We use 80% as the 'hot' probability in many places. Would it make sense to add a getHotProbability(bool HasProfileData) to BranchProb so we can remove the magic numbers here? No need to do that in this patch but maybe in a follow-up.

Then we can check if the other users of 80% can also make smarter decisions when they know the probabilities come from prof data.

Thanks for the review!

We use 80% as the 'hot' probability in many places. Would it make sense to add a getHotProbability(bool HasProfileData) to BranchProb so we can remove the magic numbers here? No need to do that in this patch but maybe in a follow-up.

Then we can check if the other users of 80% can also make smarter decisions when they know the probabilities come from prof data.

I am not sure if using the same "hot" probability in other places is a good idea as I am not sure how it is used there. After all, "hot" has different definitions depending on its context. But it is a good idea to at least try it.

davidxl edited edge metadata.Oct 23 2015, 10:39 AM

Changing the default requires more benchmarking results. Can you provide the numbers?