blob: 9afb42d59fee85bfdf0db2a20f9a21d12a29e802 [file] [log] [blame]
arovir014424b0a2018-10-04 10:46:04 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include "RefBackend.hpp"
David Beck3e9e1152018-10-17 14:17:50 +01007#include "RefBackendId.hpp"
arovir01a0944792018-10-11 15:00:58 +01008#include "RefWorkloadFactory.hpp"
9
David Beck6b779f02018-10-09 17:20:21 +010010#include <backends/BackendRegistry.hpp>
arovir01a0944792018-10-11 15:00:58 +010011
David Beck6b779f02018-10-09 17:20:21 +010012#include <boost/cast.hpp>
arovir014424b0a2018-10-04 10:46:04 +010013
14namespace armnn
15{
16
David Beck6b779f02018-10-09 17:20:21 +010017namespace
18{
David Beck6b779f02018-10-09 17:20:21 +010019
David Beck3e9e1152018-10-17 14:17:50 +010020static StaticRegistryInitializer<BackendRegistry> g_RegisterHelper
21{
22 BackendRegistryInstance(),
David Beck3cc9a622018-10-12 10:38:31 +010023 RefBackend::GetIdStatic(),
David Beck6b779f02018-10-09 17:20:21 +010024 []()
25 {
26 return IBackendUniquePtr(new RefBackend, &RefBackend::Destroy);
27 }
28};
29
30}
arovir014424b0a2018-10-04 10:46:04 +010031
David Beck3cc9a622018-10-12 10:38:31 +010032const BackendId& RefBackend::GetIdStatic()
arovir014424b0a2018-10-04 10:46:04 +010033{
David Beck3e9e1152018-10-17 14:17:50 +010034 static const BackendId s_Id{RefBackendId()};
arovir014424b0a2018-10-04 10:46:04 +010035 return s_Id;
36}
37
arovir014424b0a2018-10-04 10:46:04 +010038std::unique_ptr<IWorkloadFactory> RefBackend::CreateWorkloadFactory() const
39{
arovir01a0944792018-10-11 15:00:58 +010040 return std::make_unique<RefWorkloadFactory>();
arovir014424b0a2018-10-04 10:46:04 +010041}
42
David Beck6b779f02018-10-09 17:20:21 +010043void RefBackend::Destroy(IBackend* backend)
44{
45 delete boost::polymorphic_downcast<RefBackend*>(backend);
46}
47
arovir014424b0a2018-10-04 10:46:04 +010048} // namespace armnn