llvm/llvm/unittests/Analysis/MLModelRunnerTest.cpp

//===- MLModelRunnerTest.cpp - test for MLModelRunner ---------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "llvm/Analysis/MLModelRunner.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/InteractiveModelRunner.h"
#include "llvm/Analysis/NoInferenceModelRunner.h"
#include "llvm/Analysis/ReleaseModeModelRunner.h"
#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Testing/Support/SupportHelpers.h"
#include "gtest/gtest.h"
#include <atomic>
#include <thread>

usingnamespacellvm;

namespace llvm {
// This is a mock of the kind of AOT-generated model evaluator. It has 2 tensors
// of shape {1}, and 'evaluation' adds them.
// The interface is the one expected by ReleaseModelRunner.
class MockAOTModelBase {};

class AdditionAOTModel final : public MockAOTModelBase {};

class DiffAOTModel final : public MockAOTModelBase {};

static const char *M1Selector =;
static const char *M2Selector =;

static MD5::MD5Result Hash1 =;
static MD5::MD5Result Hash2 =;
class ComposedAOTModel final {};

static EmbeddedModelRunnerOptions makeOptions() {}
} // namespace llvm

TEST(NoInferenceModelRunner, AccessTensors) {}

TEST(ReleaseModeRunner, NormalUse) {}

TEST(ReleaseModeRunner, ExtraFeatures) {}

TEST(ReleaseModeRunner, ExtraFeaturesOutOfOrder) {}

// We expect an error to be reported early if the user tried to specify a model
// selector, but the model in fact doesn't support that.
TEST(ReleaseModelRunner, ModelSelectorNoInputFeaturePresent) {}

TEST(ReleaseModelRunner, ModelSelectorNoSelectorGiven) {}

// Test that we correctly set up the model_selector tensor value. We are only
// responsbile for what happens if the user doesn't specify a value (but the
// model supports the feature), or if the user specifies one, and we correctly
// populate the tensor, and do so upfront (in case the model implementation
// needs that for subsequent tensor buffer lookups).
TEST(ReleaseModelRunner, ModelSelector) {}

#if defined(LLVM_ON_UNIX)
TEST(InteractiveModelRunner, Evaluation) {}
#endif