| 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 Intel Corporation |
| 6 | |
| 7 | |
| 8 | #ifndef OPENCV_GAPI_COMPILER_PASSES_HPP |
| 9 | #define OPENCV_GAPI_COMPILER_PASSES_HPP |
| 10 | |
| 11 | #include <ostream> |
| 12 | #include <ade/passes/pass_base.hpp> |
| 13 | |
| 14 | #include "opencv2/gapi/garg.hpp" |
| 15 | #include "opencv2/gapi/gcommon.hpp" |
| 16 | |
| 17 | // Forward declarations - external |
| 18 | namespace ade { |
| 19 | class Graph; |
| 20 | |
| 21 | namespace passes { |
| 22 | struct PassContext; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | // Forward declarations - internal |
| 27 | namespace cv { |
| 28 | class GKernelPackage; |
| 29 | |
| 30 | namespace gapi { |
| 31 | struct GNetPackage; |
| 32 | } // namespace gapi |
| 33 | |
| 34 | namespace gimpl { |
| 35 | |
| 36 | bool is_intrinsic(const std::string &op_name); |
| 37 | |
| 38 | namespace passes { |
| 39 | |
| 40 | void dumpDot(const ade::Graph &g, std::ostream& os); |
| 41 | void dumpDot(ade::passes::PassContext &ctx, std::ostream& os); |
| 42 | void dumpDotStdout(ade::passes::PassContext &ctx); |
| 43 | void dumpGraph(ade::passes::PassContext &ctx, const std::string& dump_path); |
| 44 | void dumpDotToFile(ade::passes::PassContext &ctx, const std::string& dump_path); |
| 45 | |
| 46 | void initIslands(ade::passes::PassContext &ctx); |
| 47 | void checkIslands(ade::passes::PassContext &ctx); |
| 48 | void checkIslandsContent(ade::passes::PassContext &ctx); |
| 49 | |
| 50 | void initMeta(ade::passes::PassContext &ctx, const GMetaArgs &metas); |
| 51 | void inferMeta(ade::passes::PassContext &ctx, bool meta_is_initialized); |
| 52 | void storeResultingMeta(ade::passes::PassContext &ctx); |
| 53 | |
| 54 | void expandKernels(ade::passes::PassContext &ctx, |
| 55 | const GKernelPackage& kernels); |
| 56 | |
| 57 | void bindNetParams(ade::passes::PassContext &ctx, |
| 58 | const gapi::GNetPackage &networks); |
| 59 | |
| 60 | void resolveKernels(ade::passes::PassContext &ctx, |
| 61 | const GKernelPackage &kernels); |
| 62 | |
| 63 | void fuseIslands(ade::passes::PassContext &ctx); |
| 64 | void syncIslandTags(ade::passes::PassContext &ctx); |
| 65 | void topoSortIslands(ade::passes::PassContext &ctx); |
| 66 | |
| 67 | void applyTransformations(ade::passes::PassContext &ctx, |
| 68 | const GKernelPackage &pkg, |
| 69 | const std::vector<std::unique_ptr<ade::Graph>> &preGeneratedPatterns); |
| 70 | |
| 71 | void addStreaming(ade::passes::PassContext &ctx); |
| 72 | |
| 73 | void intrinDesync(ade::passes::PassContext &ctx); |
| 74 | void intrinFinalize(ade::passes::PassContext &ctx); |
| 75 | |
| 76 | }} // namespace gimpl::passes |
| 77 | |
| 78 | } // namespace cv |
| 79 | |
| 80 | #endif // OPENCV_GAPI_COMPILER_PASSES_HPP |
| 81 | |