NoInferenceModelRunner.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- NoInferenceModelRunner.h ---- noop ML model runner ------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. #ifndef LLVM_ANALYSIS_NOINFERENCEMODELRUNNER_H
  15. #define LLVM_ANALYSIS_NOINFERENCEMODELRUNNER_H
  16. #include "llvm/Analysis/MLModelRunner.h"
  17. #include "llvm/Analysis/TensorSpec.h"
  18. #include "llvm/Config/llvm-config.h"
  19. namespace llvm {
  20. /// A pseudo model runner. We use it to store feature values when collecting
  21. /// logs for the default policy, in 'development' mode, but never ask it to
  22. /// 'run'.
  23. class NoInferenceModelRunner : public MLModelRunner {
  24. public:
  25. NoInferenceModelRunner(LLVMContext &Ctx,
  26. const std::vector<TensorSpec> &Inputs);
  27. static bool classof(const MLModelRunner *R) {
  28. return R->getKind() == MLModelRunner::Kind::NoOp;
  29. }
  30. private:
  31. void *evaluateUntyped() override {
  32. llvm_unreachable("We shouldn't call run on this model runner.");
  33. }
  34. };
  35. } // namespace llvm
  36. #endif // LLVM_ANALYSIS_NOINFERENCEMODELRUNNER_H
  37. #ifdef __GNUC__
  38. #pragma GCC diagnostic pop
  39. #endif