From ba5fad356a926d5e1c6e0fe6b546a310230cc5a8 Mon Sep 17 00:00:00 2001 From: Matthew Sloyan Date: Mon, 26 Sep 2022 13:31:43 +0100 Subject: Add IModelRunner interface to TOSA Reference Model * Added IModelRunner interface using pimpl idiom, which allows a user to initialize, configure and run the model. * Added unit tests for IModelRunner. * Added doctest as third-party submodule. * Added user options to specify paths for dependencies. * Moved general func_config functions to separate utility, which removes cxxopts dependency. Signed-off-by: Matthew Sloyan Change-Id: If42f1f82cd6dadf18911a48dcd5fa579b719aff2 --- reference_model/src/main.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'reference_model/src/main.cpp') diff --git a/reference_model/src/main.cpp b/reference_model/src/main.cpp index 643a351..776fbf3 100644 --- a/reference_model/src/main.cpp +++ b/reference_model/src/main.cpp @@ -13,31 +13,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include "model_runner.h" +#include "version.h" -#include "model_common.h" +#include "command_line_utils.h" #include "ops/op_factory.h" #include "subgraph_traverser.h" #include "tosa_serialization_handler.h" -#include -#include #include +#include +#include +#include #include -#define MODEL_VERSION_MAJOR 0 -#define MODEL_VERSION_MINOR 41 -#define MODEL_VERSION_PATCH 0 -#define MODEL_VERSION_DRAFT true - using namespace TosaReference; using namespace tosa; using json = nlohmann::json; -// Global instantiation of configuration and debug objects -func_config_t g_func_config; -func_debug_t g_func_debug; - int initTestDesc(json& test_desc); int readInputTensors(SubgraphTraverser& gt, json test_desc); int writeFinalTensors(SubgraphTraverser& gt, json test_desc); @@ -45,7 +38,10 @@ int loadGraph(TosaSerializationHandler& tsh, json test_desc); int main(int argc, char** argv) { - TosaVersion model_version(MODEL_VERSION_MAJOR, MODEL_VERSION_MINOR, MODEL_VERSION_PATCH, MODEL_VERSION_DRAFT); + TosaVersion model_version(TOSA_REFERENCE_MODEL_VERSION_MAJOR, + TOSA_REFERENCE_MODEL_VERSION_MINOR, + TOSA_REFERENCE_MODEL_VERSION_PATCH, + TOSA_REFERENCE_MODEL_VERSION_DRAFT); // Initialize configuration and debug subsystems g_func_debug.init_debug(0); @@ -203,7 +199,6 @@ int loadGraph(TosaSerializationHandler& tsh, json test_desc) if (strlen(graph_fullname) <= 2) { - func_model_print_help(); FATAL_ERROR("Missing required argument: Check \"tosa_file\" in .json specified by -Ctosa_desc="); } -- cgit v1.2.1