Files
pytorch/cmake/Modules/FindITT.cmake
Jing Xu 3c7044728b Enable Intel® VTune™ Profiler's Instrumentation and Tracing Technology APIs (ITT) to PyTorch (#63289)
More detailed description of benefits can be found at #41001. This is Intel's counterpart of NVidia’s NVTX (https://pytorch.org/docs/stable/autograd.html#torch.autograd.profiler.emit_nvtx).

ITT is a functionality for labeling trace data during application execution across different Intel tools.
For integrating Intel(R) VTune Profiler into Kineto, ITT needs to be integrated into PyTorch first. It works with both standalone VTune Profiler [(https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler.html](https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler.html)) and Kineto-integrated VTune functionality in the future.
It works for both Intel CPU and Intel XPU devices.

Pitch
Add VTune Profiler's ITT API function calls to annotate PyTorch ops, as well as developer customized code scopes on CPU, like NVTX for NVidia GPU.

This PR rebases the code changes at https://github.com/pytorch/pytorch/pull/61335 to the latest master branch.

Usage example:
```
with torch.autograd.profiler.emit_itt():
    for i in range(10):
        torch.itt.range_push('step_{}'.format(i))
        model(input)
        torch.itt.range_pop()
```

cc @ilia-cher @robieta @chaekit @gdankel @bitfort @ngimel @orionr @nbcsm @guotuofeng @guyang3532 @gaoteng-git
Pull Request resolved: https://github.com/pytorch/pytorch/pull/63289
Approved by: https://github.com/malfet
2022-07-13 13:50:15 +00:00

22 lines
613 B
CMake

# - Try to find ITT
#
# The following are set after configuration is done:
# ITT_FOUND : set to true if ITT is found.
# ITT_INCLUDE_DIR : path to ITT include dir.
# ITT_LIBRARIES : list of libraries for ITT
IF (NOT ITT_FOUND)
SET(ITT_FOUND OFF)
SET(ITT_INCLUDE_DIR)
SET(ITT_LIBRARIES)
SET(ITT_ROOT "${PROJECT_SOURCE_DIR}/third_party/ittapi")
FIND_PATH(ITT_INCLUDE_DIR ittnotify.h PATHS ${ITT_ROOT} PATH_SUFFIXES include)
IF (ITT_INCLUDE_DIR)
ADD_SUBDIRECTORY(${ITT_ROOT})
SET(ITT_LIBRARIES ittnotify)
SET(ITT_FOUND ON)
ENDIF (ITT_INCLUDE_DIR)
ENDIF(NOT ITT_FOUND)