[mlgo] Hook up the interactive runner to the mlgo-ed passes
authorMircea Trofin <mtrofin@google.com>
Wed, 1 Feb 2023 16:34:16 +0000 (08:34 -0800)
committerMircea Trofin <mtrofin@google.com>
Sat, 4 Feb 2023 00:22:57 +0000 (16:22 -0800)
commita7354899d1a235a796b3a2ccb45f6596983c8672
treef148320c37804fff2dc60b0bd65157981f55c076
parent0981ff8968bdfbd59d6db388db5ad1708b84ef05
[mlgo] Hook up the interactive runner to the mlgo-ed passes

This hooks up the interactive model runner to the passes that support
ml-based decisions. Because the interface to this runner is the exact
same as the one used during inference, we just reuse the exact same
setup we have for "release mode". This makes "release mode" a misnomer -
and that's something we needed to resolve sooner or later (e.g.
supporting more than one embedded model for the same problem was another
reason to drop that nomenclature). That will happen in a subsequent
change.

To use this evaluator, just enable the pass in (currently) "release"
mode, but also pass the base name for the 2 channel files via the
pass-specific flag.

The 2 files are the responsibilty of the hosting process. The added
tests use a minimal, toy such host, illustrating setup and
communication.

Differential Revision: https://reviews.llvm.org/D143218
16 files changed:
llvm/include/llvm/Analysis/InlineModelFeatureMaps.h
llvm/include/llvm/Analysis/InteractiveModelRunner.h
llvm/include/llvm/Analysis/MLModelRunner.h
llvm/include/llvm/Analysis/ReleaseModeModelRunner.h
llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
llvm/lib/Analysis/InlineAdvisor.cpp
llvm/lib/Analysis/MLInlineAdvisor.cpp
llvm/lib/Analysis/models/interactive_host.py [new file with mode: 0644]
llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
llvm/lib/CodeGen/MLRegallocPriorityAdvisor.cpp
llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp
llvm/lib/CodeGen/RegAllocPriorityAdvisor.cpp
llvm/test/CodeGen/MLRegalloc/Inputs/interactive_main.py [new file with mode: 0644]
llvm/test/CodeGen/MLRegalloc/interactive-mode.ll [new file with mode: 0644]
llvm/test/Transforms/Inline/ML/Inputs/interactive_main.py [new file with mode: 0644]
llvm/test/Transforms/Inline/ML/interactive-mode.ll [new file with mode: 0644]