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.
5 // Copyright (C) 2018-2019 Intel Corporation
8 #ifndef OPENCV_GAPI_GGPUBACKEND_HPP
9 #define OPENCV_GAPI_GGPUBACKEND_HPP
12 #include <unordered_map> // unordered_map
13 #include <tuple> // tuple
14 #include <ade/util/algorithm.hpp> // type_list_index
16 #include "opencv2/gapi/garg.hpp"
17 #include "opencv2/gapi/gproto.hpp"
18 #include "opencv2/gapi/gpu/ggpukernel.hpp"
21 #include "api/gapi_priv.hpp"
22 #include "backends/common/gbackend.hpp"
23 #include "compiler/gislandmodel.hpp"
25 namespace cv { namespace gimpl {
29 static const char *name() { return "GPUKernel"; }
33 class GGPUExecutable final: public GIslandExecutable
35 const ade::Graph &m_g;
36 GModel::ConstGraph m_gm;
41 GMetaArgs expected_out_metas;
44 // Execution script, currently absolutely naive
45 std::vector<OperationInfo> m_script;
46 // List of all resources in graph (both internal and external)
47 std::vector<ade::NodeHandle> m_dataNodes;
49 // Actual data of all resources in graph (both internal and external)
51 GArg packArg(const GArg &arg);
54 GGPUExecutable(const ade::Graph &graph,
55 const std::vector<ade::NodeHandle> &nodes);
57 virtual inline bool canReshape() const override { return false; }
58 virtual inline void reshape(ade::Graph&, const GCompileArgs&) override
60 // FIXME: GPU plugin is in fact reshapeable (as it was initially,
61 // even before outMeta() has been introduced), so this limitation
63 util::throw_error(std::logic_error("GGPUExecutable::reshape() should never be called"));
66 virtual void run(std::vector<InObj> &&input_objs,
67 std::vector<OutObj> &&output_objs) override;
72 #endif // OPENCV_GAPI_GGPUBACKEND_HPP