Skip to content

Commit

Permalink
[llvm] Development-mode InlineAdvisor
Browse files Browse the repository at this point in the history
Summary:
This is the InlineAdvisor used in 'development' mode. It enables two
scenarios:

 - loading models via a command-line parameter, thus allowing for rapid
 training iteration, where models can be used for the next exploration
 phase without requiring recompiling the compiler. This trades off some
 compilation speed for the added flexibility.

 - collecting training logs, in the form of tensorflow.SequenceExample
 protobufs. We generate these as textual protobufs, which simplifies
 generation and testing. The protobufs may then be readily consumed by a
 tensorflow-based training algorithm.

To speed up training, training logs may also be collected from the
'default' training policy. In that case, this InlineAdvisor does not
use a model.

RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-April/140763.html

Reviewers: jdoerfert, davidxl

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D83733
  • Loading branch information
mtrofin committed Jul 20, 2020
1 parent c6f84eb commit 70f8d0a
Show file tree
Hide file tree
Showing 9 changed files with 610 additions and 3 deletions.
6 changes: 6 additions & 0 deletions llvm/include/llvm/Analysis/InlineAdvisor.h
Expand Up @@ -208,6 +208,12 @@ std::unique_ptr<InlineAdvisor>
getReleaseModeAdvisor(Module &M, ModuleAnalysisManager &MAM);
#endif

#ifdef LLVM_HAVE_TF_API
std::unique_ptr<InlineAdvisor>
getDevelopmentModeAdvisor(Module &M, ModuleAnalysisManager &MAM,
std::function<bool(CallBase &)> GetDefaultAdvice);
#endif

// Default (manual policy) decision making helper APIs. Shared with the legacy
// pass manager inliner.

Expand Down
5 changes: 4 additions & 1 deletion llvm/lib/Analysis/CMakeLists.txt
@@ -1,6 +1,9 @@
set(CommonMLSources MLInlineAdvisor.cpp)
set(ReleaseModeMLSources ReleaseModeModelRunner.cpp)
set(DevelopmentModeMLSources TFUtils.cpp)
set(DevelopmentModeMLSources
DevelopmentModeInlineAdvisor.cpp
TFUtils.cpp
)

if (DEFINED LLVM_HAVE_TF_AOT OR DEFINED LLVM_HAVE_TF_API)
set(MLPolicySources ${CommonMLSources})
Expand Down

0 comments on commit 70f8d0a

Please sign in to comment.