File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed
Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -458,6 +458,7 @@ nanobind_pywrap_extension(
458458 "//xla/backends/profiler:profiler_backends" ,
459459 "//xla/backends/profiler/cpu:python_tracer" ,
460460 "//xla/backends/profiler/plugin:plugin_tracer" ,
461+ "//xla/backends/profiler/subprocess:subprocess_registry" ,
461462 "//xla/backends/profiler/util:metadata_registry" ,
462463 "//xla/pjrt:exceptions" ,
463464 "//xla/pjrt:status_casters" ,
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ class ProfilerServer:
2424
2525def start_server (port : int ) -> ProfilerServer : ...
2626def register_plugin_profiler (arg : CapsuleType , / ) -> None : ...
27+ def register_subprocess (pid : int , port : int ) -> bool : ...
28+ def unregister_subprocess (pid : int ) -> bool : ...
2729
2830class ProfilerSession :
2931 @overload
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ limitations under the License.
2828#include " nanobind/stl/string_view.h" // IWYU pragma: keep
2929#include " nanobind/stl/unique_ptr.h" // IWYU pragma: keep
3030#include " nanobind/stl/vector.h" // IWYU pragma: keep
31+ #include " xla/backends/profiler/subprocess/subprocess_registry.h"
3132#include " xla/backends/profiler/util/metadata_registry.h"
3233#include " xla/pjrt/c/pjrt_c_api.h"
3334#include " xla/pjrt/exceptions.h"
@@ -176,6 +177,18 @@ NB_MODULE(_profiler, m) {
176177 " ) -> None"
177178 // clang-format on
178179 ));
180+ m.def (
181+ " register_subprocess" ,
182+ [](int pid, int port) -> bool {
183+ return xla::profiler::subprocess::RegisterSubprocess (pid, port).ok ();
184+ },
185+ nb::arg (" pid" ), nb::arg (" port" ));
186+ m.def (
187+ " unregister_subprocess" ,
188+ [](int pid) -> bool {
189+ return xla::profiler::subprocess::UnregisterSubprocess (pid).ok ();
190+ },
191+ nb::arg (" pid" ));
179192
180193 nb::class_<ProfilerSessionWrapper> profiler_session_class (m,
181194 " ProfilerSession" );
You can’t perform that action at this time.
0 commit comments