Skip to content
Permalink
Browse files

List all registered backends in case particular backend is not found (#…

…3088)

Summary:
Print all backends, improve debuggability in case particular backend is missing.

Documentation:
n/a
Pull Request resolved: #3088

Differential Revision: D15781780

Pulled By: rdzhabarov

fbshipit-source-id: 5edb63be413dfd934effafcda18f54b7aa41b9df
  • Loading branch information...
rdzhabarov authored and facebook-github-bot committed Jun 12, 2019
1 parent 4ad57d7 commit b2844bb3c905af9879a1fe0151eb57793a7b592a
Showing with 9 additions and 1 deletion.
  1. +1 −1 include/glow/Support/Register.h
  2. +8 −0 lib/Backends/Backends.cpp
@@ -62,7 +62,7 @@ template <class Key, class Base> class FactoryRegistry {
return it->second->create();
}

private:
/// \returns all registered factories.
static FactoryMap &factories() {
static FactoryMap *factories = new FactoryMap();
return *factories;
@@ -25,6 +25,14 @@ Backend *createBackend(BackendKind backendKind) {

Backend *createBackend(llvm::StringRef backendName) {
auto *backend = FactoryRegistry<std::string, Backend>::get(backendName);

if (backend == nullptr) {
LOG(INFO) << "List of all registered backends:";
for (const auto &factory :
FactoryRegistry<std::string, Backend>::factories()) {
LOG(INFO) << factory.first;
}
}
CHECK(backend) << strFormat("Cannot find registered backend: %s",
backendName.data());
return backend;

0 comments on commit b2844bb

Please sign in to comment.
You can’t perform that action at this time.