diff --git a/src/common/itt/include/openvino/itt.hpp b/src/common/itt/include/openvino/itt.hpp index 9e7ecf19c01398..609f26ac02ad08 100644 --- a/src/common/itt/include/openvino/itt.hpp +++ b/src/common/itt/include/openvino/itt.hpp @@ -41,7 +41,6 @@ typedef struct handle_ { * @cond */ namespace internal { -bool is_initialized(); domain_t domain(const char* name); handle_t handle(const char* name); void taskBegin(domain_t d, handle_t t); diff --git a/src/common/itt/src/itt.cpp b/src/common/itt/src/itt.cpp index 170be210ba7038..53ac19dcfa7ba4 100644 --- a/src/common/itt/src/itt.cpp +++ b/src/common/itt/src/itt.cpp @@ -21,7 +21,7 @@ namespace internal { static __itt_collection_state state = __itt_get_collection_state(); -bool is_initialized() { +static inline bool is_initialized() { return state == __itt_collection_init_successful; } @@ -110,10 +110,6 @@ void regionEnd(domain_t d) { #else -bool is_initialized() { - return false; -} - domain_t domain(const char*) { return nullptr; } diff --git a/src/plugins/intel_cpu/src/graph.cpp b/src/plugins/intel_cpu/src/graph.cpp index 337ff590e852b8..1c2cee63aea526 100644 --- a/src/plugins/intel_cpu/src/graph.cpp +++ b/src/plugins/intel_cpu/src/graph.cpp @@ -1598,11 +1598,11 @@ class UpdateNodes : public UpdateNodesBase { /* group all the profiling macros into a single one * to avoid cluttering a core logic */ -#define VERBOSE_PERF_DUMP_ITT_DEBUG_LOG(ittScope, node, config) \ - VERBOSE(node, (config).debugCaps.verbose); \ - PERF(node, (config).collectPerfCounters); \ - DUMP(node, (config).debugCaps, infer_count); \ - OV_ITT_SCOPED_TASK(ov::itt::domains::ov_op_exec, (node)->getTypeStr()); \ +#define VERBOSE_PERF_DUMP_ITT_DEBUG_LOG(ittScope, node, config) \ + VERBOSE(node, (config).debugCaps.verbose); \ + PERF(node, (config).collectPerfCounters); \ + DUMP(node, (config).debugCaps, infer_count); \ + OV_ITT_SCOPED_TASK_BASE(ittScope, (node)->perfCounters().execute); \ DEBUG_LOG(*(node)); inline void Graph::ExecuteNode(const NodePtr& node, SyncInferRequest* request, int numaId) const { diff --git a/src/plugins/intel_cpu/src/itt.h b/src/plugins/intel_cpu/src/itt.h index da236565a66721..3944ae32f99bfb 100644 --- a/src/plugins/intel_cpu/src/itt.h +++ b/src/plugins/intel_cpu/src/itt.h @@ -25,45 +25,6 @@ OV_ITT_DOMAIN(ov_intel_cpu, "ov::intel_cpu"); OV_ITT_DOMAIN(ov_intel_cpu_LT, "ov::intel_cpu::lt"); } // namespace ov::intel_cpu::itt::domains -namespace ov::intel_cpu::itt { - -class ScopedOpExecTask { -public: - explicit ScopedOpExecTask(const char* name) noexcept { - if (openvino::itt::internal::is_initialized()) { - m_handle = openvino::itt::handle(name); - openvino::itt::internal::taskBegin(::ov::itt::domains::ov_op_exec(), m_handle); - } - } - explicit ScopedOpExecTask(const std::string& name) noexcept : ScopedOpExecTask(name.c_str()) {} - ~ScopedOpExecTask() noexcept { - if (openvino::itt::internal::is_initialized()) { - openvino::itt::internal::taskEnd(::ov::itt::domains::ov_op_exec()); - } - } - - ScopedOpExecTask(const ScopedOpExecTask&) = delete; - ScopedOpExecTask& operator=(const ScopedOpExecTask&) = delete; - -private: - openvino::itt::handle_t m_handle{}; -}; - -} // namespace ov::intel_cpu::itt - -#if defined(SELECTIVE_BUILD_ANALYZER) || defined(SELECTIVE_BUILD) -# define OV_CPU_NODE_SCOPED_TASK(taskName) OV_ITT_SCOPED_TASK(::ov::itt::domains::ov_op_exec, taskName) -# define OV_CPU_NODE_SCOPED_TASK_BASE(taskName) OV_ITT_SCOPED_TASK_BASE(::ov::itt::domains::ov_op_exec, taskName) -#else -# define OV_CPU_NODE_SCOPE_CONCAT_IMPL(x, y) x##y -# define OV_CPU_NODE_SCOPE_CONCAT(x, y) OV_CPU_NODE_SCOPE_CONCAT_IMPL(x, y) -# define OV_CPU_NODE_SCOPED_TASK_INTERNAL(varName, taskName) ::ov::intel_cpu::itt::ScopedOpExecTask varName(taskName) -# define OV_CPU_NODE_SCOPED_TASK(taskName) \ - OV_CPU_NODE_SCOPED_TASK_INTERNAL(OV_CPU_NODE_SCOPE_CONCAT(cpuNodeScopedTaskGuard, __LINE__), taskName) -# define OV_CPU_NODE_SCOPED_TASK_BASE(taskName) \ - OV_CPU_NODE_SCOPED_TASK_INTERNAL(OV_CPU_NODE_SCOPE_CONCAT(cpuNodeScopedTaskGuardBase, __LINE__), taskName) -#endif - #if defined(SELECTIVE_BUILD_ANALYZER) # define CPU_LPT_SCOPE(region) OV_SCOPE(intel_cpu, region) # define CPU_GRAPH_OPTIMIZER_SCOPE(region) OV_SCOPE(intel_cpu, region) diff --git a/src/plugins/intel_cpu/src/node.cpp b/src/plugins/intel_cpu/src/node.cpp index 318ce181c30a1c..8482b63d67dc9a 100644 --- a/src/plugins/intel_cpu/src/node.cpp +++ b/src/plugins/intel_cpu/src/node.cpp @@ -21,7 +21,6 @@ #include #include -#include "../../core/src/itt.hpp" #include "cpu_memory.h" #include "cpu_types.h" #include "dnnl_extension_utils.h" @@ -77,8 +76,7 @@ Node::Node(const std::shared_ptr& op, GraphContext::CPtr ctx, const Sh engine(context->getEngine()), name(op->get_friendly_name()), typeStr(op->get_type_name()), - type(TypeFromName(op->get_type_name())), - profiling(op->get_friendly_name()) { + type(TypeFromName(op->get_type_name())) { for (size_t i = 0; i < op->get_input_size(); i++) { const auto& shape = op->get_input_partial_shape(i); OPENVINO_ASSERT(!shape.rank().is_dynamic(), @@ -196,7 +194,7 @@ Node::Node(const std::string& type, std::vector outShapes, std::vector inputPrecisions, std::vector outputPrecisions, - const std::string& name, + std::string name, const GraphContext::CPtr& ctx) : inputShapes(std::move(inShapes)), outputShapes(std::move(outShapes)), @@ -206,10 +204,9 @@ Node::Node(const std::string& type, originalOutputPrecisions(std::move(outputPrecisions)), fusingPort(-1), engine(ctx->getEngine()), - name(name), + name(std::move(name)), typeStr(type), - type(TypeFromName(type)), - profiling(name) { + type(TypeFromName(type)) { parentEdges.reserve(inputShapes.size()); childEdges.reserve(outputShapes.size()); } @@ -823,7 +820,6 @@ void Node::updateDynamicParams() { } void Node::execute(const dnnl::stream& strm, int numaId) { - OV_CPU_NODE_SCOPED_TASK_BASE(getTypeStr()); if (isDynamicNode()) { executeDynamic(strm, numaId); } else { diff --git a/src/plugins/intel_cpu/src/node.h b/src/plugins/intel_cpu/src/node.h index c360f68179b893..7e6f340a6d95a7 100644 --- a/src/plugins/intel_cpu/src/node.h +++ b/src/plugins/intel_cpu/src/node.h @@ -187,8 +187,8 @@ class Node { struct Tag {}; struct PerfCounters { - explicit PerfCounters(const std::string& name) - : execute(openvino::itt::handle(name)), + PerfCounters() + : execute(openvino::itt::handle>("Node::execute")), getSupportedDescriptors(openvino::itt::handle>("Node::getSupportedDescriptors")), initSupportedPrimitiveDescriptors( openvino::itt::handle>("Node::initSupportedPrimitiveDescriptors")), @@ -202,6 +202,7 @@ class Node { template void buildClassCounters(const std::string& type_name) { + execute = openvino::itt::handle>(type_name + "::execute"); getSupportedDescriptors = openvino::itt::handle>(type_name + "::getSupportedDescriptors"); initSupportedPrimitiveDescriptors = openvino::itt::handle>(type_name + "::initSupportedPrimitiveDescriptors"); @@ -730,7 +731,7 @@ class Node { std::vector outShapes, std::vector originalInputPrecisions, std::vector originalOutputPrecisions, - const std::string& name, + std::string name, const GraphContext::CPtr& ctx); int selectedPrimitiveDescriptorIndex = -1;