14#ifndef LLVM_ANALYSIS_RELEASEMODEMODELRUNNER_H
15#define LLVM_ANALYSIS_RELEASEMODEMODELRUNNER_H
33 template <
class FType>
38 CompiledModel(
std::make_unique<TGen>()) {
39 assert(CompiledModel &&
"The CompiledModel should be valid");
41 for (
size_t I = 0;
I < InputSpec.size(); ++
I) {
43 CompiledModel->LookupArgIndex(FeedPrefix.str() + InputSpec[
I].name());
44 void *Buffer =
nullptr;
46 Buffer = CompiledModel->arg_data(
Index);
50 ResultIndex = CompiledModel->LookupResultIndex(FetchPrefix.str() +
52 assert(ResultIndex >= 0 &&
"Cannot find DecisionName in inlining model");
62 void *evaluateUntyped()
override {
64 return CompiledModel->result_data(ResultIndex);
67 int32_t ResultIndex = -1;
68 std::unique_ptr<TGen> CompiledModel;
75#define NOOP_MODEL_ERRMSG \
76 "The mock AOT-ed saved model is a compile-time stub and should not be " \
86#undef NOOP_MODEL_ERRMSG
#define NOOP_MODEL_ERRMSG
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This is an important class for using LLVM in a threaded context.
MLModelRunner interface: abstraction of a mechanism for evaluating a tensorflow "saved model".
void setUpBufferForTensor(size_t Index, const TensorSpec &Spec, void *Buffer)
A mock class satisfying the interface expected by ReleaseModeModelRunner for its TGen parameter.
int LookupArgIndex(const std::string &)
NoopSavedModelImpl()=default
int LookupResultIndex(const std::string &)
ReleaseModeModelRunner - production mode implementation of the MLModelRunner.
static bool classof(const MLModelRunner *R)
virtual ~ReleaseModeModelRunner()=default
ReleaseModeModelRunner(LLVMContext &Ctx, const FType &InputSpec, StringRef DecisionName, StringRef FeedPrefix="feed_", StringRef FetchPrefix="fetch_")
FeatureNames' type should be an indexed collection of std::string, like std::array or std::vector,...
StringRef - Represent a constant reference to a string, i.e.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
bool isEmbeddedModelEvaluatorValid()
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.
bool isEmbeddedModelEvaluatorValid< NoopSavedModelImpl >()
const char *const DecisionName