ArmNN
 20.08
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 
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::Runtime runtime(options);
134 
135  {
136  std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
137 
138  std::unique_ptr<armnn::Network> mockNetwork1 = std::make_unique<armnn::Network>();
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;
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 }
277 
278 BOOST_AUTO_TEST_CASE(RuntimeBackendOptions)
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 }
325 
326 BOOST_AUTO_TEST_CASE(ProfilingDisable)
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 }
366 
367 BOOST_AUTO_TEST_CASE(ProfilingEnableCpuRef)
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
434  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
452  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
470  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
489  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
490  EmptyOptional(),
491  input->GetGuid(),
492  inputLabelGuid,
494  readableData,
495  offset);
496  BOOST_TEST_MESSAGE("INPUT NAME RELATIONSHIP OK");
497 
498  // Entity - Type relationship
499  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
500  EmptyOptional(),
501  input->GetGuid(),
504  readableData,
505  offset);
506  BOOST_TEST_MESSAGE("INPUT TYPE RELATIONSHIP OK");
507 
508  // Network - Input layer relationship
509  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
529  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
539  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
540  EmptyOptional(),
541  normalize->GetGuid(),
544  readableData,
545  offset);
546  BOOST_TEST_MESSAGE("NORMALIZATION LAYER TYPE RELATIONSHIP OK");
547 
548  // Network - Normalize layer relationship
549  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
559  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
575  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
590  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
600  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
620  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
630  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
631  EmptyOptional(),
632  output->GetGuid(),
635  readableData,
636  offset);
637  BOOST_TEST_MESSAGE("OUTPUT LAYER TYPE RELATIONSHIP OK");
638 
639  // Network - Output layer relationship
640  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
650  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
708  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
723  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
733  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
763  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
777  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
787  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
817  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
827  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
843  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
860  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
870  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
880  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
895  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
910  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
926  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
936  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
946  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
962  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
978  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
994  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
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
1004  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
1014  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
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
1030  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
1046  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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
1062  VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
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 }
1073 
1074 BOOST_AUTO_TEST_CASE(ProfilingPostOptimisationStructureCpuRef)
1075 {
1077 }
1078 
#define ARMNN_SCOPED_LEAK_CHECKER(TAG)
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
static ARMNN_DLLEXPORT ProfilingStaticGuid INFERENCE_GUID
virtual TensorInfo GetOutputTensorInfo(NetworkId networkId, LayerBindingId layerId) const override
Definition: Runtime.cpp:315
#define ARMNN_LOCAL_LEAK_CHECKING_ONLY()
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
ProfilingGuid VerifyTimelineEntityBinaryPacketData(Optional< ProfilingGuid > guid, const unsigned char *readableData, unsigned int &offset)
void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId)
CPU Execution: Reference C++ kernels.
virtual const IDeviceSpec & GetDeviceSpec() const override
Definition: Runtime.hpp:71
void ForceTransitionToState(ProfilingState newState)
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:25
std::vector< std::pair< LayerBindingId, class ConstTensor > > InputTensors
Definition: Tensor.hpp:324
int NetworkId
Definition: IRuntime.hpp:20
Copyright (c) 2020 ARM Limited.
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:290
#define ARMNN_OBJECTS_LEAKED_IN_SCOPE()
std::vector< BackendOptions > m_BackendOptions
Pass backend specific options.
Definition: IRuntime.hpp:115
const char * GetBackendId()
static ARMNN_DLLEXPORT ProfilingStaticGuid LAYER_GUID
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: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)
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
virtual Status LoadNetwork(NetworkId &networkIdOut, IOptimizedNetworkPtr network) override
Loads a complete network into the Runtime.
Definition: Runtime.cpp:47
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.
virtual Status UnloadNetwork(NetworkId networkId) override
Unloads a network from the Runtime.
Definition: Runtime.cpp:106
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
virtual Status EnqueueWorkload(NetworkId networkId, const InputTensors &inputTensors, const OutputTensors &outputTensors) override
Evaluates a network using input in inputTensors and outputs filled into outputTensors.
Definition: Runtime.cpp:321
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:50
A SoftmaxDescriptor for the SoftmaxLayer.
#define ARMNN_BYTES_LEAKED_IN_SCOPE()
static ARMNN_DLLEXPORT ProfilingStaticGuid BACKENDID_GUID
void RuntimeLoadedNetworksReserve(armnn::Runtime *runtime)
static ARMNN_DLLEXPORT ProfilingStaticGuid CHILD_GUID
virtual TensorInfo GetInputTensorInfo(NetworkId networkId, LayerBindingId layerId) const override
Definition: Runtime.cpp:310
BOOST_GLOBAL_FIXTURE(ConfigureLoggingFixture)