ArmNN
 21.11
NeonRuntimeTests.cpp File Reference
#include <test/RuntimeTests.hpp>
#include <LeakChecking.hpp>
#include <backendsCommon/test/RuntimeTestImpl.hpp>
#include <test/ProfilingTestUtils.hpp>
#include <doctest/doctest.h>

Go to the source code of this file.

Functions

 TEST_SUITE ("NeonRuntime")
 

Function Documentation

◆ TEST_SUITE()

TEST_SUITE ( "NeonRuntime"  )

Definition at line 15 of file NeonRuntimeTests.cpp.

References ARMNN_BYTES_LEAKED_IN_SCOPE, ARMNN_LEAK_CHECKER_IS_ACTIVE, ARMNN_NO_LEAKS_IN_SCOPE, ARMNN_OBJECTS_LEAKED_IN_SCOPE, ARMNN_SCOPED_LEAK_CHECKER, IOutputSlot::Connect(), armnn::CpuAcc, INetwork::Create(), IRuntime::Create(), armnn::Float32, IConnectableLayer::GetInputSlot(), IConnectableLayer::GetOutputSlot(), armnn::Optimize(), armnn::RuntimeLoadedNetworksReserve(), IOutputSlot::SetTensorInfo(), armnn::Success, and VerifyPostOptimisationStructureTestImpl().

16 {
17 TEST_CASE("RuntimeValidateCpuAccDeviceSupportLayerNoFallback")
18 {
19  // build up the structure of the network
21 
22  armnn::IConnectableLayer* input = net->AddInputLayer(0);
23  armnn::IConnectableLayer* output = net->AddOutputLayer(0);
24 
25  input->GetOutputSlot(0).Connect(output->GetInputSlot(0));
27 
30 
31  std::vector<armnn::BackendId> backends = { armnn::Compute::CpuAcc };
32  armnn::IOptimizedNetworkPtr optNet = armnn::Optimize(*net, backends, runtime->GetDeviceSpec());
33  CHECK(optNet);
34 
35  // Load it into the runtime. It should success.
36  armnn::NetworkId netId;
37  CHECK(runtime->LoadNetwork(netId, std::move(optNet)) == armnn::Status::Success);
38 }
39 
40 #ifdef ARMNN_LEAK_CHECKING_ENABLED
41 TEST_CASE("RuntimeMemoryLeaksCpuAcc")
42 {
45  armnn::RuntimeImpl runtime(options);
47 
48  std::vector<armnn::BackendId> backends = {armnn::Compute::CpuAcc};
49  {
50  // Do a warmup of this so we make sure that all one-time
51  // initialization happens before we do the leak checking.
52  CreateAndDropDummyNetwork(backends, runtime);
53  }
54 
55  {
56  ARMNN_SCOPED_LEAK_CHECKER("LoadAndUnloadNetworkCpuAcc");
57  CHECK(ARMNN_NO_LEAKS_IN_SCOPE());
58  // In the second run we check for all remaining memory
59  // in use after the network was unloaded. If there is any
60  // then it will be treated as a memory leak.
61  CreateAndDropDummyNetwork(backends, runtime);
62  CHECK(ARMNN_NO_LEAKS_IN_SCOPE());
63  CHECK(ARMNN_BYTES_LEAKED_IN_SCOPE() == 0);
64  CHECK(ARMNN_OBJECTS_LEAKED_IN_SCOPE() == 0);
65  }
66 }
67 #endif
68 
69 TEST_CASE("ProfilingPostOptimisationStructureCpuAcc")
70 {
72 }
73 
74 }
#define ARMNN_SCOPED_LEAK_CHECKER(TAG)
static IRuntimePtr Create(const CreationOptions &options)
Definition: Runtime.cpp:40
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:61
void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId)
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:31
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
#define ARMNN_LEAK_CHECKER_IS_ACTIVE()
#define ARMNN_OBJECTS_LEAKED_IN_SCOPE()
void RuntimeLoadedNetworksReserve(armnn::RuntimeImpl *runtime)
IOptimizedNetworkPtr Optimize(const INetwork &network, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptions &options=OptimizerOptions(), Optional< std::vector< std::string > &> messages=EmptyOptional())
Create an optimized version of the network.
Definition: Network.cpp:1605
int NetworkId
Definition: IRuntime.hpp:25
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:198
CPU Execution: NEON: ArmCompute.
#define ARMNN_NO_LEAKS_IN_SCOPE()
virtual const IInputSlot & GetInputSlot(unsigned int index) const =0
Get a const input slot handle by slot index.
virtual const IOutputSlot & GetOutputSlot(unsigned int index) const =0
Get the const output slot handle by slot index.
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:197
virtual int Connect(IInputSlot &destination)=0
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:478
#define ARMNN_BYTES_LEAKED_IN_SCOPE()