ArmNN
 21.02
RuntimeTests.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include <armnn/Descriptors.hpp>
7 #include <armnn/IRuntime.hpp>
8 #include <armnn/INetwork.hpp>
9 #include <Processes.hpp>
10 #include <Runtime.hpp>
11 #include <armnn/TypesUtils.hpp>
12 
15 
16 #include <HeapProfiling.hpp>
17 #include <LeakChecking.hpp>
18 
19 #ifdef WITH_VALGRIND
20 #include <valgrind/memcheck.h>
21 #endif
22 
23 #include <boost/test/unit_test.hpp>
24 #include "RuntimeTests.hpp"
25 #include "TestUtils.hpp"
26 
27 namespace armnn
28 {
29 
31 {
32  runtime->m_LoadedNetworks.reserve(1);
33 }
34 
35 }
36 
37 BOOST_AUTO_TEST_SUITE(Runtime)
38 
39 BOOST_AUTO_TEST_CASE(RuntimeUnloadNetwork)
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 }
63 
64 // Note: the current builds we don't do valgrind and gperftools based leak checking at the same
65 // time, so in practice WITH_VALGRIND and ARMNN_LEAK_CHECKING_ENABLED are exclusive. The
66 // valgrind tests can stay for x86 builds, but on hikey Valgrind is just way too slow
67 // to be integrated into the CI system.
68 
69 #ifdef ARMNN_LEAK_CHECKING_ENABLED
70 
71 struct DisableGlobalLeakChecking
72 {
73  DisableGlobalLeakChecking()
74  {
76  }
77 };
78 
79 BOOST_GLOBAL_FIXTURE(DisableGlobalLeakChecking);
80 
81 BOOST_AUTO_TEST_CASE(RuntimeHeapMemoryUsageSanityChecks)
82 {
83  BOOST_TEST(ARMNN_LEAK_CHECKER_IS_ACTIVE());
84  {
85  ARMNN_SCOPED_LEAK_CHECKER("Sanity_Check_Outer");
86  {
87  ARMNN_SCOPED_LEAK_CHECKER("Sanity_Check_Inner");
88  BOOST_TEST(ARMNN_NO_LEAKS_IN_SCOPE() == true);
89  std::unique_ptr<char[]> dummyAllocation(new char[1000]);
90  BOOST_CHECK_MESSAGE(ARMNN_NO_LEAKS_IN_SCOPE() == false,
91  "A leak of 1000 bytes is expected here. "
92  "Please make sure environment variable: HEAPCHECK=draconian is set!");
93  BOOST_TEST(ARMNN_BYTES_LEAKED_IN_SCOPE() == 1000);
94  BOOST_TEST(ARMNN_OBJECTS_LEAKED_IN_SCOPE() == 1);
95  }
96  BOOST_TEST(ARMNN_NO_LEAKS_IN_SCOPE());
97  BOOST_TEST(ARMNN_BYTES_LEAKED_IN_SCOPE() == 0);
98  BOOST_TEST(ARMNN_OBJECTS_LEAKED_IN_SCOPE() == 0);
99  }
100 }
101 
102 #endif // ARMNN_LEAK_CHECKING_ENABLED
103 
104 // Note: this part of the code is due to be removed when we fully trust the gperftools based results.
105 #ifdef WITH_VALGRIND
106 // Run with the following command to get all the amazing output (in the devenv/build folder) :)
107 // valgrind --leak-check=full --show-leak-kinds=all --log-file=Valgrind_Memcheck_Leak_Report.txt armnn/test/UnitTests
108 BOOST_AUTO_TEST_CASE(RuntimeMemoryLeak)
109 {
110  // From documentation:
111 
112  // This means that no pointer to the block can be found. The block is classified as "lost",
113  // because the programmer could not possibly have freed it at program exit, since no pointer to it exists.
114  unsigned long leakedBefore = 0;
115  unsigned long leakedAfter = 0;
116 
117  // A start-pointer or chain of start-pointers to the block is found. Since the block is still pointed at,
118  // the programmer could, at least in principle, have freed it before program exit.
119  // We want to test this in case memory is not freed as early as it could have been.
120  unsigned long reachableBefore = 0;
121  unsigned long reachableAfter = 0;
122 
123  // Needed as out params but we don't test them.
124  unsigned long dubious = 0;
125  unsigned long suppressed = 0;
126 
127  armnn::NetworkId networkIdentifier1 = 1;
128 
129  // ensure that runtime is large enough before checking for memory leaks
130  // otherwise when loading the network it will automatically reserve memory that won't be released until destruction
132  armnn::RuntimeImpl runtime(options);
134 
135  {
136  std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
137 
139  mockNetwork1->AddInputLayer(0, "test layer");
140 
141  // Warm-up load/unload pair to put the runtime in a stable state (memory-wise).
142  runtime.LoadNetwork(networkIdentifier1, Optimize(*mockNetwork1, backends, runtime.GetDeviceSpec()));
143  runtime.UnloadNetwork(networkIdentifier1);
144 
145  // Checks for leaks before we load the network and record them so that we can see the delta after unloading.
146  VALGRIND_DO_QUICK_LEAK_CHECK;
147  VALGRIND_COUNT_LEAKS(leakedBefore, dubious, reachableBefore, suppressed);
148 
149  // The actual test.
150  runtime.LoadNetwork(networkIdentifier1, Optimize(*mockNetwork1, backends, runtime.GetDeviceSpec()));
151  runtime.UnloadNetwork(networkIdentifier1);
152 
153  VALGRIND_DO_ADDED_LEAK_CHECK;
154  VALGRIND_COUNT_LEAKS(leakedAfter, dubious, reachableAfter, suppressed);
155  }
156 
157  // If we're not running under Valgrind, these vars will have been initialised to 0, so this will always pass.
158  BOOST_TEST(leakedBefore == leakedAfter);
159  BOOST_TEST(reachableBefore == reachableAfter);
160 
161  // These are needed because VALGRIND_COUNT_LEAKS is a macro that assigns to the parameters
162  // so they are assigned to, but still considered unused, causing a warning.
163  IgnoreUnused(dubious);
164  IgnoreUnused(suppressed);
165 }
166 #endif // WITH_VALGRIND
167 
168 BOOST_AUTO_TEST_CASE(RuntimeCpuRef)
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 }
201 
202 BOOST_AUTO_TEST_CASE(RuntimeFallbackToCpuRef)
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 }
236 
237 BOOST_AUTO_TEST_CASE(IVGCVSW_1929_QuantizedSoftmaxIssue)
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 }
281 
282 BOOST_AUTO_TEST_CASE(RuntimeBackendOptions)
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 }
329 
330 BOOST_AUTO_TEST_CASE(ProfilingDisable)
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 }
370 
371 BOOST_AUTO_TEST_CASE(ProfilingEnableCpuRef)
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
438  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
456  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
474  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
493  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
494  EmptyOptional(),
495  input->GetGuid(),
496  inputLabelGuid,
498  readableData,
499  offset);
500  BOOST_TEST_MESSAGE("INPUT NAME RELATIONSHIP OK");
501 
502  // Entity - Type relationship
503  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
504  EmptyOptional(),
505  input->GetGuid(),
508  readableData,
509  offset);
510  BOOST_TEST_MESSAGE("INPUT TYPE RELATIONSHIP OK");
511 
512  // Network - Input layer relationship
513  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
533  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
543  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
544  EmptyOptional(),
545  normalize->GetGuid(),
548  readableData,
549  offset);
550  BOOST_TEST_MESSAGE("NORMALIZATION LAYER TYPE RELATIONSHIP OK");
551 
552  // Network - Normalize layer relationship
553  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
563  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
579  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
594  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
604  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
624  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
634  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
635  EmptyOptional(),
636  output->GetGuid(),
639  readableData,
640  offset);
641  BOOST_TEST_MESSAGE("OUTPUT LAYER TYPE RELATIONSHIP OK");
642 
643  // Network - Output layer relationship
644  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
654  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
712  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
727  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
737  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
767  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
781  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
791  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
821  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
831  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
847  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
864  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
874  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
884  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
899  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
914  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
930  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
940  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
950  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
966  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
982  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
998  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
1008  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
1018  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
1034  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
1050  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
1066  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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 }
1077 
1078 BOOST_AUTO_TEST_CASE(ProfilingPostOptimisationStructureCpuRef)
1079 {
1081 }
1082 
#define ARMNN_SCOPED_LEAK_CHECKER(TAG)
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
static ARMNN_DLLEXPORT ProfilingStaticGuid INFERENCE_GUID
profiling::ProfilingService & GetProfilingService(armnn::RuntimeImpl *runtime)
Definition: TestUtils.cpp:35
#define ARMNN_LOCAL_LEAK_CHECKING_ONLY()
TensorInfo GetInputTensorInfo(NetworkId networkId, LayerBindingId layerId) const
Definition: Runtime.cpp:372
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
ProfilingGuid VerifyTimelineEntityBinaryPacketData(Optional< ProfilingGuid > guid, const unsigned char *readableData, unsigned int &offset)
void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId)
CPU Execution: Reference C++ kernels.
void ForceTransitionToState(ProfilingState newState)
Status UnloadNetwork(NetworkId networkId)
Unloads a network from the Runtime.
Definition: Runtime.cpp:168
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:26
Status LoadNetwork(NetworkId &networkIdOut, IOptimizedNetworkPtr network)
Loads a complete network into the Runtime.
Definition: Runtime.cpp:109
std::vector< std::pair< LayerBindingId, class ConstTensor > > InputTensors
Definition: Tensor.hpp:340
TensorInfo GetOutputTensorInfo(NetworkId networkId, LayerBindingId layerId) const
Definition: Runtime.cpp:377
int NetworkId
Definition: IRuntime.hpp:20
Copyright (c) 2021 ARM Limited and Contributors.
Status EnqueueWorkload(NetworkId networkId, const InputTensors &inputTensors, const OutputTensors &outputTensors)
Definition: Runtime.cpp:383
void IgnoreUnused(Ts &&...)
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
#define ARMNN_LEAK_CHECKER_IS_ACTIVE()
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
#define ARMNN_OBJECTS_LEAKED_IN_SCOPE()
std::vector< BackendOptions > m_BackendOptions
Pass backend specific options.
Definition: IRuntime.hpp:116
const char * GetBackendId()
static ARMNN_DLLEXPORT ProfilingStaticGuid LAYER_GUID
void RuntimeLoadedNetworksReserve(armnn::RuntimeImpl *runtime)
void AddOption(BackendOption &&option)
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)
const IDeviceSpec & GetDeviceSpec() const
Definition: Runtime.hpp:70
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)
BOOST_AUTO_TEST_CASE(CheckConvolution2dLayer)
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
Struct for the users to pass backend specific options.
BOOST_AUTO_TEST_SUITE_END()
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
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: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
A SoftmaxDescriptor for the SoftmaxLayer.
#define ARMNN_BYTES_LEAKED_IN_SCOPE()
static ARMNN_DLLEXPORT ProfilingStaticGuid BACKENDID_GUID
static ARMNN_DLLEXPORT ProfilingStaticGuid CHILD_GUID
BOOST_GLOBAL_FIXTURE(ConfigureLoggingFixture)