From 1b03568ae18715ad081cc57197b61388c8e6caa4 Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Thu, 10 Nov 2022 11:33:00 -0500 Subject: cmd/compile: adjust PGO inlining default parameters Adjust PGO inlining default parameters to 99% CDF threshold and 2000 budget. Benchmark results (mostly from Sweet) show that this set of parameters performs reasonably well, with a few percent speedup at the cost of a few percent binary size increase. Also rename the debug flags to start with "pgo", to make it clear that they are related to PGO. Change-Id: I0749249b1298d1dc55a28993c37b3185f9d7639d Reviewed-on: https://go-review.googlesource.com/c/go/+/449477 Run-TryBot: Cherry Mui Reviewed-by: Michael Pratt TryBot-Result: Gopher Robot --- src/cmd/compile/internal/inline/inl.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/cmd/compile/internal/inline') diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go index aebe32869a..028b6c0e83 100644 --- a/src/cmd/compile/internal/inline/inl.go +++ b/src/cmd/compile/internal/inline/inl.go @@ -76,15 +76,15 @@ var ( // that is, for a threshold of X the hottest callsites that // make up the top X% of total edge weight will be // considered hot for inlining candidates. - inlineCDFHotCallSiteThresholdPercent = float64(95) + inlineCDFHotCallSiteThresholdPercent = float64(99) // Budget increased due to hotness. - inlineHotMaxBudget int32 = 160 + inlineHotMaxBudget int32 = 2000 ) // pgoInlinePrologue records the hot callsites from ir-graph. func pgoInlinePrologue(p *pgo.Profile, decls []ir.Node) { - if s, err := strconv.ParseFloat(base.Debug.InlineHotCallSiteCDFThreshold, 64); err == nil { + if s, err := strconv.ParseFloat(base.Debug.PGOInlineCDFThreshold, 64); err == nil { inlineCDFHotCallSiteThresholdPercent = s } var hotCallsites []pgo.NodeMapKey @@ -93,8 +93,8 @@ func pgoInlinePrologue(p *pgo.Profile, decls []ir.Node) { fmt.Printf("hot-callsite-thres-from-CDF=%v\n", inlineHotCallSiteThresholdPercent) } - if base.Debug.InlineHotBudget != 0 { - inlineHotMaxBudget = int32(base.Debug.InlineHotBudget) + if x := base.Debug.PGOInlineBudget; x != 0 { + inlineHotMaxBudget = int32(x) } // mark inlineable callees from hot edges -- cgit v1.3