Tweak inlining adjustment factor
commitd0316244345f3d319c13439b2970019b83f2895a
authorMark Williams <mwilliams@fb.com>
Wed, 7 Feb 2018 17:27:23 +0000 (7 09:27 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 7 Feb 2018 17:58:30 +0000 (7 09:58 -0800)
tree0bbf1b6f48e949869df7ae6bb94facb03ef4b2ff
parent79a8c6f899c6f919eb76de2ccd2d336081162acd
Tweak inlining adjustment factor

Summary:
The current heuristic just looks at the hotness of the caller,
relative to the average hotness of all function entries. The trouble
with this is that there could be 50 callers that are all significantly
hotter than average; but in that case its almost certainly better not
to inline big functions. To try to avoid overweighting, the current
heuristic adds a constant factor - defaulting to 0.1 - so that
functions have to be at least 10x hotter than average before they get
higher weighting; this probably mitigates the lage-number-of-callers
issue in most cases.

This changes the adjustment factor to

 pow(callerWight/averageWeight, callerExp) * pow(callerWeight/calleeWeight, calleeExp)

where callerExp and calleeExp are runtime options defaulting to 0.5

This means that callees with few callers get higher weighting than
callees with many callers.

Reviewed By: ottoni

Differential Revision: D6832577

fbshipit-source-id: 18b0524edbe8401cf4b68af29a51734fa001f489
hphp/runtime/base/runtime-option.h
hphp/runtime/vm/jit/inlining-decider.cpp
hphp/runtime/vm/jit/irgen.cpp
hphp/runtime/vm/jit/irgen.h
hphp/runtime/vm/jit/translate-region.h