Skip to content

Commit c6d55b9

Browse files
authored
[CPU] Use ITT regions API (#31499)
### Details: - Enable basic ITT tracing by default (introduce 3 options `-DENABLE_PROFILING_ITT=OFF/BASE/FULL`) - [CPU] Introduce usage of region tracing ITT API - [CPU] Align naming of the events ### Tickets: - CVS-170917
1 parent 922f8c8 commit c6d55b9

File tree

35 files changed

+380
-110
lines changed

35 files changed

+380
-110
lines changed

.github/workflows/clang_tidy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ jobs:
153153
cmake \
154154
-G "${{ env.CMAKE_GENERATOR }}" \
155155
-DENABLE_CLANG_TIDY=ON \
156-
-DENABLE_PROFILING_ITT=ON \
156+
-DENABLE_PROFILING_ITT=FULL \
157157
-DENABLE_DEBUG_CAPS=ON \
158158
-DSELECTIVE_BUILD=COLLECT \
159159
-DENABLE_PYTHON=OFF \
@@ -219,7 +219,7 @@ jobs:
219219
cmake \
220220
-G "${{ env.CMAKE_GENERATOR }}" \
221221
-DENABLE_CLANG_TIDY=ON \
222-
-DENABLE_PROFILING_ITT=ON \
222+
-DENABLE_PROFILING_ITT=FULL \
223223
-DENABLE_DEBUG_CAPS=ON \
224224
-DSELECTIVE_BUILD=COLLECT \
225225
-DENABLE_PYTHON=OFF \
@@ -288,7 +288,7 @@ jobs:
288288
-G "${{ env.CMAKE_GENERATOR }}" \
289289
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/riscv64-100-xuantie-gnu.toolchain.cmake \
290290
-DENABLE_CLANG_TIDY=ON \
291-
-DENABLE_PROFILING_ITT=ON \
291+
-DENABLE_PROFILING_ITT=FULL \
292292
-DENABLE_DEBUG_CAPS=ON \
293293
-DSELECTIVE_BUILD=COLLECT \
294294
-DENABLE_PYTHON=OFF \

.github/workflows/code_style.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ jobs:
7878
submodules: 'true'
7979

8080
# Run cmake with extra options to cover as much source code as possible:
81-
# - -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT to enable codestyle check for ITT collector
81+
# - -DENABLE_PROFILING_ITT=FULL -DSELECTIVE_BUILD=COLLECT to enable codestyle check for ITT collector
8282
# - -DENABLE_SNIPPETS_LIBXSMM_TPP to cover snippets TPP adaptation
8383
- name: CMake configure
84-
run: cmake -DENABLE_PYTHON=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -DENABLE_SNIPPETS_LIBXSMM_TPP=ON -B build
84+
run: cmake -DENABLE_PYTHON=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=FULL -DSELECTIVE_BUILD=COLLECT -DENABLE_SNIPPETS_LIBXSMM_TPP=ON -B build
8585

8686
- name: Create code style diff
8787
run: cmake --build build --target clang_format_fix_all -j8
@@ -110,10 +110,10 @@ jobs:
110110
submodules: 'true'
111111

112112
# Run cmake with extra options to cover as much source code as possible:
113-
# - -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT to enable codestyle check for ITT collector
113+
# - -DENABLE_PROFILING_ITT=FULL -DSELECTIVE_BUILD=COLLECT to enable codestyle check for ITT collector
114114
# - -DENABLE_SNIPPETS_LIBXSMM_TPP to cover snippets TPP adaptation
115115
- name: CMake configure
116-
run: cmake -DENABLE_CLANG_FORMAT=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -DENABLE_SNIPPETS_LIBXSMM_TPP=ON -DCMAKE_TOOLCHAIN_FILE=cmake/arm64.toolchain.cmake -B build_arm64
116+
run: cmake -DENABLE_CLANG_FORMAT=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=FULL -DSELECTIVE_BUILD=COLLECT -DENABLE_SNIPPETS_LIBXSMM_TPP=ON -DCMAKE_TOOLCHAIN_FILE=cmake/arm64.toolchain.cmake -B build_arm64
117117

118118
- name: Create code style diff
119119
run: cmake --build build_arm64 --target clang_format_fix_all -j8
@@ -142,7 +142,7 @@ jobs:
142142
submodules: 'true'
143143

144144
- name: CMake configure
145-
run: cmake -DENABLE_CLANG_FORMAT=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/riscv64.linux.toolchain.cmake -B build_riscv64
145+
run: cmake -DENABLE_CLANG_FORMAT=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=FULL -DSELECTIVE_BUILD=COLLECT -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/riscv64.linux.toolchain.cmake -B build_riscv64
146146

147147
- name: Create code style diff
148148
run: cmake --build build_riscv64 --target clang_format_fix_all -j8

.github/workflows/linux_conditional_compilation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ jobs:
172172
-DENABLE_TESTS=ON \
173173
-DENABLE_CPPLINT=OFF \
174174
-DENABLE_NCC_STYLE=OFF \
175-
-DENABLE_PROFILING_ITT=ON \
175+
-DENABLE_PROFILING_ITT=FULL \
176176
-DSELECTIVE_BUILD=COLLECT \
177177
-DENABLE_UNITY_BUILD=ON \
178178
-DENABLE_DEBUG_CAPS=ON \

.github/workflows/windows_conditional_compilation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ jobs:
177177
-DENABLE_TESTS=ON `
178178
-DENABLE_CPPLINT=OFF `
179179
-DENABLE_NCC_STYLE=OFF `
180-
-DENABLE_PROFILING_ITT=ON `
180+
-DENABLE_PROFILING_ITT=FULL `
181181
-DSELECTIVE_BUILD=COLLECT `
182182
-DENABLE_UNITY_BUILD=ON `
183183
-DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=ON `

cmake/features.cmake

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,17 @@ ov_dependent_option (ENABLE_SNIPPETS_DEBUG_CAPS "enable Snippets debug capabilit
5454

5555
ov_dependent_option (ENABLE_SNIPPETS_LIBXSMM_TPP "allow Snippets to use LIBXSMM Tensor Processing Primitives" OFF "ENABLE_INTEL_CPU AND (X86_64 OR AARCH64)" OFF)
5656

57-
ov_option (ENABLE_PROFILING_ITT "Build with ITT tracing. Optionally configure pre-built ittnotify library though INTEL_VTUNE_DIR variable." OFF)
57+
## ITT tracing level: OFF | BASE | FULL
58+
# OFF - no ITT backend linked; macros are no-ops
59+
# BASE - link ITT backend; only top-level API scopes are active (default)
60+
# FULL - link ITT backend; preserve full instrumentation (default prior behavior)
61+
if(X86_64)
62+
set(ENABLE_PROFILING_ITT_DEFAULT BASE)
63+
else()
64+
set(ENABLE_PROFILING_ITT_DEFAULT OFF)
65+
endif()
66+
ov_option_enum(ENABLE_PROFILING_ITT "ITT tracing mode: OFF | BASE | FULL" ${ENABLE_PROFILING_ITT_DEFAULT}
67+
ALLOWED_VALUES OFF BASE FULL)
5868

5969
ov_option_enum(ENABLE_PROFILING_FILTER "Enable or disable ITT counter groups.\
6070
Supported values:\

cmake/templates/OpenVINOConfig.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ macro(_ov_find_itt)
361361
set(_ENABLE_PROFILING_ITT "@ENABLE_PROFILING_ITT@")
362362
# whether 'ittapi' is found via find_package
363363
set(_ENABLE_SYSTEM_ITTAPI "@ittapi_FOUND@")
364-
if(_ENABLE_PROFILING_ITT AND _ENABLE_SYSTEM_ITTAPI)
364+
if(NOT _ENABLE_PROFILING_ITT STREQUAL "OFF" AND _ENABLE_SYSTEM_ITTAPI)
365365
_ov_find_dependency(ittapi)
366366
endif()
367367
unset(_ENABLE_PROFILING_ITT)

docs/articles_en/openvino-workflow/deployment-locally/optimial-binary-size-conditional-compilation.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Lean more in the `conditional_compilation_guide <https://github.com/openvinotool
1313

1414
There are two steps to reduce binary size of the OpenVINO runtime library with conditional compilation:
1515

16-
- Apply ``SELECTIVE_BUILD=COLLECT`` and ``DENABLE_PROFILING_ITT=ON`` build options to enable analysis mode of conditional compilation to collect statistics data using ``itt``.
16+
- Apply ``SELECTIVE_BUILD=COLLECT`` and ``DENABLE_PROFILING_ITT=FULL`` build options to enable analysis mode of conditional compilation to collect statistics data using ``itt``.
1717

1818
- Apply ``SELECTIVE_BUILD=ON`` and ``SELECTIVE_BUILD_STAT=<statistics_data.csv>`` build options to exclude inactive code region with the help of previous statistics data and get the final OpenVINO package.
1919

@@ -35,7 +35,7 @@ Stage 1: collecting statistics information about code usage
3535
git submodule init
3636
git submodule update
3737
mkdir build && cd build
38-
cmake -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT ..
38+
cmake -DENABLE_PROFILING_ITT=FULL -DSELECTIVE_BUILD=COLLECT ..
3939
cmake --build .
4040
4141
- Build ITT collector for code usage analysis
@@ -239,7 +239,7 @@ Build OpenVINO with conditional compilation enabled:
239239
cd %OPENVINO_HOME%
240240
md build_cc
241241
cd build_cc
242-
cmake -G Ninja -Wno-dev -DCMAKE_BUILD_TYPE=Debug -DENABLE_CPPLINT=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=OFF -DENABLE_FASTER_BUILD=ON -DENABLE_SANITIZER=OFF -DTHREADING=TBB -DBUILD_SHARED_LIBS=OFF -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -DENABLE_INTEL_GPU=OFF -DENABLE_MULTI=OFF -DENABLE_AUTO=OFF -DENABLE_AUTO_BATCH=OFF -DENABLE_HETERO=OFF -DENABLE_TEMPLATE=OFF -DENABLE_OV_ONNX_FRONTEND=OFF -DENABLE_OV_PADDLE_FRONTEND=OFF -DENABLE_OV_PYTORCH_FRONTEND=OFF -DENABLE_OV_JAX_FRONTEND=OFF -DENABLE_OV_TF_FRONTEND=OFF -DCMAKE_INSTALL_PREFIX=install ..
242+
cmake -G Ninja -Wno-dev -DCMAKE_BUILD_TYPE=Debug -DENABLE_CPPLINT=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=OFF -DENABLE_FASTER_BUILD=ON -DENABLE_SANITIZER=OFF -DTHREADING=TBB -DBUILD_SHARED_LIBS=OFF -DENABLE_PROFILING_ITT=FULL -DSELECTIVE_BUILD=COLLECT -DENABLE_INTEL_GPU=OFF -DENABLE_MULTI=OFF -DENABLE_AUTO=OFF -DENABLE_AUTO_BATCH=OFF -DENABLE_HETERO=OFF -DENABLE_TEMPLATE=OFF -DENABLE_OV_ONNX_FRONTEND=OFF -DENABLE_OV_PADDLE_FRONTEND=OFF -DENABLE_OV_PYTORCH_FRONTEND=OFF -DENABLE_OV_JAX_FRONTEND=OFF -DENABLE_OV_TF_FRONTEND=OFF -DCMAKE_INSTALL_PREFIX=install ..
243243
244244
cmake --build . --config Debug
245245

docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/auto-device-selection/debugging-auto-device.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ in which the ``LOG_LEVEL`` is represented by the first letter of its name (ERROR
6969
Instrumentation and Tracing Technology
7070
######################################
7171

72-
All major performance calls of both OpenVINO™ Runtime and the AUTO plugin are instrumented with Instrumentation and Tracing Technology (ITT) APIs. To enable ITT in OpenVINO™ Runtime, compile it with the following option:
72+
All major performance calls of both OpenVINO™ Runtime and the AUTO plugin are instrumented with Instrumentation and Tracing Technology (ITT) APIs. ITT is enabled by default with BASE level tracing. For full instrumentation, compile with the following option:
7373

7474
.. code-block:: sh
7575
76-
-DENABLE_PROFILING_ITT=ON
76+
-DENABLE_PROFILING_ITT=FULL
7777
7878
7979
For more information, you can refer to:

docs/dev/conditional_compilation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ However, conditional compilation has a significant drawback - the resulting Open
1919

2020
There are two conditional compilation build stages: `SELECTIVE_BUILD=COLLECT` and `SELECTIVE_BUILD=ON`.
2121

22-
`SELECTIVE_BUILD=COLLECT` enables analysis mode for annotated code regions. It can be used to collect statistics data using `itt`. Once this stage is completed, run an OpenVINO sample, such as benchmark_app, to generate actual statistic data. Then run `itt_collector tool` to dump the data into csv files. This stage can be enabled during the OpenVINO build with the options `-DSELECTIVE_BUILD=COLLECT -DENABLE_PROFILING_ITT=ON`.
22+
`SELECTIVE_BUILD=COLLECT` enables analysis mode for annotated code regions. It can be used to collect statistics data using `itt`. Once this stage is completed, run an OpenVINO sample, such as benchmark_app, to generate actual statistic data. Then run `itt_collector tool` to dump the data into csv files. This stage can be enabled during the OpenVINO build with the options `-DSELECTIVE_BUILD=COLLECT -DENABLE_PROFILING_ITT=FULL`.
2323

24-
`SELECTIVE_BUILD=ON` excludes all inactive annotated code regions from the compiled binaries using `csv files` generated by the `itt_collector tool`. It is done by a header file which generated from the `csv files`. This stage need build OpenVINO with option `-DSELECTIVE_BUILD=ON -DENABLE_PROFILING_ITT=OFF -DSELECTIVE_BUILD_STAT=<cc_data.csv>`. Notice: `-DENABLE_PROFILING_ITT=OFF` is not must, if user wants to have ITT counters in final application, he can set it ON: `-DENABLE_PROFILING_ITT=ON`.
24+
`SELECTIVE_BUILD=ON` excludes all inactive annotated code regions from the compiled binaries using `csv files` generated by the `itt_collector tool`. It is done by a header file which generated from the `csv files`. This stage need build OpenVINO with option `-DSELECTIVE_BUILD=ON -DENABLE_PROFILING_ITT=OFF -DSELECTIVE_BUILD_STAT=<cc_data.csv>`. Notice: `-DENABLE_PROFILING_ITT=OFF` is not must, if user wants to have ITT counters in final application, he can set it FULL: `-DENABLE_PROFILING_ITT=FULL`.
2525

2626
> **NOTE**: If the above options are not enabled, conditional compilation will be OFF and the default behavior is kept, all OpenVINO features are enabled. You can ignore `SELECTIVE_BUILD` or set option `-DSELECTIVE_BUILD=OFF`.
2727
@@ -39,7 +39,7 @@ Conditional compilation has two stages:
3939
```mermaid
4040
flowchart LR
4141
subgraph collect[Collect statistic]
42-
cmake_collect[mkdir build\ncd build\ncmake -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT ..]
42+
cmake_collect[mkdir build\ncd build\ncmake -DENABLE_PROFILING_ITT=FULL -DSELECTIVE_BUILD=COLLECT ..]
4343
build_collect[cmake --build .\ncmake --build . --target sea_itt_lib]
4444
run_collect["python ../thirdparty/itt_collector/runtool/sea_runtool.py --bindir ${OPENVINO_LIBRARY_DIR} \ \n-o ${MY_MODEL_RESULT} ! ./benchmark_app -niter 1 -nireq 1 -m ${MY_MODEL}.xml\n..."]
4545
cmake_collect-->build_collect
@@ -57,7 +57,7 @@ flowchart LR
5757
To apply conditional compilation, follow the steps below:
5858

5959
1. Perform code usage analysis:
60-
1. Run the CMake tool with the following options: `-DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT`.
60+
1. Run the CMake tool with the following options: `-DENABLE_PROFILING_ITT=FULL -DSELECTIVE_BUILD=COLLECT`.
6161
2. Select several models to be used in a specific application or target device.
6262
3. Use the `sea_itt_lib` target to build the ITT collector.
6363
4. Run the target application under the ITT collector for code usage analysis for each model. Statistics are generated in the `.csv` format.

src/common/conditional_compilation/docs/develop_cc_for_new_component.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ In the `SELECTIVE_BUILD=COLLECT` stage, or if it was not called, in the `SELECTI
154154
```
155155
cmake \
156156
-DCMAKE_BUILD_TYPE=Release \
157-
-DENABLE_PROFILING_ITT=ON \
157+
-DENABLE_PROFILING_ITT=FULL \
158158
-DSELECTIVE_BUILD=COLLECT \
159159
-B build \
160160
-S .

0 commit comments

Comments
 (0)