Skip to content

Commit

Permalink
Add profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
usstq committed Jun 17, 2024
1 parent 1d226d4 commit b4750f4
Show file tree
Hide file tree
Showing 3 changed files with 435 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/plugins/intel_cpu/src/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "utils/node_dumper.h"
#include "utils/verbose.h"
#include "utils/precision_support.h"
#include "utils/profiler.hpp"

#include <oneapi/dnnl/dnnl.hpp>
#include "common/primitive_desc_iface.hpp"
Expand Down Expand Up @@ -1343,6 +1344,7 @@ class UpdateNodes : public UpdateNodesBase {
void Graph::InferDynamic(SyncInferRequest* request) {
dnnl::stream stream(getEngine());

PROFILE(_prof0, std::string("Graph::InferDynamic_#") + std::to_string(infer_count));
std::unique_ptr<IUpdateNodes> updateNodes{};
if (parallel_get_max_threads() > 1) {
updateNodes.reset(new UpdateNodes(m_executableGraphNodes));
Expand All @@ -1357,7 +1359,7 @@ void Graph::InferDynamic(SyncInferRequest* request) {
auto& node = m_executableGraphNodes[inferCounter];
VERBOSE(node, getConfig().debugCaps.verbose);
PERF(node, getConfig().collectPerfCounters);

PROFILE(_prof, node->getTypeStr(), node->getName());
if (request)
request->throw_if_canceled();
try {
Expand Down Expand Up @@ -1467,7 +1469,7 @@ void Graph::Infer(SyncInferRequest* request) {
OPENVINO_THROW("Unknown ov::intel_cpu::Graph state: " , static_cast<size_t>(status));
}

if (infer_count != -1) infer_count++;
infer_count++;
}

void Graph::SortTopologically() {
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/intel_cpu/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "utils/debug_capabilities.h"
#include "utils/ngraph_utils.hpp"
#include "utils/rt_info/memory_formats_attribute.hpp"
#include "utils/profiler.hpp"
#include <openvino/opsets/opset1.hpp>

#include <dnnl_types.h>
Expand Down Expand Up @@ -550,6 +551,7 @@ void Node::updateShapes() {
getName());
try {
if (needShapeInfer()) {
//PROFILE(_prof, "shapeInfer", getName());
auto result = shapeInfer();
if (ShapeInferStatus::success == result.status) {
redefineOutputMemory(result.dims);
Expand All @@ -568,6 +570,7 @@ void Node::updateDynamicParams() {
getName());
try {
if (isExecutable()) {
//PROFILE(_prof, "prepareParams", getName());
if (needPrepareParams()) {
OPENVINO_ASSERT(inputShapesDefined(),
"Input shapes are not defined.");
Expand Down
Loading

0 comments on commit b4750f4

Please sign in to comment.