1 //===- NoInferenceModelRunner.h ---- noop ML model runner ------*- C++ -*-===// 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 10 #ifndef LLVM_ANALYSIS_NOINFERENCEMODELRUNNER_H 11 #define LLVM_ANALYSIS_NOINFERENCEMODELRUNNER_H 12 13 #include "llvm/Analysis/MLModelRunner.h" 14 #include "llvm/Analysis/TensorSpec.h" 15 #include "llvm/Config/llvm-config.h" 16 namespace llvm { 17 /// A pseudo model runner. We use it to store feature values when collecting 18 /// logs for the default policy, in 'development' mode, but never ask it to 19 /// 'run'. 20 class NoInferenceModelRunner : public MLModelRunner { 21 public: 22 NoInferenceModelRunner(LLVMContext &Ctx, 23 const std::vector<TensorSpec> &Inputs); 24 classof(const MLModelRunner * R)25 static bool classof(const MLModelRunner *R) { 26 return R->getKind() == MLModelRunner::Kind::NoOp; 27 } 28 29 private: evaluateUntyped()30 void *evaluateUntyped() override { 31 llvm_unreachable("We shouldn't call run on this model runner."); 32 } 33 }; 34 } // namespace llvm 35 #endif // LLVM_ANALYSIS_NOINFERENCEMODELRUNNER_H 36