aboutsummaryrefslogtreecommitdiff
path: root/reference_model/src/main.cpp
diff options
context:
space:
mode:
authorMatthew Sloyan <matthew.sloyan@arm.com>2022-09-26 13:31:43 +0100
committerMatthew Sloyan <matthew.sloyan@arm.com>2022-10-07 16:02:07 +0100
commitba5fad356a926d5e1c6e0fe6b546a310230cc5a8 (patch)
tree10e3e127c091da90d591253fd55e8566c0b61e7a /reference_model/src/main.cpp
parenta0848c6edbf37034e280a670bdd2f990fdf796da (diff)
downloadreference_model-ba5fad356a926d5e1c6e0fe6b546a310230cc5a8.tar.gz
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 <matthew.sloyan@arm.com> Change-Id: If42f1f82cd6dadf18911a48dcd5fa579b719aff2
Diffstat (limited to 'reference_model/src/main.cpp')
-rw-r--r--reference_model/src/main.cpp25
1 files changed, 10 insertions, 15 deletions
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 <stdio.h>
+#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 <Eigen/CXX11/Tensor>
-#include <iostream>
#include <fstream>
+#include <iostream>
+#include <stdio.h>
+#include <Eigen/CXX11/Tensor>
#include <nlohmann/json.hpp>
-#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=");
}