Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / fluid / modules / gapi / src / compiler / gcompiler.hpp
1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
4 //
5 // Copyright (C) 2018-2019 Intel Corporation
6
7
8 #ifndef OPENCV_GAPI_GCOMPILER_HPP
9 #define OPENCV_GAPI_GCOMPILER_HPP
10
11
12 #include "opencv2/gapi/gcommon.hpp"
13 #include "opencv2/gapi/gkernel.hpp"
14 #include "opencv2/gapi/gcomputation.hpp"
15
16 #include <ade/execution_engine/execution_engine.hpp>
17
18 namespace cv { namespace gimpl {
19
20 // FIXME: exported for internal tests only!
21 class GAPI_EXPORTS GCompiler
22 {
23     const GComputation&      m_c;
24     const GMetaArgs          m_metas;
25     GCompileArgs             m_args;
26     ade::ExecutionEngine     m_e;
27
28     cv::gapi::GKernelPackage m_all_kernels;
29
30     void validateInputMeta();
31     void validateOutProtoArgs();
32
33 public:
34     explicit GCompiler(const GComputation &c,
35                              GMetaArgs    &&metas,
36                              GCompileArgs &&args);
37
38     // The method which does everything...
39     GCompiled compile();
40
41     // But is actually composed of this:
42     using GPtr = std::unique_ptr<ade::Graph>;
43     GPtr       generateGraph();               // Unroll GComputation into a GModel
44     void       runPasses(ade::Graph &g);      // Apply all G-API passes on a GModel
45     void       compileIslands(ade::Graph &g); // Instantiate GIslandExecutables in GIslandModel
46     GCompiled  produceCompiled(GPtr &&pg);    // Produce GCompiled from processed GModel
47 };
48
49 }}
50
51 #endif // OPENCV_GAPI_GCOMPILER_HPP