Replay in sample profiling needs to be asked on candidates that may not have counts or below the threshold. If replay is in effect for a function make sure these are captured and also imported during thinLTO.
Testing:
ninja check-all
Differential D112033
[SampleProfile] Add all callsites to AllCandidates if InlineReplay is in effect modimo on Oct 18 2021, 2:24 PM. Authored by
Details Replay in sample profiling needs to be asked on candidates that may not have counts or below the threshold. If replay is in effect for a function make sure these are captured and also imported during thinLTO. Testing:
Diff Detail
Event TimelineComment Actions Good catch, thanks for working on this.
Comment Actions Add a test case for the inlining (non-importing) path? to the existing test llvm/test/Transforms/SampleProfile/inline-replay.ll ?
Comment Actions Refactor uses of replay advisor into getExternalInlineAdvisorCost and getExternalInlineAdvisorShouldInline. Move importing code to findExternalInlineCandidate Comment Actions @wenlei I refactored the implementation so that all queries to the external advisor route to getExternalInlineAdvisorCost or getExternalInlineAdvisorShouldInline depending on if we want the actual cost or just if inlining occurs, respectively. This unifies every location that queries for the existence of remarks (the original one in hasInlineAdvice and the new ones that add sites as candidates) and also means I don't need to expose a hasRemarksForFunction from the ReplayAdvisor and can do everything using the original InlineAdvisor interface. I also edited how importing is done:
Does it make sense to drop the threshold to allow importing and are there any potential recursive issues with that?
Comment Actions That sounds good to me. It makes the implementation cleaner. Setting threshold to 0 may lead to more importing than needed which can slow down build a bit, but I don't think that's a blocker for inline replay. Lgtm now.
Comment Actions Add comment to SampleProfileLoader::getInlineCandidate. Add inline-topdown-missing.prof file that wasn't part of the diff before.
|
Can we move the following into a helper SampleProfileLoader::ExternalInlineAdviceAvailableForFunction(..), it's used in a few places.