pytorch/torch/csrc/itt_wrapper.cpp
PyTorch MergeBot 32ce06a5ab Revert "[Reland] fix missing-prototypes warnings in torch_cpu (Part 4) (#101949)"
This reverts commit 4f2c007a1b.

Reverted https://github.com/pytorch/pytorch/pull/101949 on behalf of https://github.com/osalpekar due to As noted in @izaitsevfb's comment, we are still seeing linker errors, this time due to `nnc_prepacked_linear_clamp_run` being made a static function. ([comment](https://github.com/pytorch/pytorch/pull/101949#issuecomment-1560226880))
2023-05-23 22:53:47 +00:00

29 lines
789 B
C++

#include <c10/macros/Export.h>
#include <ittnotify.h>
#include <torch/csrc/profiler/stubs/base.h>
namespace torch {
namespace profiler {
__itt_domain* _itt_domain = __itt_domain_create("PyTorch");
TORCH_API bool itt_is_available() {
return torch::profiler::impl::ittStubs()->enabled();
}
TORCH_API void itt_range_push(const char* msg) {
__itt_string_handle* hsMsg = __itt_string_handle_create(msg);
__itt_task_begin(_itt_domain, __itt_null, __itt_null, hsMsg);
}
TORCH_API void itt_range_pop() {
__itt_task_end(_itt_domain);
}
TORCH_API void itt_mark(const char* msg) {
__itt_string_handle* hsMsg = __itt_string_handle_create(msg);
__itt_task_begin(_itt_domain, __itt_null, __itt_null, hsMsg);
__itt_task_end(_itt_domain);
}
} // namespace profiler
} // namespace torch