LLVM 19.0.0git
NoInferenceModelRunner.cpp
Go to the documentation of this file.
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//===----------------------------------------------------------------------===//
14
15using namespace llvm;
16
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}
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
MLModelRunner interface: abstraction of a mechanism for evaluating a ML model.
Definition: MLModelRunner.h:26
void setUpBufferForTensor(size_t Index, const TensorSpec &Spec, void *Buffer)
Definition: MLModelRunner.h:63
NoInferenceModelRunner(LLVMContext &Ctx, const std::vector< TensorSpec > &Inputs)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Definition: STLExtras.h:1680