This is an archive of the discontinued LLVM Phabricator instance.

[FuncSpec] Do not overestimate the specialization bonus for users inside loops.
ClosedPublic

Authored by labrinea on Oct 25 2022, 8:18 AM.

Details

Summary

When calculating the specialization bonus for a given function argument, we recursively traverse the chain of (certain) users, accumulating the instruction costs. Then we exponentially increase the bonus to account for loop nests. This is problematic for two reasons: (a) the users might not themselves be inside the loop nest, (b) if they are we are accounting for it multiple times. Instead we should be adjusting the bonus before traversing the user chain.

This reduces the instruction count for CTMark (newPM-O3) when Function Specialization is enabled without actually reducing the amount of specializations performed.

testnamedelta % non-LTOdelta % LTO
ClamAV-0.0050.039
7zip0.012-0.007
tramp3d-v4-0.013-0.011
kimwitu++-0.0110.146
sqlite30.04-0.445
mafft0.0060.011
lencod-0.02-0.023
SPASS-0.006-1.06
consumer-typeset0.005-2.644
Bullet-0.015-0.029
geomean-0.001-0.406

Diff Detail

Event Timeline

labrinea created this revision.Oct 25 2022, 8:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 25 2022, 8:18 AM
labrinea requested review of this revision.Oct 25 2022, 8:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 25 2022, 8:18 AM
labrinea retitled this revision from [FuncSpec] Do not overestime the specialization bonus for users inside loops. to [FuncSpec] Do not overestimate the specialization bonus for users inside loops..Oct 25 2022, 8:21 AM
ChuanqiXu accepted this revision.Oct 26 2022, 7:32 PM

The reason makes sense and the data is overwhelming. LGTM!

This revision is now accepted and ready to land.Oct 26 2022, 7:32 PM
This revision was landed with ongoing or failed builds.Oct 27 2022, 7:40 AM
This revision was automatically updated to reflect the committed changes.