Permalink
Browse files

Don't form optimized regions to cover blocks with low profile weight …

…and truly enable HotCFG

Summary:
This diff enables the HotCFG region selector to truly prune blocks that have a
low profile weight relative to the entry of the region (the thresholds were set
to 0, so HotCFG was doing the same as WholeCFG).  This diff also extends adds
logic to avoid creating a region just to cover a block that has low profile
weight relative to the main function entry.  The idea here is to avoid creating
cold regions that likely to be large.

Reviewed By: mofarrell

Differential Revision: D12897592

fbshipit-source-id: 9bce7e817d4d0936d70f9e96864aec3ce745b0cd
  • Loading branch information...
ottoni authored and hhvm-bot committed Nov 2, 2018
1 parent 093f86b commit 30102de793400a13afe72087e4839691b30f56dd
Showing with 13 additions and 1 deletion.
  1. +1 −1 hphp/runtime/base/runtime-option.h
  2. +12 −0 hphp/runtime/vm/jit/regionize-func.cpp
@@ -818,7 +818,7 @@ struct RuntimeOption {
F(uint32_t, JitPGOUnlikelyDecRefDecrementPercent, 5) \
F(uint32_t, JitPGOReleaseVVMinPercent, 8) \
F(bool, JitPGOArrayGetStress, false) \
F(uint32_t, JitPGOMinBlockCountPercent, 0) \
F(double, JitPGOMinBlockCountPercent, 0.05) \
F(double, JitPGOMinArcProbability, 0.0) \
F(uint32_t, JitPGOMaxFuncSizeDupBody, 80) \
F(uint32_t, JitPGORelaxPercent, 100) \
@@ -334,6 +334,18 @@ RegionVec regionizeFunc(const Func* func, std::string& transCFGAnnot) {
if (!coveredNodes.count(node) ||
!allArcsCovered(cfg.inArcs(node), coveredArcs)) {
auto newHead = node;
// If the weight of node is too low, we mark it and its incoming arcs as
// covered but skip generating a region starting at it to reduce code
// size. This node will probably trigger a live translation instead.
auto const minBlkPerc = RuntimeOption::EvalJitPGOMinBlockCountPercent;
if (cfg.weight(node) < cfg.weight(nodes[0]) * minBlkPerc / 100) {
FTRACE(3, "regionizeFunc: skipping forming a region to cover node {}\n",
newHead);
coveredNodes.insert(node);
auto const& inArcs = cfg.inArcs(node);
coveredArcs.insert(inArcs.begin(), inArcs.end());
continue;
}
FTRACE(6, "regionizeFunc: selecting trace to cover node {}\n", newHead);
RegionDescPtr region;
HotTransContext ctx;

0 comments on commit 30102de

Please sign in to comment.