ArmNN
 20.08
RuntimeTests.cpp File Reference
#include <armnn/Descriptors.hpp>
#include <armnn/IRuntime.hpp>
#include <armnn/INetwork.hpp>
#include <Processes.hpp>
#include <Runtime.hpp>
#include <armnn/TypesUtils.hpp>
#include <LabelsAndEventClasses.hpp>
#include <test/ProfilingTestUtils.hpp>
#include <HeapProfiling.hpp>
#include <LeakChecking.hpp>
#include <boost/test/unit_test.hpp>
#include "RuntimeTests.hpp"
#include "TestUtils.hpp"

Go to the source code of this file.

Namespaces

 armnn
 Copyright (c) 2020 ARM Limited.
 

Functions

void RuntimeLoadedNetworksReserve (armnn::Runtime *runtime)
 
 BOOST_AUTO_TEST_CASE (RuntimeUnloadNetwork)
 
 BOOST_AUTO_TEST_CASE (RuntimeCpuRef)
 
 BOOST_AUTO_TEST_CASE (RuntimeFallbackToCpuRef)
 
 BOOST_AUTO_TEST_CASE (IVGCVSW_1929_QuantizedSoftmaxIssue)
 
 BOOST_AUTO_TEST_CASE (RuntimeBackendOptions)
 
 BOOST_AUTO_TEST_CASE (ProfilingDisable)
 
 BOOST_AUTO_TEST_CASE (ProfilingEnableCpuRef)
 
 BOOST_AUTO_TEST_CASE (ProfilingPostOptimisationStructureCpuRef)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/8]

BOOST_AUTO_TEST_CASE ( RuntimeUnloadNetwork  )

Definition at line 39 of file RuntimeTests.cpp.

References ARMNN_BYTES_LEAKED_IN_SCOPE, ARMNN_LEAK_CHECKER_IS_ACTIVE, ARMNN_LOCAL_LEAK_CHECKING_ONLY, ARMNN_NO_LEAKS_IN_SCOPE, ARMNN_OBJECTS_LEAKED_IN_SCOPE, ARMNN_SCOPED_LEAK_CHECKER, armnn::BOOST_AUTO_TEST_CASE(), BOOST_GLOBAL_FIXTURE(), armnn::CpuRef, INetwork::Create(), IRuntime::Create(), armnn::Failure, Runtime::GetDeviceSpec(), armnn::IgnoreUnused(), Runtime::LoadNetwork(), armnn::Optimize(), armnn::RuntimeLoadedNetworksReserve(), armnn::Success, and Runtime::UnloadNetwork().

40 {
41  // build 2 mock-networks and load them into the runtime
44 
45  // Mock network 1.
46  armnn::NetworkId networkIdentifier1 = 1;
48  mockNetwork1->AddInputLayer(0, "test layer");
49  std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
50  runtime->LoadNetwork(networkIdentifier1, Optimize(*mockNetwork1, backends, runtime->GetDeviceSpec()));
51 
52  // Mock network 2.
53  armnn::NetworkId networkIdentifier2 = 2;
55  mockNetwork2->AddInputLayer(0, "test layer");
56  runtime->LoadNetwork(networkIdentifier2, Optimize(*mockNetwork2, backends, runtime->GetDeviceSpec()));
57 
58  // Unloads one by its networkID.
59  BOOST_TEST(runtime->UnloadNetwork(networkIdentifier1) == armnn::Status::Success);
60 
61  BOOST_TEST(runtime->UnloadNetwork(networkIdentifier1) == armnn::Status::Failure);
62 }
static IRuntimePtr Create(const CreationOptions &options)
Definition: Runtime.cpp:32
CPU Execution: Reference C++ kernels.
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:25
int NetworkId
Definition: IRuntime.hpp:20
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:1014
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:101
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:50

◆ BOOST_AUTO_TEST_CASE() [2/8]

BOOST_AUTO_TEST_CASE ( RuntimeCpuRef  )

Definition at line 168 of file RuntimeTests.cpp.

References IOutputSlot::Connect(), armnn::CpuRef, INetwork::Create(), IRuntime::Create(), armnn::Float32, IConnectableLayer::GetInputSlot(), IConnectableLayer::GetOutputSlot(), armnn::Optimize(), IOutputSlot::SetTensorInfo(), and armnn::Success.

169 {
170  using namespace armnn;
171 
172  // Create runtime in which test will run
175 
176  // build up the structure of the network
178 
179  IConnectableLayer* input = net->AddInputLayer(0);
180 
181  // This layer configuration isn't supported by CpuAcc, should be fall back to CpuRef.
182  NormalizationDescriptor descriptor;
183  IConnectableLayer* normalize = net->AddNormalizationLayer(descriptor);
184 
185  IConnectableLayer* output = net->AddOutputLayer(0);
186 
187  input->GetOutputSlot(0).Connect(normalize->GetInputSlot(0));
188  normalize->GetOutputSlot(0).Connect(output->GetInputSlot(0));
189 
190  input->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
191  normalize->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
192 
193  // optimize the network
194  std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
195  IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec());
196 
197  // Load it into the runtime. It should success.
198  armnn::NetworkId netId;
199  BOOST_TEST(runtime->LoadNetwork(netId, std::move(optNet)) == Status::Success);
200 }
static IRuntimePtr Create(const CreationOptions &options)
Definition: Runtime.cpp:32
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:61
CPU Execution: Reference C++ kernels.
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:25
int NetworkId
Definition: IRuntime.hpp:20
Copyright (c) 2020 ARM Limited.
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
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:1014
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:593
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:101
virtual int Connect(IInputSlot &destination)=0
A NormalizationDescriptor for the NormalizationLayer.
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:50

◆ BOOST_AUTO_TEST_CASE() [3/8]

BOOST_AUTO_TEST_CASE ( RuntimeFallbackToCpuRef  )

Definition at line 202 of file RuntimeTests.cpp.

References IOutputSlot::Connect(), armnn::CpuAcc, armnn::CpuRef, INetwork::Create(), IRuntime::Create(), armnn::Float32, IConnectableLayer::GetInputSlot(), IConnectableLayer::GetOutputSlot(), armnn::Optimize(), IOutputSlot::SetTensorInfo(), and armnn::Success.

203 {
204  using namespace armnn;
205 
206  // Create runtime in which test will run
209 
210  // build up the structure of the network
212 
213  IConnectableLayer* input = net->AddInputLayer(0);
214 
215  // This layer configuration isn't supported by CpuAcc, should be fall back to CpuRef.
216  NormalizationDescriptor descriptor;
217  IConnectableLayer* normalize = net->AddNormalizationLayer(descriptor);
218 
219  IConnectableLayer* output = net->AddOutputLayer(0);
220 
221  input->GetOutputSlot(0).Connect(normalize->GetInputSlot(0));
222  normalize->GetOutputSlot(0).Connect(output->GetInputSlot(0));
223 
224  input->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
225  normalize->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
226 
227  // Allow fallback to CpuRef.
228  std::vector<armnn::BackendId> backends = { armnn::Compute::CpuAcc, armnn::Compute::CpuRef };
229  // optimize the network
230  IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec());
231 
232  // Load it into the runtime. It should succeed.
233  armnn::NetworkId netId;
234  BOOST_TEST(runtime->LoadNetwork(netId, std::move(optNet)) == Status::Success);
235 }
static IRuntimePtr Create(const CreationOptions &options)
Definition: Runtime.cpp:32
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:61
CPU Execution: Reference C++ kernels.
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:25
int NetworkId
Definition: IRuntime.hpp:20
Copyright (c) 2020 ARM Limited.
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
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:1014
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:593
CPU Execution: NEON: ArmCompute.
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:101
virtual int Connect(IInputSlot &destination)=0
A NormalizationDescriptor for the NormalizationLayer.
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:50

◆ BOOST_AUTO_TEST_CASE() [4/8]

BOOST_AUTO_TEST_CASE ( IVGCVSW_1929_QuantizedSoftmaxIssue  )

Definition at line 237 of file RuntimeTests.cpp.

References IOutputSlot::Connect(), armnn::CpuRef, INetwork::Create(), IRuntime::Create(), IConnectableLayer::GetInputSlot(), IConnectableLayer::GetOutputSlot(), armnn::Optimize(), armnn::QAsymmU8, and IOutputSlot::SetTensorInfo().

238 {
239  // Test for issue reported by Chris Nix in https://jira.arm.com/browse/IVGCVSW-1929
240  using namespace armnn;
241 
242  // Create runtime in which test will run
245 
246  // build up the structure of the network
248  armnn::IConnectableLayer* input = net->AddInputLayer(0,"input");
249  armnn::IConnectableLayer* softmax = net->AddSoftmaxLayer(armnn::SoftmaxDescriptor(), "softmax");
250  armnn::IConnectableLayer* output = net->AddOutputLayer(0, "output");
251 
252  input->GetOutputSlot(0).Connect(softmax->GetInputSlot(0));
253  softmax->GetOutputSlot(0).Connect(output->GetInputSlot(0));
254 
257  1.0f / 255,
258  0));
259 
262 
263  std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
264  std::vector<std::string> errMessages;
266  backends,
267  runtime->GetDeviceSpec(),
269  errMessages);
270 
271  BOOST_TEST(errMessages.size() == 1);
272  BOOST_TEST(errMessages[0] ==
273  "ERROR: output 0 of layer Softmax (softmax) is of type "
274  "Quantized 8 bit but its scale parameter has not been set");
275  BOOST_TEST(!optNet);
276 }
static IRuntimePtr Create(const CreationOptions &options)
Definition: Runtime.cpp:32
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:61
CPU Execution: Reference C++ kernels.
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:25
Copyright (c) 2020 ARM Limited.
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
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:1014
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:593
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:101
virtual int Connect(IInputSlot &destination)=0
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:50
A SoftmaxDescriptor for the SoftmaxLayer.

◆ BOOST_AUTO_TEST_CASE() [5/8]

BOOST_AUTO_TEST_CASE ( RuntimeBackendOptions  )

Definition at line 278 of file RuntimeTests.cpp.

References BackendOptions::AddOption(), GetBackendId(), and IRuntime::CreationOptions::m_BackendOptions.

279 {
280  using namespace armnn;
281 
282  IRuntime::CreationOptions creationOptions;
283  auto& backendOptions = creationOptions.m_BackendOptions;
284 
285 
286  // Define Options on explicit construction
287  BackendOptions options1("FakeBackend1",
288  {
289  { "Option1", 1.3f },
290  { "Option2", true }
291  });
292 
293  // Add an option after construction
294  options1.AddOption({ "Option3", "some_value" });
295 
296  // Add the options to CreationOptions struct
297  backendOptions.push_back(options1);
298 
299  // Add more Options via inplace explicit construction
300  backendOptions.emplace_back(BackendOptions{ "FakeBackend1",
301  {{ "Option4", 42 }}
302  });
303 
304 
305  // First group
306  BOOST_TEST(backendOptions[0].GetBackendId().Get() == "FakeBackend1");
307  BOOST_TEST(backendOptions[0].GetOption(0).GetName() == "Option1");
308  BOOST_TEST(backendOptions[0].GetOption(0).GetValue().IsFloat() == true);
309  BOOST_TEST(backendOptions[0].GetOption(0).GetValue().AsFloat() == 1.3f);
310 
311  BOOST_TEST(backendOptions[0].GetOption(1).GetName() == "Option2");
312  BOOST_TEST(backendOptions[0].GetOption(1).GetValue().IsBool() == true);
313  BOOST_TEST(backendOptions[0].GetOption(1).GetValue().AsBool() == true);
314 
315  BOOST_TEST(backendOptions[0].GetOption(2).GetName() == "Option3");
316  BOOST_TEST(backendOptions[0].GetOption(2).GetValue().IsString() == true);
317  BOOST_TEST(backendOptions[0].GetOption(2).GetValue().AsString() == "some_value");
318 
319  // Second group
320  BOOST_TEST(backendOptions[1].GetBackendId().Get() == "FakeBackend1");
321  BOOST_TEST(backendOptions[1].GetOption(0).GetName() == "Option4");
322  BOOST_TEST(backendOptions[1].GetOption(0).GetValue().IsInt() == true);
323  BOOST_TEST(backendOptions[1].GetOption(0).GetValue().AsInt() == 42);
324 }
Copyright (c) 2020 ARM Limited.
std::vector< BackendOptions > m_BackendOptions
Pass backend specific options.
Definition: IRuntime.hpp:115
const char * GetBackendId()
void AddOption(BackendOption &&option)
Struct for the users to pass backend specific options.

◆ BOOST_AUTO_TEST_CASE() [6/8]

BOOST_AUTO_TEST_CASE ( ProfilingDisable  )

Definition at line 326 of file RuntimeTests.cpp.

References IOutputSlot::Connect(), armnn::CpuRef, INetwork::Create(), armnn::Float32, Runtime::GetDeviceSpec(), IConnectableLayer::GetInputSlot(), IConnectableLayer::GetOutputSlot(), armnn::GetProfilingService(), BufferManager::GetReadableBuffer(), Runtime::LoadNetwork(), armnn::Optimize(), IOutputSlot::SetTensorInfo(), and armnn::Success.

327 {
328  using namespace armnn;
329 
330  // Create runtime in which the test will run
332  armnn::Runtime runtime(options);
333 
334  // build up the structure of the network
336 
337  IConnectableLayer* input = net->AddInputLayer(0);
338 
339  // This layer configuration isn't supported by CpuAcc, should fall back to CpuRef.
340  NormalizationDescriptor descriptor;
341  IConnectableLayer* normalize = net->AddNormalizationLayer(descriptor);
342 
343  IConnectableLayer* output = net->AddOutputLayer(0);
344 
345  input->GetOutputSlot(0).Connect(normalize->GetInputSlot(0));
346  normalize->GetOutputSlot(0).Connect(output->GetInputSlot(0));
347 
348  input->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
349  normalize->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
350 
351  // optimize the network
352  std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
353  IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime.GetDeviceSpec());
354 
355  // Load it into the runtime. It should succeed.
356  armnn::NetworkId netId;
357  BOOST_TEST(runtime.LoadNetwork(netId, std::move(optNet)) == Status::Success);
358 
359  profiling::ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime));
360  profiling::BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager();
361  auto readableBuffer = bufferManager.GetReadableBuffer();
362 
363  // Profiling is not enabled, the post-optimisation structure should not be created
364  BOOST_TEST(!readableBuffer);
365 }
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:61
CPU Execution: Reference C++ kernels.
int NetworkId
Definition: IRuntime.hpp:20
Copyright (c) 2020 ARM Limited.
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
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:1014
profiling::ProfilingService & GetProfilingService(armnn::Runtime *runtime)
Definition: TestUtils.cpp:25
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:593
IPacketBufferPtr GetReadableBuffer() override
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:101
virtual int Connect(IInputSlot &destination)=0
A NormalizationDescriptor for the NormalizationLayer.
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:50

◆ BOOST_AUTO_TEST_CASE() [7/8]

BOOST_AUTO_TEST_CASE ( ProfilingEnableCpuRef  )

Definition at line 367 of file RuntimeTests.cpp.

References LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, LabelsAndEventClasses::BACKENDID_GUID, LabelsAndEventClasses::CHILD_GUID, IOutputSlot::Connect(), LabelsAndEventClasses::CONNECTION_GUID, armnn::CpuRef, INetwork::Create(), Runtime::EnqueueWorkload(), LabelsAndEventClasses::EXECUTION_OF_GUID, armnn::Float32, ProfilingServiceRuntimeHelper::ForceTransitionToState(), armnnUtils::Processes::GetCurrentId(), Runtime::GetDeviceSpec(), IConnectableLayer::GetGuid(), IConnectableLayer::GetInputSlot(), Runtime::GetInputTensorInfo(), IConnectableLayer::GetOutputSlot(), Runtime::GetOutputTensorInfo(), ProfilingServiceRuntimeHelper::GetProfilingBufferManager(), armnn::GetProfilingService(), BufferManager::GetReadableBuffer(), LabelsAndEventClasses::INFERENCE_GUID, LabelsAndEventClasses::LAYER_GUID, Runtime::LoadNetwork(), IRuntime::CreationOptions::ExternalProfilingOptions::m_EnableProfiling, IRuntime::CreationOptions::m_ProfilingOptions, IRuntime::CreationOptions::ExternalProfilingOptions::m_TimelineEnabled, LabelsAndEventClasses::NAME_GUID, LabelsAndEventClasses::NETWORK_GUID, armnn::Optimize(), LabelsAndEventClasses::PROCESS_ID_GUID, ProfilingService::ResetExternalProfilingOptions(), IOutputSlot::SetTensorInfo(), armnn::Success, armnn::profiling::ThreadIdSize, LabelsAndEventClasses::TYPE_GUID, VerifyTimelineEntityBinaryPacketData(), VerifyTimelineEventBinaryPacket(), VerifyTimelineHeaderBinary(), VerifyTimelineLabelBinaryPacketData(), VerifyTimelineRelationshipBinaryPacketData(), LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, and LabelsAndEventClasses::WORKLOAD_GUID.

368 {
369  using namespace armnn;
370  using namespace armnn::profiling;
371 
372  // Create runtime in which the test will run
374  options.m_ProfilingOptions.m_EnableProfiling = true;
375  options.m_ProfilingOptions.m_TimelineEnabled = true;
376 
377  armnn::Runtime runtime(options);
379 
380  profiling::ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime));
381  profilingServiceHelper.ForceTransitionToState(ProfilingState::NotConnected);
382  profilingServiceHelper.ForceTransitionToState(ProfilingState::WaitingForAck);
383  profilingServiceHelper.ForceTransitionToState(ProfilingState::Active);
384 
385  // build up the structure of the network
387 
388  IConnectableLayer* input = net->AddInputLayer(0, "input");
389 
390  NormalizationDescriptor descriptor;
391  IConnectableLayer* normalize = net->AddNormalizationLayer(descriptor, "normalization");
392 
393  IConnectableLayer* output = net->AddOutputLayer(0, "output");
394 
395  input->GetOutputSlot(0).Connect(normalize->GetInputSlot(0));
396  normalize->GetOutputSlot(0).Connect(output->GetInputSlot(0));
397 
398  input->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
399  normalize->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
400 
401  // optimize the network
402  std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
403  IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime.GetDeviceSpec());
404 
405  ProfilingGuid optNetGuid = optNet->GetGuid();
406 
407  // Load it into the runtime. It should succeed.
408  armnn::NetworkId netId;
409  BOOST_TEST(runtime.LoadNetwork(netId, std::move(optNet)) == Status::Success);
410 
411  profiling::BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager();
412  auto readableBuffer = bufferManager.GetReadableBuffer();
413 
414  // Profiling is enabled, the post-optimisation structure should be created
415  BOOST_CHECK(readableBuffer != nullptr);
416 
417  unsigned int size = readableBuffer->GetSize();
418 
419  const unsigned char* readableData = readableBuffer->GetReadableData();
420  BOOST_CHECK(readableData != nullptr);
421 
422  unsigned int offset = 0;
423 
424  // Verify Header
425  VerifyTimelineHeaderBinary(readableData, offset, size - 8);
426  BOOST_TEST_MESSAGE("HEADER OK");
427 
428  // Post-optimisation network
429  // Network entity
430  VerifyTimelineEntityBinaryPacketData(optNetGuid, readableData, offset);
431  BOOST_TEST_MESSAGE("NETWORK ENTITY OK");
432 
433  // Entity - Type relationship
435  EmptyOptional(),
436  optNetGuid,
439  readableData,
440  offset);
441  BOOST_TEST_MESSAGE("NETWORK TYPE RELATIONSHIP OK");
442 
443  // Network - START OF LIFE
445  EmptyOptional(),
446  EmptyOptional(),
447  readableData,
448  offset);
449  BOOST_TEST_MESSAGE("NETWORK START OF LIFE EVENT OK");
450 
451  // Network - START OF LIFE event relationship
453  EmptyOptional(),
454  optNetGuid,
455  networkSolEventGuid,
457  readableData,
458  offset);
459  BOOST_TEST_MESSAGE("NETWORK START OF LIFE RELATIONSHIP OK");
460 
461  // Process ID Label
462  int processID = armnnUtils::Processes::GetCurrentId();
463  std::stringstream ss;
464  ss << processID;
465  std::string processIdLabel = ss.str();
466  VerifyTimelineLabelBinaryPacketData(EmptyOptional(), processIdLabel, readableData, offset);
467  BOOST_TEST_MESSAGE("PROCESS ID LABEL OK");
468 
469  // Entity - Process ID relationship
471  EmptyOptional(),
472  optNetGuid,
473  EmptyOptional(),
475  readableData,
476  offset);
477  BOOST_TEST_MESSAGE("NETWORK PROCESS ID RELATIONSHIP OK");
478 
479  // Input layer
480  // Input layer entity
481  VerifyTimelineEntityBinaryPacketData(input->GetGuid(), readableData, offset);
482  BOOST_TEST_MESSAGE("INPUT ENTITY OK");
483 
484  // Name Entity
485  ProfilingGuid inputLabelGuid = VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "input", readableData, offset);
486  BOOST_TEST_MESSAGE("INPUT NAME LABEL OK");
487 
488  // Entity - Name relationship
490  EmptyOptional(),
491  input->GetGuid(),
492  inputLabelGuid,
494  readableData,
495  offset);
496  BOOST_TEST_MESSAGE("INPUT NAME RELATIONSHIP OK");
497 
498  // Entity - Type relationship
500  EmptyOptional(),
501  input->GetGuid(),
504  readableData,
505  offset);
506  BOOST_TEST_MESSAGE("INPUT TYPE RELATIONSHIP OK");
507 
508  // Network - Input layer relationship
510  EmptyOptional(),
511  optNetGuid,
512  input->GetGuid(),
514  readableData,
515  offset);
516  BOOST_TEST_MESSAGE("NETWORK - INPUT CHILD RELATIONSHIP OK");
517 
518  // Normalization layer
519  // Normalization layer entity
520  VerifyTimelineEntityBinaryPacketData(normalize->GetGuid(), readableData, offset);
521  BOOST_TEST_MESSAGE("NORMALIZATION LAYER ENTITY OK");
522 
523  // Name entity
524  ProfilingGuid normalizationLayerNameGuid = VerifyTimelineLabelBinaryPacketData(
525  EmptyOptional(), "normalization", readableData, offset);
526  BOOST_TEST_MESSAGE("NORMALIZATION LAYER NAME LABEL OK");
527 
528  // Entity - Name relationship
530  EmptyOptional(),
531  normalize->GetGuid(),
532  normalizationLayerNameGuid,
534  readableData,
535  offset);
536  BOOST_TEST_MESSAGE("NORMALIZATION LAYER NAME RELATIONSHIP OK");
537 
538  // Entity - Type relationship
540  EmptyOptional(),
541  normalize->GetGuid(),
544  readableData,
545  offset);
546  BOOST_TEST_MESSAGE("NORMALIZATION LAYER TYPE RELATIONSHIP OK");
547 
548  // Network - Normalize layer relationship
550  EmptyOptional(),
551  optNetGuid,
552  normalize->GetGuid(),
554  readableData,
555  offset);
556  BOOST_TEST_MESSAGE("NETWORK - NORMALIZATION LAYER CHILD RELATIONSHIP OK");
557 
558  // Input layer - Normalize layer relationship
560  EmptyOptional(),
561  input->GetGuid(),
562  normalize->GetGuid(),
564  readableData,
565  offset);
566  BOOST_TEST_MESSAGE("INPUT - NORMALIZATION LAYER CONNECTION OK");
567 
568  // Normalization workload
569  // Normalization workload entity
570  ProfilingGuid normalizationWorkloadGuid = VerifyTimelineEntityBinaryPacketData(
571  EmptyOptional(), readableData, offset);
572  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD ENTITY OK");
573 
574  // Entity - Type relationship
576  EmptyOptional(),
577  normalizationWorkloadGuid,
579  LabelsAndEventClasses::TYPE_GUID,
580  readableData,
581  offset);
582  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD TYPE RELATIONSHIP OK");
583 
584  // BackendId entity
586  EmptyOptional(), "CpuRef", readableData, offset);
587  BOOST_TEST_MESSAGE("CPUREF LABEL OK");
588 
589  // Entity - BackendId relationship
591  EmptyOptional(),
592  normalizationWorkloadGuid,
593  cpuRefLabelGuid,
595  readableData,
596  offset);
597  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD BACKEND ID RELATIONSHIP OK");
598 
599  // Normalize layer - Normalize workload relationship
601  EmptyOptional(),
602  normalize->GetGuid(),
603  normalizationWorkloadGuid,
605  readableData,
606  offset);
607  BOOST_TEST_MESSAGE("NORMALIZATION LAYER - WORKLOAD CHILD RELATIONSHIP OK");
608 
609  // Output layer
610  // Output layer entity
611  VerifyTimelineEntityBinaryPacketData(output->GetGuid(), readableData, offset);
612  BOOST_TEST_MESSAGE("OUTPUT LAYER ENTITY OK");
613 
614  // Name entity
616  EmptyOptional(), "output", readableData, offset);
617  BOOST_TEST_MESSAGE("OUTPUT LAYER NAME LABEL OK");
618 
619  // Entity - Name relationship
621  EmptyOptional(),
622  output->GetGuid(),
623  outputLabelGuid,
625  readableData,
626  offset);
627  BOOST_TEST_MESSAGE("OUTPUT LAYER NAME RELATIONSHIP OK");
628 
629  // Entity - Type relationship
631  EmptyOptional(),
632  output->GetGuid(),
635  readableData,
636  offset);
637  BOOST_TEST_MESSAGE("OUTPUT LAYER TYPE RELATIONSHIP OK");
638 
639  // Network - Output layer relationship
641  EmptyOptional(),
642  optNetGuid,
643  output->GetGuid(),
645  readableData,
646  offset);
647  BOOST_TEST_MESSAGE("NETWORK - OUTPUT LAYER CHILD RELATIONSHIP OK");
648 
649  // Normalize layer - Output layer relationship
651  EmptyOptional(),
652  normalize->GetGuid(),
653  output->GetGuid(),
655  readableData,
656  offset);
657  BOOST_TEST_MESSAGE("NORMALIZE LAYER - OUTPUT LAYER CONNECTION OK");
658 
659  bufferManager.MarkRead(readableBuffer);
660 
661  // Creates structures for input & output.
662  std::vector<float> inputData(16);
663  std::vector<float> outputData(16);
664 
665  InputTensors inputTensors
666  {
667  {0, ConstTensor(runtime.GetInputTensorInfo(netId, 0), inputData.data())}
668  };
669  OutputTensors outputTensors
670  {
671  {0, Tensor(runtime.GetOutputTensorInfo(netId, 0), outputData.data())}
672  };
673 
674  // Does the inference.
675  runtime.EnqueueWorkload(netId, inputTensors, outputTensors);
676 
677  // Get readable buffer for input workload
678  auto inputReadableBuffer = bufferManager.GetReadableBuffer();
679  BOOST_CHECK(inputReadableBuffer != nullptr);
680 
681  // Get readable buffer for output workload
682  auto outputReadableBuffer = bufferManager.GetReadableBuffer();
683  BOOST_CHECK(outputReadableBuffer != nullptr);
684 
685  // Get readable buffer for inference timeline
686  auto inferenceReadableBuffer = bufferManager.GetReadableBuffer();
687  BOOST_CHECK(inferenceReadableBuffer != nullptr);
688 
689  // Validate input workload data
690  size = inputReadableBuffer->GetSize();
691  BOOST_CHECK(size == 164);
692 
693  readableData = inputReadableBuffer->GetReadableData();
694  BOOST_CHECK(readableData != nullptr);
695 
696  offset = 0;
697 
698  // Verify Header
699  VerifyTimelineHeaderBinary(readableData, offset, 156);
700  BOOST_TEST_MESSAGE("INPUT WORKLOAD HEADER OK");
701 
702  // Input workload
703  // Input workload entity
704  ProfilingGuid inputWorkloadGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
705  BOOST_TEST_MESSAGE("INPUT WORKLOAD ENTITY OK");
706 
707  // Entity - Type relationship
709  EmptyOptional(),
710  inputWorkloadGuid,
712  LabelsAndEventClasses::TYPE_GUID,
713  readableData,
714  offset);
715  BOOST_TEST_MESSAGE("INPUT WORKLOAD TYPE RELATIONSHIP OK");
716 
717  // BackendId entity
719  EmptyOptional(), "CpuRef", readableData, offset);
720  BOOST_TEST_MESSAGE("CPUREF LABEL OK (INPUT WORKLOAD)");
721 
722  // Entity - BackendId relationship
724  EmptyOptional(),
725  inputWorkloadGuid,
726  CpuRefLabelGuid,
728  readableData,
729  offset);
730  BOOST_TEST_MESSAGE("INPUT WORKLOAD BACKEND ID RELATIONSHIP OK");
731 
732  // Input layer - Input workload relationship
734  EmptyOptional(),
735  input->GetGuid(),
736  inputWorkloadGuid,
738  readableData,
739  offset);
740  BOOST_TEST_MESSAGE("INPUT LAYER - INPUT WORKLOAD CHILD RELATIONSHIP OK");
741 
742  bufferManager.MarkRead(inputReadableBuffer);
743 
744  // Validate output workload data
745  size = outputReadableBuffer->GetSize();
746  BOOST_CHECK(size == 164);
747 
748  readableData = outputReadableBuffer->GetReadableData();
749  BOOST_CHECK(readableData != nullptr);
750 
751  offset = 0;
752 
753  // Verify Header
754  VerifyTimelineHeaderBinary(readableData, offset, 156);
755  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD HEADER OK");
756 
757  // Output workload
758  // Output workload entity
759  ProfilingGuid outputWorkloadGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
760  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD ENTITY OK");
761 
762  // Entity - Type relationship
764  EmptyOptional(),
765  outputWorkloadGuid,
767  LabelsAndEventClasses::TYPE_GUID,
768  readableData,
769  offset);
770  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD TYPE RELATIONSHIP OK");
771 
772  // BackendId entity
773  VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "CpuRef", readableData, offset);
774  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD CPU REF LABEL OK");
775 
776  // Entity - BackendId relationship
778  EmptyOptional(),
779  outputWorkloadGuid,
780  CpuRefLabelGuid,
782  readableData,
783  offset);
784  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD BACKEND ID RELATIONSHIP OK");
785 
786  // Output layer - Output workload relationship
788  EmptyOptional(),
789  output->GetGuid(),
790  outputWorkloadGuid,
792  readableData,
793  offset);
794  BOOST_TEST_MESSAGE("OUTPUT LAYER - OUTPUT WORKLOAD CHILD RELATIONSHIP OK");
795 
796  bufferManager.MarkRead(outputReadableBuffer);
797 
798  // Validate inference data
799  size = inferenceReadableBuffer->GetSize();
800  BOOST_CHECK(size == 976 + 8 * ThreadIdSize);
801 
802  readableData = inferenceReadableBuffer->GetReadableData();
803  BOOST_CHECK(readableData != nullptr);
804 
805  offset = 0;
806 
807  // Verify Header
808  VerifyTimelineHeaderBinary(readableData, offset, 968 + 8 * ThreadIdSize);
809  BOOST_TEST_MESSAGE("INFERENCE HEADER OK");
810 
811  // Inference timeline trace
812  // Inference entity
813  ProfilingGuid inferenceGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
814  BOOST_TEST_MESSAGE("INFERENCE ENTITY OK");
815 
816  // Entity - Type relationship
818  EmptyOptional(),
819  inferenceGuid,
821  LabelsAndEventClasses::TYPE_GUID,
822  readableData,
823  offset);
824  BOOST_TEST_MESSAGE("INFERENCE TYPE RELATIONSHIP OK");
825 
826  // Network - Inference relationship
828  EmptyOptional(),
829  optNetGuid,
830  inferenceGuid,
832  readableData,
833  offset);
834  BOOST_TEST_MESSAGE("NETWORK - INFERENCE EXECUTION_OF RELATIONSHIP OK");
835 
836  // Start Inference life
837  // Event packet - timeline, threadId, eventGuid
838  ProfilingGuid inferenceEventGuid = VerifyTimelineEventBinaryPacket(
839  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
840  BOOST_TEST_MESSAGE("INFERENCE START OF LIFE EVENT OK");
841 
842  // Inference - event relationship
844  EmptyOptional(),
845  inferenceGuid,
846  inferenceEventGuid,
848  readableData,
849  offset);
850  BOOST_TEST_MESSAGE("INFERENCE START OF LIFE RELATIONSHIP OK");
851 
852  // Execution
853  // Input workload execution
854  // Input workload execution entity
855  ProfilingGuid inputWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData(
856  EmptyOptional(), readableData, offset);
857  BOOST_TEST_MESSAGE("INPUT WORKLOAD EXECUTION ENTITY OK");
858 
859  // Entity - Type relationship
861  EmptyOptional(),
862  inputWorkloadExecutionGuid,
864  LabelsAndEventClasses::TYPE_GUID,
865  readableData,
866  offset);
867  BOOST_TEST_MESSAGE("INPUT WORKLOAD EXECUTION TYPE RELATIONSHIP OK");
868 
869  // Inference - Workload execution relationship
871  EmptyOptional(),
872  inferenceGuid,
873  inputWorkloadExecutionGuid,
874  LabelsAndEventClasses::CHILD_GUID,
875  readableData,
876  offset);
877  BOOST_TEST_MESSAGE("INFERENCE - INPUT WORKLOAD EXECUTION CHILD RELATIONSHIP OK");
878 
879  // Workload - Workload execution relationship
881  EmptyOptional(),
882  inputWorkloadGuid,
883  inputWorkloadExecutionGuid,
885  readableData,
886  offset);
887  BOOST_TEST_MESSAGE("INPUT WORKLOAD - INPUT WORKLOAD EXECUTION RELATIONSHIP OK");
888 
889  // Start Input workload execution life
890  // Event packet - timeline, threadId, eventGuid
891  ProfilingGuid inputWorkloadExecutionSOLEventId = VerifyTimelineEventBinaryPacket(
892  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
893 
894  // Input workload execution - event relationship
896  EmptyOptional(),
897  inputWorkloadExecutionGuid,
898  inputWorkloadExecutionSOLEventId,
900  readableData,
901  offset);
902  BOOST_TEST_MESSAGE("INPUT WORKLOAD EXECUTION - START OF LIFE EVENT RELATIONSHIP OK");
903 
904  // End of Input workload execution life
905  // Event packet - timeline, threadId, eventGuid
906  ProfilingGuid inputWorkloadExecutionEOLEventId = VerifyTimelineEventBinaryPacket(
907  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
908 
909  // Input workload execution - event relationship
911  EmptyOptional(),
912  inputWorkloadExecutionGuid,
913  inputWorkloadExecutionEOLEventId,
915  readableData,
916  offset);
917  BOOST_TEST_MESSAGE("INPUT WORKLOAD EXECUTION - END OF LIFE EVENT RELATIONSHIP OK");
918 
919  // Normalize workload execution
920  // Normalize workload execution entity
921  ProfilingGuid normalizeWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData(
922  EmptyOptional(), readableData, offset);
923  BOOST_TEST_MESSAGE("NORMALIZE WORKLOAD EXECUTION ENTITY OK");
924 
925  // Entity - Type relationship
927  EmptyOptional(),
928  normalizeWorkloadExecutionGuid,
930  LabelsAndEventClasses::TYPE_GUID,
931  readableData,
932  offset);
933  BOOST_TEST_MESSAGE("NORMALIZE WORKLOAD EXECUTION TYPE RELATIONSHIP OK");
934 
935  // Inference - Workload execution relationship
937  EmptyOptional(),
938  inferenceGuid,
939  normalizeWorkloadExecutionGuid,
940  LabelsAndEventClasses::CHILD_GUID,
941  readableData,
942  offset);
943  BOOST_TEST_MESSAGE("INFERENCE - NORMALIZE WORKLOAD EXECUTION CHILD RELATIONSHIP OK");
944 
945  // Workload - Workload execution relationship
947  EmptyOptional(),
948  normalizationWorkloadGuid,
949  normalizeWorkloadExecutionGuid,
951  readableData,
952  offset);
953  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD - NORMALIZATION WORKLOAD EXECUTION RELATIONSHIP OK");
954 
955  // Start Normalize workload execution life
956  // Event packet - timeline, threadId, eventGuid
957  ProfilingGuid normalizationWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket(
958  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
959  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD EXECUTION START OF LIFE EVENT OK");
960 
961  // Normalize workload execution - event relationship
963  EmptyOptional(),
964  normalizeWorkloadExecutionGuid,
965  normalizationWorkloadExecutionSOLEventGuid,
967  readableData,
968  offset);
969  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD EXECUTION START OF LIFE RELATIONSHIP OK");
970 
971  // End of Normalize workload execution life
972  // Event packet - timeline, threadId, eventGuid
973  ProfilingGuid normalizationWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket(
974  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
975  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD EXECUTION END OF LIFE EVENT OK");
976 
977  // Normalize workload execution - event relationship
979  EmptyOptional(),
980  normalizeWorkloadExecutionGuid,
981  normalizationWorkloadExecutionEOLEventGuid,
983  readableData,
984  offset);
985  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD EXECUTION END OF LIFE RELATIONSHIP OK");
986 
987  // Output workload execution
988  // Output workload execution entity
989  ProfilingGuid outputWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData(
990  EmptyOptional(), readableData, offset);
991  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD EXECUTION ENTITY OK");
992 
993  // Entity - Type relationship
995  EmptyOptional(),
996  outputWorkloadExecutionGuid,
998  LabelsAndEventClasses::TYPE_GUID,
999  readableData,
1000  offset);
1001  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD EXECUTION TYPE RELATIONSHIP OK");
1002 
1003  // Inference - Workload execution relationship
1005  EmptyOptional(),
1006  inferenceGuid,
1007  outputWorkloadExecutionGuid,
1008  LabelsAndEventClasses::CHILD_GUID,
1009  readableData,
1010  offset);
1011  BOOST_TEST_MESSAGE("INFERENCE - OUTPUT WORKLOAD EXECUTION CHILD RELATIONSHIP OK");
1012 
1013  // Workload - Workload execution relationship
1015  EmptyOptional(),
1016  outputWorkloadGuid,
1017  outputWorkloadExecutionGuid,
1019  readableData,
1020  offset);
1021  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD - OUTPUT WORKLOAD EXECUTION EXECUTION_OF RELATIONSHIP OK");
1022 
1023  // Start Output workload execution life
1024  // Event packet - timeline, threadId, eventGuid
1025  ProfilingGuid outputWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket(
1026  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1027  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD EXECUTION START OF LIFE EVENT OK");
1028 
1029  // Output workload execution - event relationship
1031  EmptyOptional(),
1032  outputWorkloadExecutionGuid,
1033  outputWorkloadExecutionSOLEventGuid,
1035  readableData,
1036  offset);
1037  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD EXECUTION - START OF LIFE EVENT RELATIONSHIP OK");
1038 
1039  // End of Normalize workload execution life
1040  // Event packet - timeline, threadId, eventGuid
1041  ProfilingGuid outputWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket(
1042  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1043  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD EXECUTION END OF LIFE EVENT OK");
1044 
1045  // Output workload execution - event relationship
1047  EmptyOptional(),
1048  outputWorkloadExecutionGuid,
1049  outputWorkloadExecutionEOLEventGuid,
1051  readableData,
1052  offset);
1053  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD EXECUTION - END OF LIFE EVENT RELATIONSHIP OK");
1054 
1055  // End of Inference life
1056  // Event packet - timeline, threadId, eventGuid
1057  ProfilingGuid inferenceEOLEventGuid = VerifyTimelineEventBinaryPacket(
1058  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1059  BOOST_TEST_MESSAGE("INFERENCE END OF LIFE EVENT OK");
1060 
1061  // Inference - event relationship
1063  EmptyOptional(),
1064  inferenceGuid,
1065  inferenceEOLEventGuid,
1067  readableData,
1068  offset);
1069  BOOST_TEST_MESSAGE("INFERENCE - END OF LIFE EVENT RELATIONSHIP OK");
1070 
1071  bufferManager.MarkRead(inferenceReadableBuffer);
1072 }
static ARMNN_DLLEXPORT ProfilingStaticGuid INFERENCE_GUID
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:61
ProfilingGuid VerifyTimelineEntityBinaryPacketData(Optional< ProfilingGuid > guid, const unsigned char *readableData, unsigned int &offset)
CPU Execution: Reference C++ kernels.
std::vector< std::pair< LayerBindingId, class ConstTensor > > InputTensors
Definition: Tensor.hpp:324
int NetworkId
Definition: IRuntime.hpp:20
Copyright (c) 2020 ARM Limited.
static ARMNN_DLLEXPORT ProfilingStaticGuid CONNECTION_GUID
static ARMNN_DLLEXPORT ProfilingStaticGuid WORKLOAD_GUID
static ARMNN_DLLEXPORT ProfilingStaticGuid WORKLOAD_EXECUTION_GUID
static ARMNN_DLLEXPORT ProfilingStaticGuid ARMNN_PROFILING_EOL_EVENT_CLASS
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
static ARMNN_DLLEXPORT ProfilingStaticGuid NAME_GUID
static ARMNN_DLLEXPORT ProfilingStaticGuid ARMNN_PROFILING_SOL_EVENT_CLASS
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
Definition: Tensor.hpp:290
static ARMNN_DLLEXPORT ProfilingStaticGuid LAYER_GUID
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:1014
profiling::ProfilingService & GetProfilingService(armnn::Runtime *runtime)
Definition: TestUtils.cpp:25
void VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType relationshipType, Optional< ProfilingGuid > relationshipGuid, Optional< ProfilingGuid > headGuid, Optional< ProfilingGuid > tailGuid, Optional< ProfilingGuid > attributeGuid, const unsigned char *readableData, unsigned int &offset)
virtual LayerGuid GetGuid() const =0
Returns the unique id of the layer.
static ARMNN_DLLEXPORT ProfilingStaticGuid EXECUTION_OF_GUID
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Definition: Tensor.hpp:298
std::vector< std::pair< LayerBindingId, class Tensor > > OutputTensors
Definition: Tensor.hpp:325
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:593
void ResetExternalProfilingOptions(const ExternalProfilingOptions &options, bool resetProfilingService=false)
IPacketBufferPtr GetReadableBuffer() override
constexpr unsigned int ThreadIdSize
void VerifyTimelineHeaderBinary(const unsigned char *readableData, unsigned int &offset, uint32_t packetDataLength)
static ARMNN_DLLEXPORT ProfilingStaticGuid NETWORK_GUID
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
Definition: Optional.hpp:32
static ARMNN_DLLEXPORT ProfilingStaticGuid TYPE_GUID
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:101
ProfilingGuid VerifyTimelineEventBinaryPacket(Optional< uint64_t > timestamp, Optional< int > threadId, Optional< ProfilingGuid > eventGuid, const unsigned char *readableData, unsigned int &offset)
virtual int Connect(IInputSlot &destination)=0
ProfilingGuid VerifyTimelineLabelBinaryPacketData(Optional< ProfilingGuid > guid, const std::string &label, const unsigned char *readableData, unsigned int &offset)
static ARMNN_DLLEXPORT ProfilingStaticGuid PROCESS_ID_GUID
A NormalizationDescriptor for the NormalizationLayer.
ExternalProfilingOptions m_ProfilingOptions
Definition: IRuntime.hpp:83
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:50
static ARMNN_DLLEXPORT ProfilingStaticGuid BACKENDID_GUID
static ARMNN_DLLEXPORT ProfilingStaticGuid CHILD_GUID

◆ BOOST_AUTO_TEST_CASE() [8/8]

BOOST_AUTO_TEST_CASE ( ProfilingPostOptimisationStructureCpuRef  )

Definition at line 1074 of file RuntimeTests.cpp.

References BOOST_AUTO_TEST_SUITE_END(), armnn::CpuRef, and VerifyPostOptimisationStructureTestImpl().

1075 {
1077 }
void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId)
CPU Execution: Reference C++ kernels.