Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extension/pybindings/portable_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
_load_program, # noqa: F401
_load_program_from_buffer, # noqa: F401
_reset_profile_results, # noqa: F401
_threadpool_get_thread_count, # noqa: F401
_unsafe_reset_threadpool, # noqa: F401
BundledModule, # noqa: F401
ExecuTorchMethod, # noqa: F401
Expand Down
7 changes: 7 additions & 0 deletions extension/pybindings/pybindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,13 @@ PYBIND11_MODULE(EXECUTORCH_PYTHON_MODULE_NAME, m) {
},
py::arg("num_threads"),
call_guard);
m.def(
"_threadpool_get_thread_count",
[]() {
return ::executorch::extension::threadpool::get_threadpool()
->get_thread_count();
},
call_guard);

py::class_<PyModule>(m, "ExecuTorchModule")
.def(
Expand Down
9 changes: 9 additions & 0 deletions extension/pybindings/pybindings.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,12 @@ def _unsafe_reset_threadpool(num_threads: int) -> None:
This API is experimental and subject to change without notice.
"""
...

@experimental("This API is experimental and subject to change without notice.")
def _threadpool_get_thread_count() -> int:
"""
.. warning::

This API is experimental and subject to change without notice.
"""
...
Loading