Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit89c144a

Browse files
committed
clean up if def in global_kineto_init
1 parentf885874 commit89c144a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

‎torch/csrc/profiler/kineto_client_interface.cpp‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
// Ondemand tracing is not supported on Apple or edge platform
1111
#if defined(__APPLE__) || defined(EDGE_PROFILER_USE_KINETO)
12-
#defineENABLE_GLOBAL_OBSERVER (0)
12+
constexprboolkEnableGlobalObserver =false;
1313
#else
14-
#defineENABLE_GLOBAL_OBSERVER (1)
14+
constexprboolkEnableGlobalObserver =true;
1515
#endif
1616

1717
namespacetorch {
@@ -90,28 +90,28 @@ class LibKinetoClient : public libkineto::ClientInterface {
9090
}// namespace profiler::impl
9191

9292
voidglobal_kineto_init() {
93-
#if ENABLE_GLOBAL_OBSERVER
94-
if (c10::utils::get_env("KINETO_USE_DAEMON").has_value()) {
95-
libkineto_init(
96-
/*cpuOnly=*/!(at::hasCUDA() ||at::hasXPU() ||at::hasMTIA()),
97-
/*logOnError=*/true);
98-
libkineto::api().suppressLogMessages();
93+
ifconstexpr (kEnableGlobalObserver) {
94+
if (c10::utils::get_env("KINETO_USE_DAEMON").has_value()) {
95+
libkineto_init(
96+
/*cpuOnly=*/!(at::hasCUDA() ||at::hasXPU() ||at::hasMTIA()),
97+
/*logOnError=*/true);
98+
libkineto::api().suppressLogMessages();
99+
}
99100
}
100-
#endif
101101
}
102102

103-
#if ENABLE_GLOBAL_OBSERVER
104103
namespace {
105104

106105
structRegisterLibKinetoClient {
107106
RegisterLibKinetoClient() {
108-
static profiler::impl::LibKinetoClient client;
109-
libkineto::api().registerClient(&client);
107+
ifconstexpr (kEnableGlobalObserver) {
108+
static profiler::impl::LibKinetoClient client;
109+
libkineto::api().registerClient(&client);
110+
}
110111
}
111112
} register_libkineto_client;
112113

113114
}// namespace
114-
#endif
115115

116116
}// namespace torch
117117
#endif// USE_KINETO

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp