Skip to content

[G-API] Support RMat for PlaidML backend#19782

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
TolyaTalamanov:at/rmat-plaidml-backend
Mar 26, 2021
Merged

[G-API] Support RMat for PlaidML backend#19782
opencv-pushbot merged 1 commit intoopencv:masterfrom
TolyaTalamanov:at/rmat-plaidml-backend

Conversation

@TolyaTalamanov
Copy link
Copy Markdown
Contributor

@TolyaTalamanov TolyaTalamanov commented Mar 25, 2021

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

Build configuration

Xforce_builders_only=linux,docs
force_builders=Custom,Custom Win,Custom Mac
build_gapi_standalone:Linux x64=ade-0.1.1f
build_gapi_standalone:Win64=ade-0.1.1f
build_gapi_standalone:Mac=ade-0.1.1f
build_gapi_standalone:Linux x64 Debug=ade-0.1.1f

Xbuild_image:Custom=centos:7
Xbuildworker:Custom=linux-1
build_gapi_standalone:Custom=ade-0.1.1f

build_image:Custom Win=openvino-2021.1.0
build_image:Custom Mac=openvino-2021.2.0

test_modules:Custom=gapi,python2,python3,java
test_modules:Custom Win=gapi,python2,python3,java
test_modules:Custom Mac=gapi,python2,python3,java

buildworker:Custom=linux-1
# disabled due high memory usage: test_opencl:Custom=ON
test_opencl:Custom=OFF
Xtest_bigdata:Custom=1
Xtest_filter:Custom=*

Xforce_builders=Custom
Xbuildworker:Custom=linux-1
build_image:Custom=plaidml2
Xtest_modules:Custom=gapi
test_filter:Custom=*ML*

@dmatveev dmatveev self-assigned this Mar 25, 2021
@dmatveev dmatveev requested a review from rgarnov March 25, 2021 18:00
@dmatveev dmatveev added this to the 4.5.2 milestone Mar 25, 2021
Copy link
Copy Markdown
Contributor

@dmatveev dmatveev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rgarnov do we have any other backends with an issue like this or this backend just didn't use magazine which "hides" this new detail?

Comment on lines 213 to 221
switch (arg.index())
{
case GRunArg::index_of<cv::Mat>() :
case GRunArg::index_of<cv::RMat>():
{
auto& arg_mat = util::get<cv::Mat>(arg);
binder_->input(it->second).copy_from(arg_mat.data);
auto& rmat = cv::util::get<cv::RMat>(arg);
auto view = rmat.access(cv::RMat::Access::R);
auto mat = cv::gimpl::asMat(view);
binder_->input(it->second).copy_from(mat.data);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rgarnov shouldn't this happen by default? I thought it is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done in default magazine::bindInArg. Default magazine is not used in plaidml backend and I think it's not worth to bring it here. So current changes are good

@TolyaTalamanov
Copy link
Copy Markdown
Contributor Author

@alalek

According log PlaidML wasn't found

[----------] 1 test from GAPI_PlaidML_Pipelines
[ RUN      ] GAPI_PlaidML_Pipelines.ThrowIfPlaidMLNotFound
[       OK ] GAPI_PlaidML_Pipelines.ThrowIfPlaidMLNotFound (0 ms)
[----------] 1 test from GAPI_PlaidML_Pipelines (0 ms total)

doesn't it work anymore ?

force_builders=Custom
buildworker:Custom=linux-1
build_image:Custom=plaidml2
test_modules:Custom=gapi
test_filter:Custom=*ML*

@alalek
Copy link
Copy Markdown
Member

alalek commented Mar 25, 2021

build_image:Custom=plaidml2

This would work if we remove build_image:Custom=ubuntu-openvino-2021.1.0:20.04 above (or comment out).

@TolyaTalamanov TolyaTalamanov force-pushed the at/rmat-plaidml-backend branch from 544d22e to 6ba9906 Compare March 26, 2021 06:01
@TolyaTalamanov
Copy link
Copy Markdown
Contributor Author

Now, it's OK, thanks!

[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from GAPI_PlaidML_Pipelines
[ RUN      ] GAPI_PlaidML_Pipelines.SimpleArithmetic
[       OK ] GAPI_PlaidML_Pipelines.SimpleArithmetic (137 ms)
[ RUN      ] GAPI_PlaidML_Pipelines.TwoInputOperations
[       OK ] GAPI_PlaidML_Pipelines.TwoInputOperations (82 ms)
[ RUN      ] GAPI_PlaidML_Pipelines.TwoOutputOperations
[       OK ] GAPI_PlaidML_Pipelines.TwoOutputOperations (87 ms)
[----------] 3 tests from GAPI_PlaidML_Pipelines (306 ms total)

[----------] Global test environment tear-down
[==========] 3 tests from 1 test case ran. (306 ms total)
[  PASSED  ] 3 tests.

@opencv-pushbot opencv-pushbot merged commit 77bfd94 into opencv:master Mar 26, 2021
@alalek alalek mentioned this pull request Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants