//===- ReleaseModeModelRunner.h - Fast, precompiled 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 // //===----------------------------------------------------------------------===// // // This file implements a model runner wrapping an AOT compiled ML model. // Only inference is supported. // //===----------------------------------------------------------------------===// #ifndef LLVM_ANALYSIS_RELEASEMODEMODELRUNNER_H #define LLVM_ANALYSIS_RELEASEMODEMODELRUNNER_H #include "llvm/ADT/StringExtras.h" #include "llvm/Analysis/MLModelRunner.h" #include "llvm/Analysis/TensorSpec.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MD5.h" #include <memory> namespace llvm { /// ReleaseModeModelRunner - production mode implementation of the /// MLModelRunner. It uses an AOT-compiled SavedModel for efficient execution. struct EmbeddedModelRunnerOptions { … }; template <class TGen> class ReleaseModeModelRunner final : public MLModelRunner { … }; /// A mock class satisfying the interface expected by ReleaseModeModelRunner for /// its `TGen` parameter. Useful to avoid conditional compilation complexity, as /// a compile-time replacement for a real AOT-ed model. class NoopSavedModelImpl final { … }; template <class T> bool isEmbeddedModelEvaluatorValid() { … } template <> inline bool isEmbeddedModelEvaluatorValid<NoopSavedModelImpl>() { … } } // namespace llvm #endif // LLVM_ANALYSIS_RELEASEMODEMODELRUNNER_H