mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Enables clang-tidy rule [`misc-use-internal-linkage`](https://clang.llvm.org/extra/clang-tidy/checks/misc/use-internal-linkage.html). This new check was introduced in Clang-Tidy 18 and is available due to recent update of Clang-Tidy 19. The check marks functions and variables used only in the translation unit as static. Therefore undesired symbols are not leaked into other units, more link time optimisations are possible and the resulting binaries may be smaller. The detected violations were mostly fixed by using static. In other cases, the symbols were indeed consumed by others files, then their declaring headers were included. Still some declarations were wrong and have been fixed. Pull Request resolved: https://github.com/pytorch/pytorch/pull/148948 Approved by: https://github.com/Skylion007
27 lines
736 B
C++
27 lines
736 B
C++
#include <ittnotify.h>
|
|
#include <torch/csrc/itt_wrapper.h>
|
|
#include <torch/csrc/profiler/stubs/base.h>
|
|
|
|
namespace torch::profiler {
|
|
static __itt_domain* _itt_domain = __itt_domain_create("PyTorch");
|
|
|
|
bool itt_is_available() {
|
|
return torch::profiler::impl::ittStubs()->enabled();
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
void itt_range_pop() {
|
|
__itt_task_end(_itt_domain);
|
|
}
|
|
|
|
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 torch::profiler
|