|
28 | 28 | #include <executorch/runtime/executor/method.h> |
29 | 29 | #include <executorch/runtime/executor/program.h> |
30 | 30 | #include <executorch/runtime/kernel/operator_registry.h> |
| 31 | +#include <executorch/runtime/backend/interface.h> |
31 | 32 | #include <executorch/runtime/platform/assert.h> |
32 | 33 | #include <executorch/runtime/platform/platform.h> |
33 | 34 | #include <executorch/runtime/platform/profiler.h> |
@@ -87,10 +88,12 @@ using ::executorch::extension::BufferDataLoader; |
87 | 88 | using ::executorch::extension::MallocMemoryAllocator; |
88 | 89 | using ::executorch::extension::MmapDataLoader; |
89 | 90 | using ::executorch::runtime::ArrayRef; |
| 91 | +using ::executorch::runtime::Backend; |
90 | 92 | using ::executorch::runtime::DataLoader; |
91 | 93 | using ::executorch::runtime::Error; |
92 | 94 | using ::executorch::runtime::EValue; |
93 | 95 | using ::executorch::runtime::EventTracerDebugLogLevel; |
| 96 | +using ::executorch::runtime::get_registered_backends; |
94 | 97 | using ::executorch::runtime::get_registered_kernels; |
95 | 98 | using ::executorch::runtime::HierarchicalAllocator; |
96 | 99 | using ::executorch::runtime::Kernel; |
@@ -975,6 +978,17 @@ py::list get_operator_names() { |
975 | 978 | return res; |
976 | 979 | } |
977 | 980 |
|
| 981 | +py::list get_backend_names() { |
| 982 | + Span<const Backend> backends = get_registered_backends(); |
| 983 | + py::list res; |
| 984 | + for (const Backend& backend : backends) { |
| 985 | + if (backend.name != nullptr) { |
| 986 | + res.append(py::cast(backend.name)); |
| 987 | + } |
| 988 | + } |
| 989 | + return res; |
| 990 | +} |
| 991 | + |
978 | 992 | } // namespace |
979 | 993 |
|
980 | 994 | PYBIND11_MODULE(EXECUTORCH_PYTHON_MODULE_NAME, m) { |
@@ -1029,6 +1043,7 @@ PYBIND11_MODULE(EXECUTORCH_PYTHON_MODULE_NAME, m) { |
1029 | 1043 | }, |
1030 | 1044 | call_guard); |
1031 | 1045 | m.def("_get_operator_names", &get_operator_names); |
| 1046 | + m.def("_get_backend_names", &get_backend_names); |
1032 | 1047 | m.def("_create_profile_block", &create_profile_block, call_guard); |
1033 | 1048 | m.def( |
1034 | 1049 | "_reset_profile_results", |
|
0 commit comments