Skip to content

Commit eda21ba

Browse files
[CPU] Introduce additional OV_CPU_VERBOSE levels (openvinotoolkit#26062)
Levels enable printing of: - 1 - executable nodes only - 2 - same as `1` plus `Input` and `Output` nodes - 3 - same as `2` plus constant path nodes (executed in scope of `compile_model()`)
1 parent 267e6f9 commit eda21ba

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

src/plugins/intel_cpu/docs/debug_capabilities/verbose.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ To turn on verbose mode the following environment variable should be used:
2929
OV_CPU_VERBOSE=<level> binary ...
3030
```
3131

32-
Currently verbose mode has only one level, any digit can be used for activation.
32+
Levels enable printing of:
33+
- 1 - executable nodes only
34+
- 2 - same as `1` plus `Input` and `Output` nodes
35+
- 3 - same as `2` plus constant path nodes (executed in scope of `compile_model()`)
3336

3437
To have colored verbose output just duplicate level's digit, for example:
3538
```sh

src/plugins/intel_cpu/src/graph.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,8 @@ void Graph::CreatePrimitivesAndExecConstants() const {
495495
continue;
496496
}
497497

498+
VERBOSE(node, getConfig().debugCaps.verbose);
499+
498500
if (context->getWeightsCache()) {
499501
auto sharedOutputs = acquireSharedOutputs(node);
500502

src/plugins/intel_cpu/src/utils/verbose.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (C) 2018-2024 Intel Corporation
22
// SPDX-License-Identifier: Apache-2.0
33
//
4+
#include "utils/general_utils.h"
45
#ifdef CPU_DEBUG_CAPS
56

67
#include "verbose.h"
@@ -25,22 +26,22 @@ bool Verbose::shouldBePrinted() const {
2526
if (lvl < 1)
2627
return false;
2728

28-
if (node->isConstant() ||
29-
node->getType() == Type::Input || node->getType() == Type::Output)
29+
if (lvl < 2 && one_of(node->getType(), Type::Input, Type::Output))
3030
return false;
31+
32+
if (lvl < 3 && node->isConstant())
33+
return false;
34+
3135
return true;
3236
}
37+
3338
/**
3439
* Print node verbose execution information to cout.
3540
* Similiar to DNNL_VERBOSE output
3641
* Formating written in C using oneDNN format functions.
3742
* Can be rewritten in pure C++ if necessary
3843
*/
3944
void Verbose::printInfo() {
40-
/* 1, 2, 3, etc -> no color
41-
* 11, 22, 33, etc -> colorize */
42-
bool colorUp = lvl / 10 > 0 ? true : false;
43-
4445
enum Color {
4546
RED,
4647
GREEN,

src/plugins/intel_cpu/src/utils/verbose.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ namespace intel_cpu {
1717
class Verbose {
1818
public:
1919
Verbose(const NodePtr& _node, const std::string& _lvl)
20-
: node(_node), lvl(atoi(_lvl.c_str())) {
20+
: node(_node),
21+
lvl(atoi(_lvl.c_str()) % 10),
22+
/* 1, 2, 3, etc -> no color. 11, 22, 33, etc -> colorize */
23+
colorUp(atoi(_lvl.c_str()) / 10) {
2124
if (!shouldBePrinted())
2225
return;
2326
printInfo();
@@ -34,6 +37,7 @@ class Verbose {
3437
private:
3538
const NodePtr& node;
3639
const int lvl;
40+
const bool colorUp;
3741
std::stringstream stream;
3842

3943
bool shouldBePrinted() const;

0 commit comments

Comments
 (0)