mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 11:56:07 +00:00

This allows the compiler to support more features than those supported by a model. The only requirement (development mode only) is that the new features must be appended at the end of the list of features requested from the model. The support is transparent to compiler code: for unsupported features, we provide a valid buffer to copy their values; it's just that this buffer is disconnected from the model, so insofar as the model is concerned (AOT or development mode), these features don't exist. The buffers are allocated at setup - meaning, at steady state, there is no extra allocation (maintaining the current invariant). These buffers has 2 roles: one, keep the compiler code simple. Second, allow logging their values in development mode. The latter allows retraining a model supporting the larger feature set starting from traces produced with the old model. For release mode (AOT-ed models), this decouples compiler evolution from model evolution, which we want in scenarios where the toolchain is frequently rebuilt and redeployed: we can first deploy the new features, and continue working with the older model, until a new model is made available, which can then be picked up the next time the compiler is built. Differential Revision: https://reviews.llvm.org/D124565
24 lines
968 B
C++
24 lines
968 B
C++
//===- NoInferenceModelRunner.cpp - noop ML model runner ----------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// A pseudo model runner. We use it to store feature values when collecting
|
|
// logs for the default policy, in 'development' mode, but never ask it to
|
|
// 'run'.
|
|
//===----------------------------------------------------------------------===//
|
|
#include "llvm/Analysis/NoInferenceModelRunner.h"
|
|
|
|
using namespace llvm;
|
|
|
|
NoInferenceModelRunner::NoInferenceModelRunner(
|
|
LLVMContext &Ctx, const std::vector<TensorSpec> &Inputs)
|
|
: MLModelRunner(Ctx, MLModelRunner::Kind::NoOp, Inputs.size()) {
|
|
size_t Index = 0;
|
|
for (const auto &TS : Inputs)
|
|
setUpBufferForTensor(Index++, TS, nullptr);
|
|
}
|