• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include <armnn/backends/IBackendInternal.hpp>
9 #include <armnn/backends/IMemoryManager.hpp>
10 #include <armnn/utility/PolymorphicDowncast.hpp>
11 #include <backendsCommon/test/WorkloadFactoryHelper.hpp>
12 
13 #include <neon/NeonBackend.hpp>
14 #include <neon/NeonWorkloadFactory.hpp>
15 #include "neon/NeonTensorHandleFactory.hpp"
16 
17 namespace
18 {
19 
20 template<>
21 struct WorkloadFactoryHelper<armnn::NeonWorkloadFactory>
22 {
GetMemoryManager__anona40bf4f10111::WorkloadFactoryHelper23     static armnn::IBackendInternal::IMemoryManagerSharedPtr GetMemoryManager()
24     {
25         armnn::NeonBackend backend;
26         return backend.CreateMemoryManager();
27     }
28 
GetFactory__anona40bf4f10111::WorkloadFactoryHelper29     static armnn::NeonWorkloadFactory GetFactory(
30         const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
31         const armnn::ModelOptions& modelOptions = {})
32     {
33         armnn::NeonBackend backend;
34         return armnn::NeonWorkloadFactory(armnn::PolymorphicPointerDowncast<armnn::NeonMemoryManager>(memoryManager),
35                                           backend.CreateBackendSpecificModelContext(modelOptions));
36     }
37 
GetTensorHandleFactory__anona40bf4f10111::WorkloadFactoryHelper38     static armnn::NeonTensorHandleFactory GetTensorHandleFactory(
39             const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager = nullptr)
40     {
41 
42         return armnn::NeonTensorHandleFactory(
43             armnn::PolymorphicPointerDowncast<armnn::NeonMemoryManager>(memoryManager));
44     }
45 };
46 
47 using NeonWorkloadFactoryHelper = WorkloadFactoryHelper<armnn::NeonWorkloadFactory>;
48 
49 } // anonymous namespace
50