ArmNN
 21.02
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) 2021 ARM Limited and Contributors.
 

Functions

void RuntimeLoadedNetworksReserve (armnn::RuntimeImpl *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, IRuntime::Create(), INetwork::Create(), armnn::Failure, RuntimeImpl::GetDeviceSpec(), armnn::IgnoreUnused(), RuntimeImpl::LoadNetwork(), armnn::Optimize(), armnn::RuntimeLoadedNetworksReserve(), armnn::Success, and RuntimeImpl::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:37
CPU Execution: Reference C++ kernels.
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:26
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:1502
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:173
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:510

◆ BOOST_AUTO_TEST_CASE() [2/8]

BOOST_AUTO_TEST_CASE ( RuntimeCpuRef  )

Definition at line 168 of file RuntimeTests.cpp.

References IOutputSlot::Connect(), armnn::CpuRef, IRuntime::Create(), INetwork::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:37
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:62
CPU Execution: Reference C++ kernels.
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:26
int NetworkId
Definition: IRuntime.hpp:20
Copyright (c) 2021 ARM Limited and Contributors.
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:1502
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:174
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:173
virtual int Connect(IInputSlot &destination)=0
A NormalizationDescriptor for the NormalizationLayer.
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:510

◆ 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, IRuntime::Create(), INetwork::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:37
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:62
CPU Execution: Reference C++ kernels.
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:26
int NetworkId
Definition: IRuntime.hpp:20
Copyright (c) 2021 ARM Limited and Contributors.
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:1502
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:174
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:173
virtual int Connect(IInputSlot &destination)=0
A NormalizationDescriptor for the NormalizationLayer.
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:510

◆ 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, IRuntime::Create(), INetwork::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;
265 
266  try
267  {
269  backends,
270  runtime->GetDeviceSpec(),
272  errMessages);
273  BOOST_FAIL("An exception should have been thrown");
274  }
275  catch (const InvalidArgumentException& e)
276  {
277  // Different exceptions are thrown on different backends
278  }
279  BOOST_CHECK(errMessages.size() > 0);
280 }
static IRuntimePtr Create(const CreationOptions &options)
Definition: Runtime.cpp:37
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:62
CPU Execution: Reference C++ kernels.
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:26
Copyright (c) 2021 ARM Limited and Contributors.
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:1502
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:174
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:173
virtual int Connect(IInputSlot &destination)=0
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:510
A SoftmaxDescriptor for the SoftmaxLayer.

◆ BOOST_AUTO_TEST_CASE() [5/8]

BOOST_AUTO_TEST_CASE ( RuntimeBackendOptions  )

Definition at line 282 of file RuntimeTests.cpp.

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

283 {
284  using namespace armnn;
285 
286  IRuntime::CreationOptions creationOptions;
287  auto& backendOptions = creationOptions.m_BackendOptions;
288 
289 
290  // Define Options on explicit construction
291  BackendOptions options1("FakeBackend1",
292  {
293  { "Option1", 1.3f },
294  { "Option2", true }
295  });
296 
297  // Add an option after construction
298  options1.AddOption({ "Option3", "some_value" });
299 
300  // Add the options to CreationOptions struct
301  backendOptions.push_back(options1);
302 
303  // Add more Options via inplace explicit construction
304  backendOptions.emplace_back(BackendOptions{ "FakeBackend1",
305  {{ "Option4", 42 }}
306  });
307 
308 
309  // First group
310  BOOST_TEST(backendOptions[0].GetBackendId().Get() == "FakeBackend1");
311  BOOST_TEST(backendOptions[0].GetOption(0).GetName() == "Option1");
312  BOOST_TEST(backendOptions[0].GetOption(0).GetValue().IsFloat() == true);
313  BOOST_TEST(backendOptions[0].GetOption(0).GetValue().AsFloat() == 1.3f);
314 
315  BOOST_TEST(backendOptions[0].GetOption(1).GetName() == "Option2");
316  BOOST_TEST(backendOptions[0].GetOption(1).GetValue().IsBool() == true);
317  BOOST_TEST(backendOptions[0].GetOption(1).GetValue().AsBool() == true);
318 
319  BOOST_TEST(backendOptions[0].GetOption(2).GetName() == "Option3");
320  BOOST_TEST(backendOptions[0].GetOption(2).GetValue().IsString() == true);
321  BOOST_TEST(backendOptions[0].GetOption(2).GetValue().AsString() == "some_value");
322 
323  // Second group
324  BOOST_TEST(backendOptions[1].GetBackendId().Get() == "FakeBackend1");
325  BOOST_TEST(backendOptions[1].GetOption(0).GetName() == "Option4");
326  BOOST_TEST(backendOptions[1].GetOption(0).GetValue().IsInt() == true);
327  BOOST_TEST(backendOptions[1].GetOption(0).GetValue().AsInt() == 42);
328 }
Copyright (c) 2021 ARM Limited and Contributors.
std::vector< BackendOptions > m_BackendOptions
Pass backend specific options.
Definition: IRuntime.hpp:116
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 330 of file RuntimeTests.cpp.

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

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

◆ BOOST_AUTO_TEST_CASE() [7/8]

BOOST_AUTO_TEST_CASE ( ProfilingEnableCpuRef  )

Definition at line 371 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(), RuntimeImpl::EnqueueWorkload(), LabelsAndEventClasses::EXECUTION_OF_GUID, armnn::Float32, ProfilingServiceRuntimeHelper::ForceTransitionToState(), armnnUtils::Processes::GetCurrentId(), RuntimeImpl::GetDeviceSpec(), IConnectableLayer::GetGuid(), IConnectableLayer::GetInputSlot(), RuntimeImpl::GetInputTensorInfo(), IConnectableLayer::GetOutputSlot(), RuntimeImpl::GetOutputTensorInfo(), ProfilingServiceRuntimeHelper::GetProfilingBufferManager(), armnn::GetProfilingService(), BufferManager::GetReadableBuffer(), LabelsAndEventClasses::INFERENCE_GUID, LabelsAndEventClasses::LAYER_GUID, RuntimeImpl::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.

372 {
373  using namespace armnn;
374  using namespace armnn::profiling;
375 
376  // Create runtime in which the test will run
378  options.m_ProfilingOptions.m_EnableProfiling = true;
379  options.m_ProfilingOptions.m_TimelineEnabled = true;
380 
381  armnn::RuntimeImpl runtime(options);
383 
384  profiling::ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime));
385  profilingServiceHelper.ForceTransitionToState(ProfilingState::NotConnected);
386  profilingServiceHelper.ForceTransitionToState(ProfilingState::WaitingForAck);
387  profilingServiceHelper.ForceTransitionToState(ProfilingState::Active);
388 
389  // build up the structure of the network
391 
392  IConnectableLayer* input = net->AddInputLayer(0, "input");
393 
394  NormalizationDescriptor descriptor;
395  IConnectableLayer* normalize = net->AddNormalizationLayer(descriptor, "normalization");
396 
397  IConnectableLayer* output = net->AddOutputLayer(0, "output");
398 
399  input->GetOutputSlot(0).Connect(normalize->GetInputSlot(0));
400  normalize->GetOutputSlot(0).Connect(output->GetInputSlot(0));
401 
402  input->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
403  normalize->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
404 
405  // optimize the network
406  std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
407  IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime.GetDeviceSpec());
408 
409  ProfilingGuid optNetGuid = optNet->GetGuid();
410 
411  // Load it into the runtime. It should succeed.
412  armnn::NetworkId netId;
413  BOOST_TEST(runtime.LoadNetwork(netId, std::move(optNet)) == Status::Success);
414 
415  profiling::BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager();
416  auto readableBuffer = bufferManager.GetReadableBuffer();
417 
418  // Profiling is enabled, the post-optimisation structure should be created
419  BOOST_CHECK(readableBuffer != nullptr);
420 
421  unsigned int size = readableBuffer->GetSize();
422 
423  const unsigned char* readableData = readableBuffer->GetReadableData();
424  BOOST_CHECK(readableData != nullptr);
425 
426  unsigned int offset = 0;
427 
428  // Verify Header
429  VerifyTimelineHeaderBinary(readableData, offset, size - 8);
430  BOOST_TEST_MESSAGE("HEADER OK");
431 
432  // Post-optimisation network
433  // Network entity
434  VerifyTimelineEntityBinaryPacketData(optNetGuid, readableData, offset);
435  BOOST_TEST_MESSAGE("NETWORK ENTITY OK");
436 
437  // Entity - Type relationship
439  EmptyOptional(),
440  optNetGuid,
443  readableData,
444  offset);
445  BOOST_TEST_MESSAGE("NETWORK TYPE RELATIONSHIP OK");
446 
447  // Network - START OF LIFE
449  EmptyOptional(),
450  EmptyOptional(),
451  readableData,
452  offset);
453  BOOST_TEST_MESSAGE("NETWORK START OF LIFE EVENT OK");
454 
455  // Network - START OF LIFE event relationship
457  EmptyOptional(),
458  optNetGuid,
459  networkSolEventGuid,
461  readableData,
462  offset);
463  BOOST_TEST_MESSAGE("NETWORK START OF LIFE RELATIONSHIP OK");
464 
465  // Process ID Label
466  int processID = armnnUtils::Processes::GetCurrentId();
467  std::stringstream ss;
468  ss << processID;
469  std::string processIdLabel = ss.str();
470  VerifyTimelineLabelBinaryPacketData(EmptyOptional(), processIdLabel, readableData, offset);
471  BOOST_TEST_MESSAGE("PROCESS ID LABEL OK");
472 
473  // Entity - Process ID relationship
475  EmptyOptional(),
476  optNetGuid,
477  EmptyOptional(),
479  readableData,
480  offset);
481  BOOST_TEST_MESSAGE("NETWORK PROCESS ID RELATIONSHIP OK");
482 
483  // Input layer
484  // Input layer entity
485  VerifyTimelineEntityBinaryPacketData(input->GetGuid(), readableData, offset);
486  BOOST_TEST_MESSAGE("INPUT ENTITY OK");
487 
488  // Name Entity
489  ProfilingGuid inputLabelGuid = VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "input", readableData, offset);
490  BOOST_TEST_MESSAGE("INPUT NAME LABEL OK");
491 
492  // Entity - Name relationship
494  EmptyOptional(),
495  input->GetGuid(),
496  inputLabelGuid,
498  readableData,
499  offset);
500  BOOST_TEST_MESSAGE("INPUT NAME RELATIONSHIP OK");
501 
502  // Entity - Type relationship
504  EmptyOptional(),
505  input->GetGuid(),
508  readableData,
509  offset);
510  BOOST_TEST_MESSAGE("INPUT TYPE RELATIONSHIP OK");
511 
512  // Network - Input layer relationship
514  EmptyOptional(),
515  optNetGuid,
516  input->GetGuid(),
518  readableData,
519  offset);
520  BOOST_TEST_MESSAGE("NETWORK - INPUT CHILD RELATIONSHIP OK");
521 
522  // Normalization layer
523  // Normalization layer entity
524  VerifyTimelineEntityBinaryPacketData(normalize->GetGuid(), readableData, offset);
525  BOOST_TEST_MESSAGE("NORMALIZATION LAYER ENTITY OK");
526 
527  // Name entity
528  ProfilingGuid normalizationLayerNameGuid = VerifyTimelineLabelBinaryPacketData(
529  EmptyOptional(), "normalization", readableData, offset);
530  BOOST_TEST_MESSAGE("NORMALIZATION LAYER NAME LABEL OK");
531 
532  // Entity - Name relationship
534  EmptyOptional(),
535  normalize->GetGuid(),
536  normalizationLayerNameGuid,
538  readableData,
539  offset);
540  BOOST_TEST_MESSAGE("NORMALIZATION LAYER NAME RELATIONSHIP OK");
541 
542  // Entity - Type relationship
544  EmptyOptional(),
545  normalize->GetGuid(),
548  readableData,
549  offset);
550  BOOST_TEST_MESSAGE("NORMALIZATION LAYER TYPE RELATIONSHIP OK");
551 
552  // Network - Normalize layer relationship
554  EmptyOptional(),
555  optNetGuid,
556  normalize->GetGuid(),
558  readableData,
559  offset);
560  BOOST_TEST_MESSAGE("NETWORK - NORMALIZATION LAYER CHILD RELATIONSHIP OK");
561 
562  // Input layer - Normalize layer relationship
564  EmptyOptional(),
565  input->GetGuid(),
566  normalize->GetGuid(),
568  readableData,
569  offset);
570  BOOST_TEST_MESSAGE("INPUT - NORMALIZATION LAYER CONNECTION OK");
571 
572  // Normalization workload
573  // Normalization workload entity
574  ProfilingGuid normalizationWorkloadGuid = VerifyTimelineEntityBinaryPacketData(
575  EmptyOptional(), readableData, offset);
576  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD ENTITY OK");
577 
578  // Entity - Type relationship
580  EmptyOptional(),
581  normalizationWorkloadGuid,
583  LabelsAndEventClasses::TYPE_GUID,
584  readableData,
585  offset);
586  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD TYPE RELATIONSHIP OK");
587 
588  // BackendId entity
590  EmptyOptional(), "CpuRef", readableData, offset);
591  BOOST_TEST_MESSAGE("CPUREF LABEL OK");
592 
593  // Entity - BackendId relationship
595  EmptyOptional(),
596  normalizationWorkloadGuid,
597  cpuRefLabelGuid,
599  readableData,
600  offset);
601  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD BACKEND ID RELATIONSHIP OK");
602 
603  // Normalize layer - Normalize workload relationship
605  EmptyOptional(),
606  normalize->GetGuid(),
607  normalizationWorkloadGuid,
609  readableData,
610  offset);
611  BOOST_TEST_MESSAGE("NORMALIZATION LAYER - WORKLOAD CHILD RELATIONSHIP OK");
612 
613  // Output layer
614  // Output layer entity
615  VerifyTimelineEntityBinaryPacketData(output->GetGuid(), readableData, offset);
616  BOOST_TEST_MESSAGE("OUTPUT LAYER ENTITY OK");
617 
618  // Name entity
620  EmptyOptional(), "output", readableData, offset);
621  BOOST_TEST_MESSAGE("OUTPUT LAYER NAME LABEL OK");
622 
623  // Entity - Name relationship
625  EmptyOptional(),
626  output->GetGuid(),
627  outputLabelGuid,
629  readableData,
630  offset);
631  BOOST_TEST_MESSAGE("OUTPUT LAYER NAME RELATIONSHIP OK");
632 
633  // Entity - Type relationship
635  EmptyOptional(),
636  output->GetGuid(),
639  readableData,
640  offset);
641  BOOST_TEST_MESSAGE("OUTPUT LAYER TYPE RELATIONSHIP OK");
642 
643  // Network - Output layer relationship
645  EmptyOptional(),
646  optNetGuid,
647  output->GetGuid(),
649  readableData,
650  offset);
651  BOOST_TEST_MESSAGE("NETWORK - OUTPUT LAYER CHILD RELATIONSHIP OK");
652 
653  // Normalize layer - Output layer relationship
655  EmptyOptional(),
656  normalize->GetGuid(),
657  output->GetGuid(),
659  readableData,
660  offset);
661  BOOST_TEST_MESSAGE("NORMALIZE LAYER - OUTPUT LAYER CONNECTION OK");
662 
663  bufferManager.MarkRead(readableBuffer);
664 
665  // Creates structures for input & output.
666  std::vector<float> inputData(16);
667  std::vector<float> outputData(16);
668 
669  InputTensors inputTensors
670  {
671  {0, ConstTensor(runtime.GetInputTensorInfo(netId, 0), inputData.data())}
672  };
673  OutputTensors outputTensors
674  {
675  {0, Tensor(runtime.GetOutputTensorInfo(netId, 0), outputData.data())}
676  };
677 
678  // Does the inference.
679  runtime.EnqueueWorkload(netId, inputTensors, outputTensors);
680 
681  // Get readable buffer for input workload
682  auto inputReadableBuffer = bufferManager.GetReadableBuffer();
683  BOOST_CHECK(inputReadableBuffer != nullptr);
684 
685  // Get readable buffer for output workload
686  auto outputReadableBuffer = bufferManager.GetReadableBuffer();
687  BOOST_CHECK(outputReadableBuffer != nullptr);
688 
689  // Get readable buffer for inference timeline
690  auto inferenceReadableBuffer = bufferManager.GetReadableBuffer();
691  BOOST_CHECK(inferenceReadableBuffer != nullptr);
692 
693  // Validate input workload data
694  size = inputReadableBuffer->GetSize();
695  BOOST_CHECK(size == 164);
696 
697  readableData = inputReadableBuffer->GetReadableData();
698  BOOST_CHECK(readableData != nullptr);
699 
700  offset = 0;
701 
702  // Verify Header
703  VerifyTimelineHeaderBinary(readableData, offset, 156);
704  BOOST_TEST_MESSAGE("INPUT WORKLOAD HEADER OK");
705 
706  // Input workload
707  // Input workload entity
708  ProfilingGuid inputWorkloadGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
709  BOOST_TEST_MESSAGE("INPUT WORKLOAD ENTITY OK");
710 
711  // Entity - Type relationship
713  EmptyOptional(),
714  inputWorkloadGuid,
716  LabelsAndEventClasses::TYPE_GUID,
717  readableData,
718  offset);
719  BOOST_TEST_MESSAGE("INPUT WORKLOAD TYPE RELATIONSHIP OK");
720 
721  // BackendId entity
723  EmptyOptional(), "CpuRef", readableData, offset);
724  BOOST_TEST_MESSAGE("CPUREF LABEL OK (INPUT WORKLOAD)");
725 
726  // Entity - BackendId relationship
728  EmptyOptional(),
729  inputWorkloadGuid,
730  CpuRefLabelGuid,
732  readableData,
733  offset);
734  BOOST_TEST_MESSAGE("INPUT WORKLOAD BACKEND ID RELATIONSHIP OK");
735 
736  // Input layer - Input workload relationship
738  EmptyOptional(),
739  input->GetGuid(),
740  inputWorkloadGuid,
742  readableData,
743  offset);
744  BOOST_TEST_MESSAGE("INPUT LAYER - INPUT WORKLOAD CHILD RELATIONSHIP OK");
745 
746  bufferManager.MarkRead(inputReadableBuffer);
747 
748  // Validate output workload data
749  size = outputReadableBuffer->GetSize();
750  BOOST_CHECK(size == 164);
751 
752  readableData = outputReadableBuffer->GetReadableData();
753  BOOST_CHECK(readableData != nullptr);
754 
755  offset = 0;
756 
757  // Verify Header
758  VerifyTimelineHeaderBinary(readableData, offset, 156);
759  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD HEADER OK");
760 
761  // Output workload
762  // Output workload entity
763  ProfilingGuid outputWorkloadGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
764  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD ENTITY OK");
765 
766  // Entity - Type relationship
768  EmptyOptional(),
769  outputWorkloadGuid,
771  LabelsAndEventClasses::TYPE_GUID,
772  readableData,
773  offset);
774  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD TYPE RELATIONSHIP OK");
775 
776  // BackendId entity
777  VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "CpuRef", readableData, offset);
778  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD CPU REF LABEL OK");
779 
780  // Entity - BackendId relationship
782  EmptyOptional(),
783  outputWorkloadGuid,
784  CpuRefLabelGuid,
786  readableData,
787  offset);
788  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD BACKEND ID RELATIONSHIP OK");
789 
790  // Output layer - Output workload relationship
792  EmptyOptional(),
793  output->GetGuid(),
794  outputWorkloadGuid,
796  readableData,
797  offset);
798  BOOST_TEST_MESSAGE("OUTPUT LAYER - OUTPUT WORKLOAD CHILD RELATIONSHIP OK");
799 
800  bufferManager.MarkRead(outputReadableBuffer);
801 
802  // Validate inference data
803  size = inferenceReadableBuffer->GetSize();
804  BOOST_CHECK(size == 976 + 8 * ThreadIdSize);
805 
806  readableData = inferenceReadableBuffer->GetReadableData();
807  BOOST_CHECK(readableData != nullptr);
808 
809  offset = 0;
810 
811  // Verify Header
812  VerifyTimelineHeaderBinary(readableData, offset, 968 + 8 * ThreadIdSize);
813  BOOST_TEST_MESSAGE("INFERENCE HEADER OK");
814 
815  // Inference timeline trace
816  // Inference entity
817  ProfilingGuid inferenceGuid = VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
818  BOOST_TEST_MESSAGE("INFERENCE ENTITY OK");
819 
820  // Entity - Type relationship
822  EmptyOptional(),
823  inferenceGuid,
825  LabelsAndEventClasses::TYPE_GUID,
826  readableData,
827  offset);
828  BOOST_TEST_MESSAGE("INFERENCE TYPE RELATIONSHIP OK");
829 
830  // Network - Inference relationship
832  EmptyOptional(),
833  optNetGuid,
834  inferenceGuid,
836  readableData,
837  offset);
838  BOOST_TEST_MESSAGE("NETWORK - INFERENCE EXECUTION_OF RELATIONSHIP OK");
839 
840  // Start Inference life
841  // Event packet - timeline, threadId, eventGuid
842  ProfilingGuid inferenceEventGuid = VerifyTimelineEventBinaryPacket(
843  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
844  BOOST_TEST_MESSAGE("INFERENCE START OF LIFE EVENT OK");
845 
846  // Inference - event relationship
848  EmptyOptional(),
849  inferenceGuid,
850  inferenceEventGuid,
852  readableData,
853  offset);
854  BOOST_TEST_MESSAGE("INFERENCE START OF LIFE RELATIONSHIP OK");
855 
856  // Execution
857  // Input workload execution
858  // Input workload execution entity
859  ProfilingGuid inputWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData(
860  EmptyOptional(), readableData, offset);
861  BOOST_TEST_MESSAGE("INPUT WORKLOAD EXECUTION ENTITY OK");
862 
863  // Entity - Type relationship
865  EmptyOptional(),
866  inputWorkloadExecutionGuid,
868  LabelsAndEventClasses::TYPE_GUID,
869  readableData,
870  offset);
871  BOOST_TEST_MESSAGE("INPUT WORKLOAD EXECUTION TYPE RELATIONSHIP OK");
872 
873  // Inference - Workload execution relationship
875  EmptyOptional(),
876  inferenceGuid,
877  inputWorkloadExecutionGuid,
878  LabelsAndEventClasses::CHILD_GUID,
879  readableData,
880  offset);
881  BOOST_TEST_MESSAGE("INFERENCE - INPUT WORKLOAD EXECUTION CHILD RELATIONSHIP OK");
882 
883  // Workload - Workload execution relationship
885  EmptyOptional(),
886  inputWorkloadGuid,
887  inputWorkloadExecutionGuid,
889  readableData,
890  offset);
891  BOOST_TEST_MESSAGE("INPUT WORKLOAD - INPUT WORKLOAD EXECUTION RELATIONSHIP OK");
892 
893  // Start Input workload execution life
894  // Event packet - timeline, threadId, eventGuid
895  ProfilingGuid inputWorkloadExecutionSOLEventId = VerifyTimelineEventBinaryPacket(
896  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
897 
898  // Input workload execution - event relationship
900  EmptyOptional(),
901  inputWorkloadExecutionGuid,
902  inputWorkloadExecutionSOLEventId,
904  readableData,
905  offset);
906  BOOST_TEST_MESSAGE("INPUT WORKLOAD EXECUTION - START OF LIFE EVENT RELATIONSHIP OK");
907 
908  // End of Input workload execution life
909  // Event packet - timeline, threadId, eventGuid
910  ProfilingGuid inputWorkloadExecutionEOLEventId = VerifyTimelineEventBinaryPacket(
911  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
912 
913  // Input workload execution - event relationship
915  EmptyOptional(),
916  inputWorkloadExecutionGuid,
917  inputWorkloadExecutionEOLEventId,
919  readableData,
920  offset);
921  BOOST_TEST_MESSAGE("INPUT WORKLOAD EXECUTION - END OF LIFE EVENT RELATIONSHIP OK");
922 
923  // Normalize workload execution
924  // Normalize workload execution entity
925  ProfilingGuid normalizeWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData(
926  EmptyOptional(), readableData, offset);
927  BOOST_TEST_MESSAGE("NORMALIZE WORKLOAD EXECUTION ENTITY OK");
928 
929  // Entity - Type relationship
931  EmptyOptional(),
932  normalizeWorkloadExecutionGuid,
934  LabelsAndEventClasses::TYPE_GUID,
935  readableData,
936  offset);
937  BOOST_TEST_MESSAGE("NORMALIZE WORKLOAD EXECUTION TYPE RELATIONSHIP OK");
938 
939  // Inference - Workload execution relationship
941  EmptyOptional(),
942  inferenceGuid,
943  normalizeWorkloadExecutionGuid,
944  LabelsAndEventClasses::CHILD_GUID,
945  readableData,
946  offset);
947  BOOST_TEST_MESSAGE("INFERENCE - NORMALIZE WORKLOAD EXECUTION CHILD RELATIONSHIP OK");
948 
949  // Workload - Workload execution relationship
951  EmptyOptional(),
952  normalizationWorkloadGuid,
953  normalizeWorkloadExecutionGuid,
955  readableData,
956  offset);
957  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD - NORMALIZATION WORKLOAD EXECUTION RELATIONSHIP OK");
958 
959  // Start Normalize workload execution life
960  // Event packet - timeline, threadId, eventGuid
961  ProfilingGuid normalizationWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket(
962  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
963  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD EXECUTION START OF LIFE EVENT OK");
964 
965  // Normalize workload execution - event relationship
967  EmptyOptional(),
968  normalizeWorkloadExecutionGuid,
969  normalizationWorkloadExecutionSOLEventGuid,
971  readableData,
972  offset);
973  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD EXECUTION START OF LIFE RELATIONSHIP OK");
974 
975  // End of Normalize workload execution life
976  // Event packet - timeline, threadId, eventGuid
977  ProfilingGuid normalizationWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket(
978  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
979  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD EXECUTION END OF LIFE EVENT OK");
980 
981  // Normalize workload execution - event relationship
983  EmptyOptional(),
984  normalizeWorkloadExecutionGuid,
985  normalizationWorkloadExecutionEOLEventGuid,
987  readableData,
988  offset);
989  BOOST_TEST_MESSAGE("NORMALIZATION WORKLOAD EXECUTION END OF LIFE RELATIONSHIP OK");
990 
991  // Output workload execution
992  // Output workload execution entity
993  ProfilingGuid outputWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData(
994  EmptyOptional(), readableData, offset);
995  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD EXECUTION ENTITY OK");
996 
997  // Entity - Type relationship
999  EmptyOptional(),
1000  outputWorkloadExecutionGuid,
1002  LabelsAndEventClasses::TYPE_GUID,
1003  readableData,
1004  offset);
1005  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD EXECUTION TYPE RELATIONSHIP OK");
1006 
1007  // Inference - Workload execution relationship
1009  EmptyOptional(),
1010  inferenceGuid,
1011  outputWorkloadExecutionGuid,
1012  LabelsAndEventClasses::CHILD_GUID,
1013  readableData,
1014  offset);
1015  BOOST_TEST_MESSAGE("INFERENCE - OUTPUT WORKLOAD EXECUTION CHILD RELATIONSHIP OK");
1016 
1017  // Workload - Workload execution relationship
1019  EmptyOptional(),
1020  outputWorkloadGuid,
1021  outputWorkloadExecutionGuid,
1023  readableData,
1024  offset);
1025  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD - OUTPUT WORKLOAD EXECUTION EXECUTION_OF RELATIONSHIP OK");
1026 
1027  // Start Output workload execution life
1028  // Event packet - timeline, threadId, eventGuid
1029  ProfilingGuid outputWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket(
1030  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1031  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD EXECUTION START OF LIFE EVENT OK");
1032 
1033  // Output workload execution - event relationship
1035  EmptyOptional(),
1036  outputWorkloadExecutionGuid,
1037  outputWorkloadExecutionSOLEventGuid,
1039  readableData,
1040  offset);
1041  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD EXECUTION - START OF LIFE EVENT RELATIONSHIP OK");
1042 
1043  // End of Normalize workload execution life
1044  // Event packet - timeline, threadId, eventGuid
1045  ProfilingGuid outputWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket(
1046  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1047  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD EXECUTION END OF LIFE EVENT OK");
1048 
1049  // Output workload execution - event relationship
1051  EmptyOptional(),
1052  outputWorkloadExecutionGuid,
1053  outputWorkloadExecutionEOLEventGuid,
1055  readableData,
1056  offset);
1057  BOOST_TEST_MESSAGE("OUTPUT WORKLOAD EXECUTION - END OF LIFE EVENT RELATIONSHIP OK");
1058 
1059  // End of Inference life
1060  // Event packet - timeline, threadId, eventGuid
1061  ProfilingGuid inferenceEOLEventGuid = VerifyTimelineEventBinaryPacket(
1062  EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1063  BOOST_TEST_MESSAGE("INFERENCE END OF LIFE EVENT OK");
1064 
1065  // Inference - event relationship
1067  EmptyOptional(),
1068  inferenceGuid,
1069  inferenceEOLEventGuid,
1071  readableData,
1072  offset);
1073  BOOST_TEST_MESSAGE("INFERENCE - END OF LIFE EVENT RELATIONSHIP OK");
1074 
1075  bufferManager.MarkRead(inferenceReadableBuffer);
1076 }
static ARMNN_DLLEXPORT ProfilingStaticGuid INFERENCE_GUID
profiling::ProfilingService & GetProfilingService(armnn::RuntimeImpl *runtime)
Definition: TestUtils.cpp:35
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:62
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:340
int NetworkId
Definition: IRuntime.hpp:20
Copyright (c) 2021 ARM Limited and Contributors.
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:306
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:1502
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:314
std::vector< std::pair< LayerBindingId, class Tensor > > OutputTensors
Definition: Tensor.hpp:341
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:174
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:173
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:84
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:510
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 1078 of file RuntimeTests.cpp.

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

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