diff --git a/docs/template_plugin/src/template_async_infer_request.cpp b/docs/template_plugin/src/template_async_infer_request.cpp index 3facaf7327d5f6..41c1f62724f6b5 100644 --- a/docs/template_plugin/src/template_async_infer_request.cpp +++ b/docs/template_plugin/src/template_async_infer_request.cpp @@ -25,16 +25,19 @@ TemplateAsyncInferRequest::TemplateAsyncInferRequest( if (remoteDevice) { _pipeline = { {cpuTaskExecutor, [this] { - IE_PROFILING_AUTO_SCOPE(PreprocessingAndStartPipeline) + OV_ITT_SCOPED_TASK(itt::domains::TemplatePlugin, + "TemplateAsyncInferRequest::PreprocessingAndStartPipeline"); _inferRequest->inferPreprocess(); _inferRequest->startPipeline(); }}, {_waitExecutor, [this] { - IE_PROFILING_AUTO_SCOPE(WaitPipeline) + OV_ITT_SCOPED_TASK(itt::domains::TemplatePlugin, + "TemplateAsyncInferRequest::WaitPipeline"); _inferRequest->waitPipeline(); }}, {cpuTaskExecutor, [this] { - IE_PROFILING_AUTO_SCOPE(Postprocessing) + OV_ITT_SCOPED_TASK(itt::domains::TemplatePlugin, + "TemplateAsyncInferRequest::Postprocessing"); _inferRequest->inferPostprocess(); }} }; diff --git a/docs/template_plugin/src/template_executable_network.cpp b/docs/template_plugin/src/template_executable_network.cpp index 7eff8da41484be..2914289cf4c4a3 100644 --- a/docs/template_plugin/src/template_executable_network.cpp +++ b/docs/template_plugin/src/template_executable_network.cpp @@ -10,6 +10,7 @@ #include "template/template_config.hpp" #include "template_plugin.hpp" #include "template_executable_network.hpp" +#include "template_itt.hpp" using namespace TemplatePlugin; @@ -61,7 +62,7 @@ TemplatePlugin::ExecutableNetwork::ExecutableNetwork(std::istream & model, model.read(dataBlob->buffer(), dataSize); } - // TODO: implement Import / Export of configuration options + // TODO: implement Import / Export of configuration options and merge with `cfg` // TODO: implement Import / Export of network precisions, layouts, preprocessing info auto cnnnetwork = _plugin->GetCore()->ReadNetwork(xmlString, std::move(dataBlob)); @@ -188,6 +189,8 @@ InferenceEngine::Parameter TemplatePlugin::ExecutableNetwork::GetMetric(const st // ! [executable_network:export_impl] void TemplatePlugin::ExecutableNetwork::ExportImpl(std::ostream& modelStream) { + OV_ITT_SCOPED_TASK(itt::domains::TemplatePlugin, "ExecutableNetwork::ExportImpl"); + // Note: custom ngraph extensions are not supported std::map custom_opsets; std::stringstream xmlFile, binFile; diff --git a/docs/template_plugin/src/template_plugin.cpp b/docs/template_plugin/src/template_plugin.cpp index 6b9610f722f00e..ff339499645cb0 100644 --- a/docs/template_plugin/src/template_plugin.cpp +++ b/docs/template_plugin/src/template_plugin.cpp @@ -16,6 +16,7 @@ #include #include "template/template_config.hpp" +#include "template_itt.hpp" #include "template_plugin.hpp" #include "template_executable_network.hpp" #include "template_infer_request.hpp" @@ -74,6 +75,8 @@ std::shared_ptr TransformNetwork(const std::shared_ptr& config) { - // TODO: Import network from stream is not mandatory functionality; - // Can just throw an exception and remove the code below - Configuration exportedCfg; - - // some code below which reads exportedCfg from `model` stream - // .. + OV_ITT_SCOPED_TASK(itt::domains::TemplatePlugin, "Plugin::ImportNetworkImpl"); - auto cfg = Configuration(config, exportedCfg); - auto exec_network_impl = std::make_shared(model, cfg, std::static_pointer_cast(shared_from_this())); + Configuration cfg(config); + auto exec_network_impl = std::make_shared(model, cfg, + std::static_pointer_cast(shared_from_this())); return make_executable_network(exec_network_impl); } @@ -129,6 +128,8 @@ InferenceEngine::ExecutableNetwork Plugin::ImportNetworkImpl(std::istream& model // ! [plugin:query_network] InferenceEngine::QueryNetworkResult Plugin::QueryNetwork(const InferenceEngine::CNNNetwork &network, const ConfigMap& config) const { + OV_ITT_SCOPED_TASK(itt::domains::TemplatePlugin, "Plugin::QueryNetwork"); + InferenceEngine::QueryNetworkResult res; Configuration cfg{config, _cfg, false}; diff --git a/inference-engine/src/plugin_api/cpp_interfaces/base/ie_infer_async_request_base.hpp b/inference-engine/src/plugin_api/cpp_interfaces/base/ie_infer_async_request_base.hpp index 75f2cc32184f37..886de20784007c 100644 --- a/inference-engine/src/plugin_api/cpp_interfaces/base/ie_infer_async_request_base.hpp +++ b/inference-engine/src/plugin_api/cpp_interfaces/base/ie_infer_async_request_base.hpp @@ -13,7 +13,6 @@ #include #include "ie_iinfer_request.hpp" #include "ie_preprocess.hpp" -#include "ie_profiling.hpp" namespace InferenceEngine { diff --git a/inference-engine/src/plugin_api/ie_profiling.hpp b/inference-engine/src/plugin_api/ie_profiling.hpp deleted file mode 100644 index 1fa34cef89ee2a..00000000000000 --- a/inference-engine/src/plugin_api/ie_profiling.hpp +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (C) 2018-2020 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -/** - * @brief [DEPRECATED] Defines API to profile your plugin using Intel VTune. - * @details This API is still available but deprecated. Use plugin_itt.hpp instead. - * @file ie_profiling.hpp - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/** - * @cond - */ - -#ifdef ENABLE_PROFILING_ITT -#include -#endif - -namespace InferenceEngine { - -template -void annotateBegin(Static&& static_, Block&& block_); - -template -void annotateEnd(Static&& static_, Block&& block_); - -template -struct Annotate { - struct Static_ { - template - struct idx {}; - - template - struct idx : idx {}; - - template - struct idx<0, S...> { - using type = idx; - }; - - template - Static_(ArgTuple&& arg_tuple, idx): static_ {std::get(std::forward(arg_tuple))...} {} - - template - explicit Static_(ArgTuple&& arg_tuple) - : Static_ {std::forward(arg_tuple), typename idx::value>::type {}} {} - - Static static_; - }; - - static Static_ static_; - - Block block_; - - Annotate(const Annotate&) = delete; - Annotate& operator=(const Annotate&) = delete; - Annotate(Annotate&&) = default; - Annotate& operator=(Annotate&&) = default; - - template - inline explicit Annotate(Ts&&... xs): block_ {std::forward(xs)...} { - annotateBegin(static_.static_, block_); - } - - inline ~Annotate() { - annotateEnd(static_.static_, block_); - } -}; - -template -typename Annotate::Static_ Annotate::static_(Local::staticArgs()); - -#define IE_ANNOTATE_CONCAT(x, y) IE_ANNOTATE_CONCAT_EVAL(x, y) -#define IE_ANNOTATE_CONCAT_EVAL(x, y) x##y - -#define IE_ANNOTATE_UNPACK(tuple) IE_ANNOTATE_UNPACK_EVAL tuple -#define IE_ANNOTATE_UNPACK_EVAL(...) __VA_ARGS__ - -#define IE_ANNOTATE_MAKE_NAME(lib_name, postfix) \ - IE_ANNOTATE_CONCAT(IE_ANNOTATE_CONCAT(IE_ANNOTATE_CONCAT(__intel_util_annotate_, lib_name), postfix), __LINE__) - -#define IE_ANNOTATE_LOCAL_TYPE_NAME(lib_name) IE_ANNOTATE_MAKE_NAME(lib_name, _ctx) -#define IE_ANNOTATE_VARIABLE_NAME(lib_name) IE_ANNOTATE_MAKE_NAME(lib_name, _variable) -#define IE_ANNOTATE_FUNC_NAME(lib_name) IE_ANNOTATE_MAKE_NAME(lib_name, _func) - -#define IE_ANNOTATE_MAKE_SCOPE_TYPE(lib_name, static_type, block_type, make_static_args_tuple) \ - struct IE_ANNOTATE_LOCAL_TYPE_NAME(lib_name) \ - : ::InferenceEngine::Annotate { \ - using ::InferenceEngine::Annotate::Annotate; \ - static auto staticArgs() -> decltype(std::make_tuple(IE_ANNOTATE_UNPACK(make_static_args_tuple))) { \ - return std::make_tuple(IE_ANNOTATE_UNPACK(make_static_args_tuple)); \ - } \ - } - -#define IE_ANNOTATE_MAKE_SCOPE(lib_name, static_type, block_type, make_static_args_tuple, make_block_args_tuple) \ - IE_ANNOTATE_MAKE_SCOPE_TYPE(lib_name, static_type, block_type, make_static_args_tuple) \ - IE_ANNOTATE_VARIABLE_NAME(lib_name) {IE_ANNOTATE_UNPACK(make_block_args_tuple)}; - -#ifdef ENABLE_PROFILING_ITT -struct IttTaskHandles { - __itt_domain* const domain; - __itt_string_handle* const handle; - - explicit IttTaskHandles(const char* taskName) - : domain {__itt_domain_create("InferenceEngine")}, handle {__itt_string_handle_create(taskName)} {} -}; - -struct IttBlock {}; - -inline static void annotateBegin(IttTaskHandles& h, IttBlock&) { - __itt_task_begin(h.domain, __itt_null, __itt_null, h.handle); -} - -inline static void annotateEnd(IttTaskHandles& h, IttBlock&) { - __itt_task_end(h.domain); -} - -#define IE_ITT_SCOPE(task_name) \ - IE_ANNOTATE_MAKE_SCOPE(InferenceEngineItt, ::InferenceEngine::IttTaskHandles, ::InferenceEngine::IttBlock, \ - (task_name), ()) -#else -#define IE_ITT_SCOPE(task_name) -#endif - -#define IE_STR(x) IE_STR_(x) -#define IE_STR_(x) #x - -struct ProfilingTask; - -struct IttStatic {}; - -struct IttProfilingTask { - ProfilingTask* t; -}; - -static void annotateBegin(IttStatic&, IttProfilingTask& t); -static void annotateEnd(IttStatic&, IttProfilingTask& t); - -/** - * @class ProfilingTask - * @ingroup ie_dev_profiling - * @brief Used to annotate section of code which would be named at runtime - */ -struct ProfilingTask { - ProfilingTask() = default; - //! @private - ProfilingTask(const ProfilingTask&) = default; - - ProfilingTask& operator =(const ProfilingTask&) = default; - - /** - * @brief Construct ProfilingTask with runtime defined name - */ - inline explicit ProfilingTask(const std::string& taskName) - : name(taskName) -#ifdef ENABLE_PROFILING_ITT - , - domain(__itt_domain_create("InferenceEngine")), - handle(__itt_string_handle_create(taskName.c_str())) -#endif - { - } - -private: - friend void annotateBegin(IttStatic&, IttProfilingTask& t); - friend void annotateEnd(IttStatic&, IttProfilingTask& t); - - std::string name; -#ifdef ENABLE_PROFILING_ITT - __itt_domain* domain; - __itt_string_handle* handle; -#endif -}; - -inline static void annotateBegin(IttStatic&, IttProfilingTask& t) { -#ifdef ENABLE_PROFILING_ITT - __itt_task_begin(t.t->domain, __itt_null, __itt_null, t.t->handle); -#else - (void)t; -#endif -} - -inline static void annotateEnd(IttStatic&, IttProfilingTask& t) { -#ifdef ENABLE_PROFILING_ITT - __itt_task_end(t.t->domain); -#else - (void)t; -#endif -} - -#ifdef ENABLE_PROFILING_ITT -#define IE_ITT_TASK_SCOPE(profilingTask) \ - IE_ANNOTATE_MAKE_SCOPE(InferenceEngineIttScopeTask, ::InferenceEngine::IttStatic, \ - ::InferenceEngine::IttProfilingTask, (), (&(profilingTask))) -#else -#define IE_ITT_TASK_SCOPE(profiling_task) -#endif - -inline static void annotateSetThreadName(const char* name) { -#ifdef ENABLE_PROFILING_ITT - __itt_thread_set_name(name); -#else - (void)(name); -#endif -} - -/** - * @def IE_PROFILING_AUTO_SCOPE(NAME) - * @ingroup ie_dev_profiling - * @brief Annotate section of code till scope exit to be profiled using known at compile time @p NAME as section id - * @param NAME Known at compile time name of section of code that is passed to profiling back end - */ -#define IE_PROFILING_AUTO_SCOPE(NAME) IE_ITT_SCOPE(IE_STR(NAME)); - - -/** - * @def IE_PROFILING_AUTO_SCOPE_TASK(PROFILING_TASK) - * @ingroup ie_dev_profiling - * @brief Annotate section of code till scope exit to be profiled runtime configured variable of ProfilingTask type. - * ProfilingTask::name will be used as section id. - * @param PROFILING_TASK variable of ProfilingTask type - */ -#define IE_PROFILING_AUTO_SCOPE_TASK(PROFILING_TASK) IE_ITT_TASK_SCOPE(PROFILING_TASK); -} // namespace InferenceEngine - -/** - * @endcond - */ diff --git a/inference-engine/src/preprocessing/ie_preprocess_data.hpp b/inference-engine/src/preprocessing/ie_preprocess_data.hpp index 969141a9d3e9ac..f0e351f09bff59 100644 --- a/inference-engine/src/preprocessing/ie_preprocess_data.hpp +++ b/inference-engine/src/preprocessing/ie_preprocess_data.hpp @@ -9,7 +9,6 @@ #include #include -#include #include #include diff --git a/inference-engine/src/preprocessing/ie_preprocess_gapi.hpp b/inference-engine/src/preprocessing/ie_preprocess_gapi.hpp index de953f46c4ff51..d2aaf707bfaf7a 100644 --- a/inference-engine/src/preprocessing/ie_preprocess_gapi.hpp +++ b/inference-engine/src/preprocessing/ie_preprocess_gapi.hpp @@ -13,7 +13,6 @@ #include #include #include -#include "ie_profiling.hpp" #include // FIXME: Move this definition back to ie_preprocess_data,