Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ITT traces to GStreamingExecutor #19917

Merged

Conversation

AsyaPronina
Copy link
Contributor

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
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=ubuntu-openvino-2021.3.0:20.04
build_image:Custom Win=openvino-2021.2.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
test_bigdata:Custom=1
test_filter:Custom=*

@AsyaPronina AsyaPronina force-pushed the asyadev/itt_traces_in_gstreamingexecutor branch from ff8bb51 to 3757ce2 Compare April 16, 2021 01:54
@dmatveev dmatveev self-assigned this Apr 19, 2021
@dmatveev dmatveev added this to the 4.5.3 milestone Apr 19, 2021
Copy link
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.

Looks cool!

modules/gapi/CMakeLists.txt Outdated Show resolved Hide resolved
modules/gapi/CMakeLists.txt Outdated Show resolved Hide resolved
modules/gapi/CMakeLists.txt Outdated Show resolved Hide resolved
modules/gapi/CMakeLists.txt Outdated Show resolved Hide resolved
modules/gapi/src/executor/gstreamingexecutor.cpp Outdated Show resolved Hide resolved
modules/gapi/src/executor/gstreamingexecutor.cpp Outdated Show resolved Hide resolved
modules/gapi/src/utils/gapi_itt.cpp Outdated Show resolved Hide resolved
modules/gapi/src/utils/gapi_itt.hpp Outdated Show resolved Hide resolved
@AsyaPronina AsyaPronina force-pushed the asyadev/itt_traces_in_gstreamingexecutor branch 7 times, most recently from 66a90b7 to 09a5fa9 Compare April 21, 2021 17:36
Copy link
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.

I believe SyncQueue instrumentation can be dropped for now as it only bloats the trace and is nearly equal to StreamingInput::get and so on. Overall well done!

modules/gapi/CMakeLists.txt Outdated Show resolved Hide resolved
backend_name = matches[1].str();
island_name = island_name + "_" + backend_name;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If match fails, I'd use the full backend type name instead of nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Full backend name will contain some mangled symbhols and numbers which are maps to "::" namespace resolution operator, is it applicable?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, please use the full name in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed!

modules/gapi/src/compiler/gislandmodel.cpp Outdated Show resolved Hide resolved
modules/gapi/src/executor/gstreamingexecutor.cpp Outdated Show resolved Hide resolved
@AsyaPronina AsyaPronina force-pushed the asyadev/itt_traces_in_gstreamingexecutor branch 9 times, most recently from 9ad402b to a2b654a Compare April 23, 2021 20:27
@AsyaPronina AsyaPronina force-pushed the asyadev/itt_traces_in_gstreamingexecutor branch 3 times, most recently from 7caf350 to d8ece4a Compare April 23, 2021 21:31
@AsyaPronina
Copy link
Contributor Author

Hi Anton(@anton-potapov)!
Could you please review changes in gtbbexecutor.cpp?
I had to do them because Linux OpenCL build wasn't green without.

Copy link
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.

I think TBB changes are ok and you can proceed with merge after fixing the non-regular island name handling.

if (std::regex_search(backend_impl_type_name, matches, rgx)) {
if (2ul == matches.size()) {
backend_name = matches[1].str();
island_name = island_name + "_" + backend_name;
Copy link
Contributor

Choose a reason for hiding this comment

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

+= ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one is reworked!

backend_name = matches[1].str();
island_name = island_name + "_" + backend_name;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, please use the full name in that case.

@@ -1443,6 +1491,13 @@ void cv::gimpl::GStreamingExecutor::setSource(GRunArgs &&ins)
out_queues.push_back(reader_queues(*m_island_graph, out_eh));
}

// Create just empty island meta information
std::string island_meta_info { };
#if defined(OPENCV_WITH_ITT) && !defined(GAPI_STANDALONE)
Copy link
Contributor

Choose a reason for hiding this comment

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

btw whats wrong with STANDALONE here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!
Thanks a lot!
I have realized that OPENCV_WITH_ITT will be defined only if ITT dependency will be successfully resolved, what can be done only if we building with OpenCV. So, there will be no such define in G-API standalone mode and check for !GAPI_STANDALONE is extra.
I have added a comment about this in itt.hpp file and TODO to support ITT traces in GAPI standalone mode in CMakeLists.txt.

@@ -290,7 +292,8 @@ namespace GIslandModel
// from the original model (! don't mix with DataSlot)
// FIXME: GAPI_EXPORTS because of tests only!
ade::NodeHandle GAPI_EXPORTS producerOf(const ConstGraph &g, ade::NodeHandle &data_nh);

// traceName - returns pretty island name for passed island node
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe in should be traceIslandName

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, Anton!!

@AsyaPronina AsyaPronina force-pushed the asyadev/itt_traces_in_gstreamingexecutor branch 3 times, most recently from a6faabb to 96e2e5a Compare May 4, 2021 13:17
@AsyaPronina AsyaPronina force-pushed the asyadev/itt_traces_in_gstreamingexecutor branch from 96e2e5a to 12170ab Compare May 4, 2021 13:30
@AsyaPronina
Copy link
Contributor Author

Hi Maxim(@mshabunin), Alexander(@alalek)!
Assigning this PR to Ruslan(@rgarnov) as I didn't have time to finish it before DmitryM(@dmatveev)'s vacation.

@AsyaPronina AsyaPronina force-pushed the asyadev/itt_traces_in_gstreamingexecutor branch from 12170ab to 6d630ab Compare May 4, 2021 20:33
std::string backend_name = "";
auto& backend_impl = island_ptr->backend().priv();
std::string backend_impl_type_name = typeid(backend_impl).name();
std::regex rgx("G([a-zA-Z0-9]+)BackendImpl");
Copy link
Contributor

Choose a reason for hiding this comment

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

std::regex is not working in GCC<4.9 (https://stackoverflow.com/questions/12530406/is-gcc-4-8-or-earlier-buggy-about-regular-expressions), but we still kinda support CentOS 7 which uses GCC 4.8.5. Is it possible to rewrite this part without regex usage?

@AsyaPronina AsyaPronina force-pushed the asyadev/itt_traces_in_gstreamingexecutor branch 3 times, most recently from f82892a to 4568709 Compare May 7, 2021 18:20
@AsyaPronina AsyaPronina force-pushed the asyadev/itt_traces_in_gstreamingexecutor branch from 4568709 to 3a49ff9 Compare May 11, 2021 09:55
@alalek alalek merged commit df05bc6 into opencv:master May 11, 2021
@alalek alalek mentioned this pull request Jun 4, 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.

None yet

6 participants