[G-API] GExecutor abstract interface#21762
Conversation
| // - cv::MediaFrame - for media buffers | ||
| // - cv::Scalar - for single values (with up to four components inside) | ||
| // - cv::detail::VectorRef - an untyped wrapper over std::vector<T> | ||
| // - cv::detail::OpaqueRef - an untyped wrapper over an object with an arbitrary type T |
There was a problem hiding this comment.
Is it a valid change from me? I'm just not sure these types used for exchanging between Islands
| } | ||
| } | ||
|
|
||
| void assignMetaStubExec(Mag& mag, const RcDesc &rc, const cv::GRunArg::Meta &meta) { |
There was a problem hiding this comment.
as for me it looks like these bunch of functions which interact with Mag should be members of this class Mag
Or located in different file at least
Could you move out this functions into different file, please?
There was a problem hiding this comment.
No need to do that, Magazine class itself is not bound to its contents (it is template)
There was a problem hiding this comment.
We can consider this as part of further refactoring if ever we'll need it in more than 1 place
sivanov-work
left a comment
There was a problem hiding this comment.
Are there any unit tests for check backward compatibility for that changes?
| virtual StreamMsg get() override | ||
| { | ||
| cv::GRunArgs res; | ||
| for (const auto &rc : desc()) { res.emplace_back(magazine::getArg(mag, rc)); } |
There was a problem hiding this comment.
is it possible to make res.reserve(desc.size()) ?
| { | ||
| set(rcs); | ||
| } | ||
| }; |
There was a problem hiding this comment.
I recommend moving this (input + output) out into separate files also
There was a problem hiding this comment.
Input/Output implementations are executor-specific, maybe no need to move
| } | ||
| }; | ||
|
|
||
| void cv::gimpl::GSerialExecutor::initResource(const ade::NodeHandle & nh, const ade::NodeHandle &orig_nh) |
There was a problem hiding this comment.
not the clearest method name: what kind of resource ? As for me methods with prefix init called at once usually to init something global resource but here we sequencially make initResource in loop.
Can we give more suitable name for that?
| // (5), (6) | ||
| Input i{m_res, op.in_objects}; | ||
| Output o{m_res, op.out_objects}; | ||
| op.isl_exec->run(i, o); |
There was a problem hiding this comment.
Previously
struct OpDesc
{
std::vector<RcDesc> in_objects;
std::vector<RcDesc> out_objects;
std::shared_ptr<GIslandExecutable> isl_exec;
};
I cannot understand an idea: what is the reason to group in_objject, out_objects and isl_exec together and do not use it's coupling benefit. It looks like it should be decoupled or regroupped them in any other way
There was a problem hiding this comment.
It is legacy, this executor has been written based on CPU backend so CPU operations turned into "Islands" (but remained "ops" for some reason)
| GAPI_Assert(canReshape()); | ||
| auto& g = *m_orig_graph.get(); | ||
| ade::passes::PassContext ctx{g}; | ||
| passes::initMeta(ctx, inMetas); |
There was a problem hiding this comment.
if this is some kind of checks then should it be done on canReshape part?
| // It is subject to the license terms in the LICENSE file found in the top-level directory | ||
| // of this distribution and at http://opencv.org/license.html. | ||
| // | ||
| // Copyright (C) 2018-2022 Intel Corporation |
There was a problem hiding this comment.
Just 2022 I suppose
|
|
||
| void cv::gimpl::GSerialExecutor::runImpl(cv::gimpl::GRuntimeArgs &&args) | ||
| { | ||
| // (2) |
There was a problem hiding this comment.
Please, remove those steps or add documentation on them at the begging of the runImpl
There was a problem hiding this comment.
I'd rather add that documentation piece back :)
| // It is subject to the license terms in the LICENSE file found in the top-level directory | ||
| // of this distribution and at http://opencv.org/license.html. | ||
| // | ||
| // Copyright (C) 2018-2022 Intel Corporation |
dmatveev
left a comment
There was a problem hiding this comment.
👍 probably the what's needs to be addressed is a comment about serial executor's execution flow
| GModel::ConstGraph cgr(*pg); | ||
|
|
||
| // FIXME: select which executor will be actually used, | ||
| // make GExecutor abstract. |
There was a problem hiding this comment.
GExecutor is irrelevant here, since this method is about Streaming
| } | ||
| } | ||
|
|
||
| void assignMetaStubExec(Mag& mag, const RcDesc &rc, const cv::GRunArg::Meta &meta) { |
There was a problem hiding this comment.
No need to do that, Magazine class itself is not bound to its contents (it is template)
| } | ||
| } | ||
|
|
||
| void assignMetaStubExec(Mag& mag, const RcDesc &rc, const cv::GRunArg::Meta &meta) { |
There was a problem hiding this comment.
We can consider this as part of further refactoring if ever we'll need it in more than 1 place
| { | ||
| set(rcs); | ||
| } | ||
| }; |
There was a problem hiding this comment.
Input/Output implementations are executor-specific, maybe no need to move
|
|
||
| void cv::gimpl::GSerialExecutor::runImpl(cv::gimpl::GRuntimeArgs &&args) | ||
| { | ||
| // (2) |
There was a problem hiding this comment.
I'd rather add that documentation piece back :)
| // (5), (6) | ||
| Input i{m_res, op.in_objects}; | ||
| Output o{m_res, op.out_objects}; | ||
| op.isl_exec->run(i, o); |
There was a problem hiding this comment.
It is legacy, this executor has been written based on CPU backend so CPU operations turned into "Islands" (but remained "ops" for some reason)
| } // namespace gimpl | ||
| } // namespace cv | ||
|
|
||
| #endif // OPENCV_GAPI_GEXECUTOR_HPP |
There was a problem hiding this comment.
should be aligned with OPENCV_GAPI_SERIAL_EXECUTOR_HPP
or even add _SRC_: OPENCV_GAPI_SRC_SERIAL_EXECUTOR_HPP
Please rebase to resolve conflicts. |
Inheritor of #19329
This pull request separates GExecutor into interface (more accurately the base part with customization points) and GSerialExecutor which is an implementation for the naive executor.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.