From ecab3a3f314485573fbe11cf80c4430f517c3602 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=ED=95=9C=EC=A2=85/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84?= =?utf8?q?=EC=9E=90?= Date: Tue, 14 Aug 2018 18:00:21 +0900 Subject: [PATCH] [neurun] Introduce IVerifier interface (#2296) Introduce IVerifier interface to support various verifications, each verification can be reused from different graph phases. This commit also contains a skeleton of `DAGChecker`. Part of #2247 Signed-off-by: Hanjoung Lee --- runtimes/neurun/CMakeLists.txt | 3 +- runtimes/neurun/src/graph/verifier/IVerifier.cc | 20 +++++++++++ runtimes/neurun/src/graph/verifier/IVerifier.h | 46 +++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 runtimes/neurun/src/graph/verifier/IVerifier.cc create mode 100644 runtimes/neurun/src/graph/verifier/IVerifier.h diff --git a/runtimes/neurun/CMakeLists.txt b/runtimes/neurun/CMakeLists.txt index 6ee319c..df3a820 100644 --- a/runtimes/neurun/CMakeLists.txt +++ b/runtimes/neurun/CMakeLists.txt @@ -17,8 +17,9 @@ file(GLOB SOURCES_FRONTEND "src/frontend/*.cc") file(GLOB_RECURSE SOURCES_INTERNAL "src/internal/*.cc") file(GLOB_RECURSE SOURCES_GRAPH "src/graph/*.cc") file(GLOB_RECURSE SOURCES_CODEGEN "src/codegen/*.cc") +file(GLOB_RECURSE SOURCES_VERIFIER "src/verifier/*.cc") -set(SOURCES ${SOURCES} ${SOURCES_FRONTEND} ${SOURCES_INTERNAL} ${SOURCES_GRAPH} ${SOURCES_CODEGEN}) +set(SOURCES ${SOURCES} ${SOURCES_FRONTEND} ${SOURCES_INTERNAL} ${SOURCES_GRAPH} ${SOURCES_CODEGEN} ${SOURCES_VERIFIER}) # NOTE For now ARMCompute is necessary # TODO Remove required package below(should be optional) diff --git a/runtimes/neurun/src/graph/verifier/IVerifier.cc b/runtimes/neurun/src/graph/verifier/IVerifier.cc new file mode 100644 index 0000000..05bdbe5 --- /dev/null +++ b/runtimes/neurun/src/graph/verifier/IVerifier.cc @@ -0,0 +1,20 @@ +#include "IVerifier.h" + +#include "graph/Graph.h" + +namespace neurun +{ +namespace graph +{ +namespace verifier +{ + +bool DAGChecker::verify(const Graph &) const +{ + // TODO Implement DAG check + return true; +} + +} // namespace verifier +} // namespace graph +} // namespace neurun diff --git a/runtimes/neurun/src/graph/verifier/IVerifier.h b/runtimes/neurun/src/graph/verifier/IVerifier.h new file mode 100644 index 0000000..574b002 --- /dev/null +++ b/runtimes/neurun/src/graph/verifier/IVerifier.h @@ -0,0 +1,46 @@ +#ifndef __NEURUN_GRAPH_VERIFIER_I_VERIFIER_H__ +#define __NEURUN_GRAPH_VERIFIER_I_VERIFIER_H__ + +namespace neurun +{ +namespace graph +{ +class Graph; +} // namespace graph +} // namespace neurun + +namespace neurun +{ +namespace graph +{ +namespace verifier +{ + +struct IVerifier +{ + virtual ~IVerifier() = default; + virtual bool verify(const Graph &graph) const = 0; +}; + +} // namespace verifier +} // namespace graph +} // namespace neurun + +namespace neurun +{ +namespace graph +{ +namespace verifier +{ + +class DAGChecker : public IVerifier +{ +public: + virtual bool verify(const Graph &graph) const override; +}; + +} // namespace verifier +} // namespace graph +} // namespace neurun + +#endif // __NEURUN_GRAPH_VERIFIER_I_VERIFIER_H__ -- 2.7.4