xref: /freebsd/contrib/llvm-project/llvm/lib/Analysis/NoInferenceModelRunner.cpp (revision 02e9120893770924227138ba49df1edb3896112a)
1 //===- NoInferenceModelRunner.cpp - noop ML model runner   ----------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // A pseudo model runner. We use it to store feature values when collecting
10 // logs for the default policy, in 'development' mode, but never ask it to
11 // 'run'.
12 //===----------------------------------------------------------------------===//
13 #include "llvm/Analysis/NoInferenceModelRunner.h"
14 
15 using namespace llvm;
16 
17 NoInferenceModelRunner::NoInferenceModelRunner(
18     LLVMContext &Ctx, const std::vector<TensorSpec> &Inputs)
19     : MLModelRunner(Ctx, MLModelRunner::Kind::NoOp, Inputs.size()) {
20   size_t Index = 0;
21   for (const auto &TS : Inputs)
22     setUpBufferForTensor(Index++, TS, nullptr);
23 }
24