blob: dd54ca9ebcf0984fc12a6c42e5912eea45eef29e [file] [log] [blame]
Narumol Prangnawaratdf31cfe2019-11-22 11:26:06 +00001//
2// Copyright © 2019 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include "ProfilingTestUtils.hpp"
7#include "ProfilingUtils.hpp"
8
9#include <armnn/Descriptors.hpp>
10#include <LabelsAndEventClasses.hpp>
11#include <ProfilingService.hpp>
12
13#include <boost/test/unit_test.hpp>
14
15inline unsigned int OffsetToNextWord(unsigned int numberOfBytes)
16{
17 unsigned int uint32_t_size = sizeof(uint32_t);
18
19 unsigned int remainder = numberOfBytes % uint32_t_size;
20 if (remainder == 0)
21 {
22 return numberOfBytes;
23 }
24
25 return numberOfBytes + uint32_t_size - remainder;
26}
27
28void VerifyTimelineLabelBinaryPacket(Optional<ProfilingGuid> guid,
29 const std::string& label,
30 const unsigned char* readableData,
31 unsigned int& offset)
32{
33 BOOST_ASSERT(readableData);
34
35 // Utils
36 unsigned int uint32_t_size = sizeof(uint32_t);
37 unsigned int uint64_t_size = sizeof(uint64_t);
38 unsigned int label_size = boost::numeric_cast<unsigned int>(label.size());
39
40 // Check the TimelineLabelBinaryPacket header
41 uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
42 uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
43 uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
44 uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
45 uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >> 0) & 0x00000007;
46 BOOST_CHECK(entityBinaryPacketFamily == 1);
47 BOOST_CHECK(entityBinaryPacketClass == 0);
48 BOOST_CHECK(entityBinaryPacketType == 1);
49 BOOST_CHECK(entityBinaryPacketStreamId == 0);
50 offset += uint32_t_size;
51 uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(readableData, offset);
52 uint32_t eventBinaryPacketSequenceNumber = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
53 uint32_t eventBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
54 BOOST_CHECK(eventBinaryPacketSequenceNumber == 0);
55 BOOST_CHECK(eventBinaryPacketDataLength == 16 + OffsetToNextWord(label_size + 1));
56
57 // Check the decl id
58 offset += uint32_t_size;
59 uint32_t eventClassDeclId = ReadUint32(readableData, offset);
60 BOOST_CHECK(eventClassDeclId == 0);
61
62 // Check the profiling GUID
63 offset += uint32_t_size;
64 uint64_t readProfilingGuid = ReadUint64(readableData, offset);
65 if (guid.has_value())
66 {
67 BOOST_CHECK(readProfilingGuid == guid.value());
68 }
69 else
70 {
71 BOOST_CHECK(readProfilingGuid == ProfilingService::Instance().GenerateStaticId(label));
72 }
73
74 // Check the SWTrace label
75 offset += uint64_t_size;
76 uint32_t swTraceLabelLength = ReadUint32(readableData, offset);
77 BOOST_CHECK(swTraceLabelLength == label_size + 1); // Label length including the null-terminator
78 offset += uint32_t_size;
79 BOOST_CHECK(std::memcmp(readableData + offset, // Offset to the label in the buffer
80 label.data(), // The original label
81 swTraceLabelLength - 1) == 0); // The length of the label
82 BOOST_CHECK(readableData[offset + swTraceLabelLength] == '\0'); // The null-terminator
83
84 // SWTrace strings are written in blocks of words, so the offset has to be updated to the next whole word
85 offset += OffsetToNextWord(swTraceLabelLength);
86}
87
88void VerifyTimelineEventClassBinaryPacket(ProfilingGuid guid,
89 const unsigned char* readableData,
90 unsigned int& offset)
91{
92 BOOST_ASSERT(readableData);
93
94 // Utils
95 unsigned int uint32_t_size = sizeof(uint32_t);
96 unsigned int uint64_t_size = sizeof(uint64_t);
97
98 // Check the TimelineEventClassBinaryPacket header
99 uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
100 uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
101 uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
102 uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
103 uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >> 0) & 0x00000007;
104 BOOST_CHECK(entityBinaryPacketFamily == 1);
105 BOOST_CHECK(entityBinaryPacketClass == 0);
106 BOOST_CHECK(entityBinaryPacketType == 1);
107 BOOST_CHECK(entityBinaryPacketStreamId == 0);
108 offset += uint32_t_size;
109 uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(readableData, offset);
110 uint32_t eventBinaryPacketSequenceNumber = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
111 uint32_t eventBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
112 BOOST_CHECK(eventBinaryPacketSequenceNumber == 0);
113 BOOST_CHECK(eventBinaryPacketDataLength == 12);
114
115 // Check the decl id
116 offset += uint32_t_size;
117 uint32_t eventClassDeclId = ReadUint32(readableData, offset);
118 BOOST_CHECK(eventClassDeclId == 2);
119
120 // Check the profiling GUID
121 offset += uint32_t_size;
122 uint64_t readProfilingGuid = ReadUint64(readableData, offset);
123 BOOST_CHECK(readProfilingGuid == guid);
124
125 // Update the offset to allow parsing to be continued after this function returns
126 offset += uint64_t_size;
127}
128
129void VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType relationshipType,
130 Optional<ProfilingGuid> relationshipGuid,
131 Optional<ProfilingGuid> headGuid,
132 Optional<ProfilingGuid> tailGuid,
133 const unsigned char* readableData,
134 unsigned int& offset)
135{
136 BOOST_ASSERT(readableData);
137
138 uint32_t relationshipTypeUint = 0;
139 switch (relationshipType)
140 {
141 case ProfilingRelationshipType::RetentionLink:
142 relationshipTypeUint = 0;
143 break;
144 case ProfilingRelationshipType::ExecutionLink:
145 relationshipTypeUint = 1;
146 break;
147 case ProfilingRelationshipType::DataLink:
148 relationshipTypeUint = 2;
149 break;
150 case ProfilingRelationshipType::LabelLink:
151 relationshipTypeUint = 3;
152 break;
153 default:
154 BOOST_ERROR("Unknown relationship type");
155 }
156
157 // Utils
158 unsigned int uint32_t_size = sizeof(uint32_t);
159 unsigned int uint64_t_size = sizeof(uint64_t);
160
161 // Check the TimelineLabelBinaryPacket header
162 uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
163 uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
164 uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
165 uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
166 uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >> 0) & 0x00000007;
167 BOOST_CHECK(entityBinaryPacketFamily == 1);
168 BOOST_CHECK(entityBinaryPacketClass == 0);
169 BOOST_CHECK(entityBinaryPacketType == 1);
170 BOOST_CHECK(entityBinaryPacketStreamId == 0);
171 offset += uint32_t_size;
172 uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(readableData, offset);
173 uint32_t eventBinaryPacketSequenceNumber = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
174 uint32_t eventBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
175 BOOST_CHECK(eventBinaryPacketSequenceNumber == 0);
176 BOOST_CHECK(eventBinaryPacketDataLength == 32);
177
178 // Check the decl id
179 offset += uint32_t_size;
180 uint32_t eventClassDeclId = ReadUint32(readableData, offset);
181 BOOST_CHECK(eventClassDeclId == 3);
182
183 // Check the relationship type
184 offset += uint32_t_size;
185 uint32_t readRelationshipTypeUint = ReadUint32(readableData, offset);
186 BOOST_CHECK(readRelationshipTypeUint == relationshipTypeUint);
187
188 // Check the relationship GUID
189 offset += uint32_t_size;
190 uint64_t readRelationshipGuid = ReadUint64(readableData, offset);
191 if (relationshipGuid.has_value())
192 {
193 BOOST_CHECK(readRelationshipGuid == relationshipGuid.value());
194 }
195 else
196 {
197 BOOST_CHECK(readRelationshipGuid != ProfilingGuid(0));
198 }
199
200 // Check the head of relationship GUID
201 offset += uint64_t_size;
202 uint64_t readHeadRelationshipGuid = ReadUint64(readableData, offset);
203 if (headGuid.has_value())
204 {
205 BOOST_CHECK(readHeadRelationshipGuid == headGuid.value());
206 }
207 else
208 {
209 BOOST_CHECK(readHeadRelationshipGuid != ProfilingGuid(0));
210 }
211
212 // Check the tail of relationship GUID
213 offset += uint64_t_size;
214 uint64_t readTailRelationshipGuid = ReadUint64(readableData, offset);
215 if (tailGuid.has_value())
216 {
217 BOOST_CHECK(readTailRelationshipGuid == tailGuid.value());
218 }
219 else
220 {
221 BOOST_CHECK(readTailRelationshipGuid != ProfilingGuid(0));
222 }
223
224 // Update the offset to allow parsing to be continued after this function returns
225 offset += uint64_t_size;
226}
227
228void VerifyTimelineEntityBinaryPacket(Optional<ProfilingGuid> guid,
229 const unsigned char* readableData,
230 unsigned int& offset)
231{
232 BOOST_ASSERT(readableData);
233
234 // Utils
235 unsigned int uint32_t_size = sizeof(uint32_t);
236 unsigned int uint64_t_size = sizeof(uint64_t);
237
238 // Reading TimelineEntityClassBinaryPacket
239 uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
240 uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
241 uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
242 uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
243 uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >> 0) & 0x00000007;
244
245 BOOST_CHECK(entityBinaryPacketFamily == 1);
246 BOOST_CHECK(entityBinaryPacketClass == 0);
247 BOOST_CHECK(entityBinaryPacketType == 1);
248 BOOST_CHECK(entityBinaryPacketStreamId == 0);
249
250 offset += uint32_t_size;
251 uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(readableData, offset);
252 uint32_t entityBinaryPacketSequenceNumbered = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
253 uint32_t entityBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
254 BOOST_CHECK(entityBinaryPacketSequenceNumbered == 0);
255 BOOST_CHECK(entityBinaryPacketDataLength == 12);
256
257 // Check the decl_id
258 offset += uint32_t_size;
259 uint32_t entityDeclId = ReadUint32(readableData, offset);
260 BOOST_CHECK(entityDeclId == 1);
261
262 // Check the profiling GUID
263 offset += uint32_t_size;
264 uint64_t readProfilingGuid = ReadUint64(readableData, offset);
265
266 if (guid.has_value())
267 {
268 BOOST_CHECK(readProfilingGuid == guid.value());
269 }
270 else
271 {
272 BOOST_CHECK(readProfilingGuid != ProfilingGuid(0));
273 }
274
275 offset += uint64_t_size;
276}
277
278void VerifyTimelineEventBinaryPacket(Optional<uint64_t> timestamp,
279 Optional<std::thread::id> threadId,
280 Optional<ProfilingGuid> eventGuid,
281 const unsigned char* readableData,
282 unsigned int& offset)
283{
284 BOOST_ASSERT(readableData);
285
286 // Utils
287 unsigned int uint32_t_size = sizeof(uint32_t);
288 unsigned int uint64_t_size = sizeof(uint64_t);
289 unsigned int threadId_size = sizeof(std::thread::id);
290
291 // Reading TimelineEventBinaryPacket
292 uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
293 uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
294 uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
295 uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
296 uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >> 0) & 0x00000007;
297
298 BOOST_CHECK(entityBinaryPacketFamily == 1);
299 BOOST_CHECK(entityBinaryPacketClass == 0);
300 BOOST_CHECK(entityBinaryPacketType == 1);
301 BOOST_CHECK(entityBinaryPacketStreamId == 0);
302
303 offset += uint32_t_size;
304 uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(readableData, offset);
305 uint32_t entityBinaryPacketSequenceNumbered = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
306 uint32_t entityBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
307 BOOST_CHECK(entityBinaryPacketSequenceNumbered == 0);
308 BOOST_CHECK(entityBinaryPacketDataLength == 20 + threadId_size);
309
310 // Check the decl_id
311 offset += uint32_t_size;
312 uint32_t entityDeclId = ReadUint32(readableData, offset);
313 BOOST_CHECK(entityDeclId == 4);
314
315 // Check the timestamp
316 offset += uint32_t_size;
317 uint64_t readTimestamp = ReadUint64(readableData, offset);
318 if (timestamp.has_value())
319 {
320 BOOST_CHECK(readTimestamp == timestamp.value());
321 }
322 else
323 {
324 BOOST_CHECK(readTimestamp != 0);
325 }
326
327 // Check the thread id
328 offset += uint64_t_size;
329 std::vector<uint8_t> readThreadId(threadId_size, 0);
330 ReadBytes(readableData, offset, threadId_size, readThreadId.data());
331 if (threadId.has_value())
332 {
333 BOOST_CHECK(readThreadId == threadId.value());
334 }
335 else
336 {
337 BOOST_CHECK(readThreadId == std::this_thread::get_id());
338 }
339
340 // Check the event GUID
341 offset += threadId_size;
342 uint64_t readEventGuid = ReadUint64(readableData, offset);
343 if (eventGuid.has_value())
344 {
345 BOOST_CHECK(readEventGuid == eventGuid.value());
346 }
347 else
348 {
349 BOOST_CHECK(readEventGuid != ProfilingGuid(0));
350 }
351
352 offset += uint64_t_size;
353}
354
355void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId)
356{
357 using namespace armnn;
358
359 // Create runtime in which test will run
360 armnn::IRuntime::CreationOptions options;
361 options.m_ProfilingOptions.m_EnableProfiling = true;
David Monahanc1536d62020-02-12 15:52:35 +0000362 armnn::profiling::ProfilingService& profilingService = armnn::profiling::ProfilingService::Instance();
363 profilingService.ConfigureProfilingService(options.m_ProfilingOptions, true);
Narumol Prangnawaratdf31cfe2019-11-22 11:26:06 +0000364 armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
365
366 // build up the structure of the network
367 INetworkPtr net(INetwork::Create());
368
369 // Convolution details
370 TensorInfo inputInfo({ 1, 2, 5, 1 }, DataType::Float32);
371 TensorInfo weightInfo({ 3, 2, 3, 1}, DataType::Float32);
372 TensorInfo biasInfo({ 3 }, DataType::Float32);
373 TensorInfo outputInfo({ 1, 3, 7, 1}, DataType::Float32);
374 std::vector<float> weightsData{
375 1.0f, 0.0f, 0.0f,
376 0.0f, 2.0f, -1.5f,
377
378 0.0f, 0.0f, 0.0f,
379 0.2f, 0.2f, 0.2f,
380
381 0.5f, 0.0f, 0.5f,
382 0.0f, -1.0f, 0.0f
383 };
384 ConstTensor weights(weightInfo, weightsData);
385
386 Optional<ConstTensor> optionalBiases;
387 std::vector<float> biasesData{ 1.0f, 0.0f, 0.0f };
388 ConstTensor biases(biasInfo, biasesData);
389 optionalBiases = Optional<ConstTensor>(biases);
390
391 // Input layer
392 IConnectableLayer* input = net->AddInputLayer(0, "input");
393
394 // Convolution2d layer
395 Convolution2dDescriptor conv2dDesc;
396 conv2dDesc.m_StrideX = 1;
397 conv2dDesc.m_StrideY = 1;
398 conv2dDesc.m_PadLeft = 0;
399 conv2dDesc.m_PadRight = 0;
400 conv2dDesc.m_PadTop = 2;
401 conv2dDesc.m_PadBottom = 2;
402 conv2dDesc.m_BiasEnabled = true;
403 IConnectableLayer* conv2d = net->AddConvolution2dLayer(conv2dDesc, weights, optionalBiases);
404
405 // Activation layer
406 armnn::ActivationDescriptor activationDesc;
407 armnn::IConnectableLayer* const activation = net->AddActivationLayer(activationDesc, "activation");
408
409 // Output layer
410 IConnectableLayer* output = net->AddOutputLayer(0, "output");
411
412 input->GetOutputSlot(0).Connect(conv2d->GetInputSlot(0));
413 conv2d->GetOutputSlot(0).Connect(activation->GetInputSlot(0));
414 activation->GetOutputSlot(0).Connect(output->GetInputSlot(0));
415
416 input->GetOutputSlot(0).SetTensorInfo(inputInfo);
417 conv2d->GetOutputSlot(0).SetTensorInfo(outputInfo);
418 activation->GetOutputSlot(0).SetTensorInfo(outputInfo);
419
420 // optimize the network
421 std::vector<armnn::BackendId> backends = { backendId };
422 IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec());
423
424 ProfilingGuid optNetGuid = optNet->GetGuid();
425
426 // Load it into the runtime. It should success.
427 armnn::NetworkId netId;
428 BOOST_TEST(runtime->LoadNetwork(netId, std::move(optNet)) == Status::Success);
429
430 profiling::ProfilingServiceRuntimeHelper profilingServiceHelper;
431 profiling::BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager();
432 auto readableBuffer = bufferManager.GetReadableBuffer();
433
434 // Profiling is enable, the post-optimisation structure should be created
435 BOOST_CHECK(readableBuffer != nullptr);
436
437 unsigned int size = readableBuffer->GetSize();
438 BOOST_CHECK(size == 1980);
439
440 const unsigned char* readableData = readableBuffer->GetReadableData();
441 BOOST_CHECK(readableData != nullptr);
442
443 unsigned int offset = 0;
444
445 // Post-optimisation network
446 // Network entity
447 VerifyTimelineEntityBinaryPacket(optNetGuid, readableData, offset);
448
449 // Entity - Type relationship
450 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
451 EmptyOptional(),
452 optNetGuid,
453 EmptyOptional(),
454 readableData,
455 offset);
456
457 // Type label relationship
458 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
459 EmptyOptional(),
460 EmptyOptional(),
461 LabelsAndEventClasses::TYPE_GUID,
462 readableData,
463 offset);
464
465 // Input layer
466 // Input layer entity
467 VerifyTimelineEntityBinaryPacket(input->GetGuid(), readableData, offset);
468
469 // Name Entity
470 VerifyTimelineLabelBinaryPacket(EmptyOptional(), "input", readableData, offset);
471
472 // Entity - Name relationship
473 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
474 EmptyOptional(),
475 input->GetGuid(),
476 EmptyOptional(),
477 readableData,
478 offset);
479
480 // Name label relationship
481 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
482 EmptyOptional(),
483 EmptyOptional(),
484 LabelsAndEventClasses::NAME_GUID,
485 readableData,
486 offset);
487
488 // Entity - Type relationship
489 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
490 EmptyOptional(),
491 input->GetGuid(),
492 EmptyOptional(),
493 readableData,
494 offset);
495
496 // Type label relationship
497 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
498 EmptyOptional(),
499 EmptyOptional(),
500 LabelsAndEventClasses::TYPE_GUID,
501 readableData,
502 offset);
503
504 // Network - Input layer relationship
505 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
506 EmptyOptional(),
507 optNetGuid,
508 input->GetGuid(),
509 readableData,
510 offset);
511
512 // Conv2d layer
513 // Conv2d layer entity
514 VerifyTimelineEntityBinaryPacket(conv2d->GetGuid(), readableData, offset);
515
516 // Name entity
517 VerifyTimelineLabelBinaryPacket(EmptyOptional(), "<Unnamed>", readableData, offset);
518
519 // Entity - Name relationship
520 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
521 EmptyOptional(),
522 conv2d->GetGuid(),
523 EmptyOptional(),
524 readableData,
525 offset);
526
527 // Name label relationship
528 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
529 EmptyOptional(),
530 EmptyOptional(),
531 LabelsAndEventClasses::NAME_GUID,
532 readableData,
533 offset);
534
535 // Entity - Type relationship
536 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
537 EmptyOptional(),
538 conv2d->GetGuid(),
539 EmptyOptional(),
540 readableData,
541 offset);
542
543 // Type label relationship
544 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
545 EmptyOptional(),
546 EmptyOptional(),
547 LabelsAndEventClasses::TYPE_GUID,
548 readableData,
549 offset);
550
551 // Network - Conv2d layer relationship
552 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
553 EmptyOptional(),
554 optNetGuid,
555 conv2d->GetGuid(),
556 readableData,
557 offset);
558
559 // Input layer - Conv2d layer relationship
560 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
561 EmptyOptional(),
562 input->GetGuid(),
563 conv2d->GetGuid(),
564 readableData,
565 offset);
566
567 // Entity - Type relationship
568 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
569 EmptyOptional(),
570 EmptyOptional(),
571 LabelsAndEventClasses::CONNECTION_GUID,
572 readableData,
573 offset);
574
575 // Type label relationship
576 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
577 EmptyOptional(),
578 EmptyOptional(),
579 LabelsAndEventClasses::TYPE_GUID,
580 readableData,
581 offset);
582
583 // Conv2d workload
584 // Conv2d workload entity
585 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
586
587 // Entity - Type relationship
588 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
589 EmptyOptional(),
590 EmptyOptional(),
591 EmptyOptional(),
592 readableData,
593 offset);
594
595 // Type label relationship
596 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
597 EmptyOptional(),
598 EmptyOptional(),
599 LabelsAndEventClasses::TYPE_GUID,
600 readableData,
601 offset);
602
603 // BackendId entity
604 VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
605
606 // Entity - BackendId relationship
607 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
608 EmptyOptional(),
609 EmptyOptional(),
610 EmptyOptional(),
611 readableData,
612 offset);
613
614 // BackendId label relationship
615 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
616 EmptyOptional(),
617 EmptyOptional(),
618 LabelsAndEventClasses::BACKENDID_GUID,
619 readableData,
620 offset);
621
622 // Conv2d layer - Conv2d workload relationship
623 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
624 EmptyOptional(),
625 conv2d->GetGuid(),
626 EmptyOptional(),
627 readableData,
628 offset);
629
630 // Activation layer
631 // Activation layer entity
632 VerifyTimelineEntityBinaryPacket(activation->GetGuid(), readableData, offset);
633
634 // Name entity
635 VerifyTimelineLabelBinaryPacket(EmptyOptional(), "activation", readableData, offset);
636
637 // Entity - Name relationship
638 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
639 EmptyOptional(),
640 activation->GetGuid(),
641 EmptyOptional(),
642 readableData,
643 offset);
644
645 // Name label relationship
646 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
647 EmptyOptional(),
648 EmptyOptional(),
649 LabelsAndEventClasses::NAME_GUID,
650 readableData,
651 offset);
652
653 // Entity - Type relationship
654 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
655 EmptyOptional(),
656 activation->GetGuid(),
657 EmptyOptional(),
658 readableData,
659 offset);
660
661 // Type label relationship
662 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
663 EmptyOptional(),
664 EmptyOptional(),
665 LabelsAndEventClasses::TYPE_GUID,
666 readableData,
667 offset);
668
669 // Network - Activation layer relationship
670 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
671 EmptyOptional(),
672 optNetGuid,
673 activation->GetGuid(),
674 readableData,
675 offset);
676
677 // Conv2d layer - Activation layer relationship
678 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
679 EmptyOptional(),
680 conv2d->GetGuid(),
681 activation->GetGuid(),
682 readableData,
683 offset);
684
685 // Entity - Type relationship
686 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
687 EmptyOptional(),
688 EmptyOptional(),
689 LabelsAndEventClasses::CONNECTION_GUID,
690 readableData,
691 offset);
692
693 // Type label relationship
694 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
695 EmptyOptional(),
696 EmptyOptional(),
697 LabelsAndEventClasses::TYPE_GUID,
698 readableData,
699 offset);
700
701 // Activation workload
702 // Activation workload entity
703 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
704
705 // Entity - Type relationship
706 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
707 EmptyOptional(),
708 EmptyOptional(),
709 EmptyOptional(),
710 readableData,
711 offset);
712
713 // Type label relationship
714 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
715 EmptyOptional(),
716 EmptyOptional(),
717 LabelsAndEventClasses::TYPE_GUID,
718 readableData,
719 offset);
720
721 // BackendId entity
722 VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
723
724 // Entity - BackendId relationship
725 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
726 EmptyOptional(),
727 EmptyOptional(),
728 EmptyOptional(),
729 readableData,
730 offset);
731
732 // BackendId label relationship
733 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
734 EmptyOptional(),
735 EmptyOptional(),
736 LabelsAndEventClasses::BACKENDID_GUID,
737 readableData,
738 offset);
739
740 // Activation layer - Activation workload relationship
741 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
742 EmptyOptional(),
743 activation->GetGuid(),
744 EmptyOptional(),
745 readableData,
746 offset);
747
748 // Output layer
749 // Output layer entity
750 VerifyTimelineEntityBinaryPacket(output->GetGuid(), readableData, offset);
751
752 // Name entity
753 VerifyTimelineLabelBinaryPacket(EmptyOptional(), "output", readableData, offset);
754
755 // Entity - Name relationship
756 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
757 EmptyOptional(),
758 output->GetGuid(),
759 EmptyOptional(),
760 readableData,
761 offset);
762
763 // Name label relationship
764 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
765 EmptyOptional(),
766 EmptyOptional(),
767 LabelsAndEventClasses::NAME_GUID,
768 readableData,
769 offset);
770
771 // Entity - Type relationship
772 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
773 EmptyOptional(),
774 output->GetGuid(),
775 EmptyOptional(),
776 readableData,
777 offset);
778
779 // Type label relationship
780 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
781 EmptyOptional(),
782 EmptyOptional(),
783 LabelsAndEventClasses::TYPE_GUID,
784 readableData,
785 offset);
786
787 // Network - Output layer relationship
788 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
789 EmptyOptional(),
790 optNetGuid,
791 output->GetGuid(),
792 readableData,
793 offset);
794
795 // Activation layer - Output layer relationship
796 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
797 EmptyOptional(),
798 activation->GetGuid(),
799 output->GetGuid(),
800 readableData,
801 offset);
802
803 // Entity - Type relationship
804 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
805 EmptyOptional(),
806 EmptyOptional(),
807 LabelsAndEventClasses::CONNECTION_GUID,
808 readableData,
809 offset);
810
811 // Type label relationship
812 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
813 EmptyOptional(),
814 EmptyOptional(),
815 LabelsAndEventClasses::TYPE_GUID,
816 readableData,
817 offset);
818
819 bufferManager.MarkRead(readableBuffer);
Narumol Prangnawarataa68e012019-11-29 17:17:43 +0000820
821 // Creates structures for input & output.
822 std::vector<float> inputData(inputInfo.GetNumElements());
823 std::vector<float> outputData(outputInfo.GetNumElements());
824
825 InputTensors inputTensors
826 {
827 {0, ConstTensor(runtime->GetInputTensorInfo(netId, 0), inputData.data())}
828 };
829 OutputTensors outputTensors
830 {
831 {0, Tensor(runtime->GetOutputTensorInfo(netId, 0), outputData.data())}
832 };
833
834 // Does the inference.
835 runtime->EnqueueWorkload(netId, inputTensors, outputTensors);
836
David Monahan6198fe02019-12-02 08:35:43 +0000837 // Get readable buffer for inference timeline
838 auto inferenceReadableBuffer = bufferManager.GetReadableBuffer();
839 BOOST_CHECK(inferenceReadableBuffer != nullptr);
840
Narumol Prangnawarataa68e012019-11-29 17:17:43 +0000841 // Get readable buffer for output workload
842 auto outputReadableBuffer = bufferManager.GetReadableBuffer();
843 BOOST_CHECK(outputReadableBuffer != nullptr);
844
845 // Get readable buffer for input workload
846 auto inputReadableBuffer = bufferManager.GetReadableBuffer();
847 BOOST_CHECK(inputReadableBuffer != nullptr);
848
849 // Validate input workload data
850 size = inputReadableBuffer->GetSize();
851 BOOST_CHECK(size == 252);
852
853 readableData = inputReadableBuffer->GetReadableData();
854 BOOST_CHECK(readableData != nullptr);
855
856 offset = 0;
857
858 // Input workload
859 // Input workload entity
860 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
861
862 // Entity - Type relationship
863 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
864 EmptyOptional(),
865 EmptyOptional(),
866 EmptyOptional(),
867 readableData,
868 offset);
869
870 // Type label relationship
871 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
872 EmptyOptional(),
873 EmptyOptional(),
874 LabelsAndEventClasses::TYPE_GUID,
875 readableData,
876 offset);
877
878 // BackendId entity
879 VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
880
881 // Entity - BackendId relationship
882 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
883 EmptyOptional(),
884 EmptyOptional(),
885 EmptyOptional(),
886 readableData,
887 offset);
888
889 // BackendId label relationship
890 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
891 EmptyOptional(),
892 EmptyOptional(),
893 LabelsAndEventClasses::BACKENDID_GUID,
894 readableData,
895 offset);
896
897 // Input layer - Input workload relationship
898 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
899 EmptyOptional(),
900 input->GetGuid(),
901 EmptyOptional(),
902 readableData,
903 offset);
904
905 bufferManager.MarkRead(inputReadableBuffer);
906
907 // Validate output workload data
908 size = outputReadableBuffer->GetSize();
909 BOOST_CHECK(size == 252);
910
911 readableData = outputReadableBuffer->GetReadableData();
912 BOOST_CHECK(readableData != nullptr);
913
914 offset = 0;
915
916 // Output workload
917 // Output workload entity
918 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
919
920 // Entity - Type relationship
921 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
922 EmptyOptional(),
923 EmptyOptional(),
924 EmptyOptional(),
925 readableData,
926 offset);
927
928 // Type label relationship
929 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
930 EmptyOptional(),
931 EmptyOptional(),
932 LabelsAndEventClasses::TYPE_GUID,
933 readableData,
934 offset);
935
936 // BackendId entity
937 VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
938
939 // Entity - BackendId relationship
940 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
941 EmptyOptional(),
942 EmptyOptional(),
943 EmptyOptional(),
944 readableData,
945 offset);
946
947 // BackendId label relationship
948 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
949 EmptyOptional(),
950 EmptyOptional(),
951 LabelsAndEventClasses::BACKENDID_GUID,
952 readableData,
953 offset);
954
955 // Output layer - Output workload relationship
956 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
957 EmptyOptional(),
958 output->GetGuid(),
959 EmptyOptional(),
960 readableData,
961 offset);
962
963 bufferManager.MarkRead(outputReadableBuffer);
David Monahan6198fe02019-12-02 08:35:43 +0000964
965 // Validate inference data
966 size = inferenceReadableBuffer->GetSize();
967 BOOST_CHECK(size == 2020);
968
969 readableData = inferenceReadableBuffer->GetReadableData();
970 BOOST_CHECK(readableData != nullptr);
971
972 offset = 0;
973
974 // Inference timeline trace
975 // Inference entity
976 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
977
978 // Entity - Type relationship
979 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
980 EmptyOptional(),
981 EmptyOptional(),
982 LabelsAndEventClasses::INFERENCE_GUID,
983 readableData,
984 offset);
985
986 // Type label relationship
987 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
988 EmptyOptional(),
989 EmptyOptional(),
990 LabelsAndEventClasses::TYPE_GUID,
991 readableData,
992 offset);
993
994 // Network - Inference relationship
995 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
996 EmptyOptional(),
997 optNetGuid,
998 EmptyOptional(),
999 readableData,
1000 offset);
1001
1002 // Start Inference life
1003 // Event packet - timeline, threadId, eventGuid
1004 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1005
1006 // Inference - event relationship
1007 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1008 EmptyOptional(),
1009 EmptyOptional(),
1010 EmptyOptional(),
1011 readableData,
1012 offset);
1013
1014 // Event - event class relationship
1015 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1016 EmptyOptional(),
1017 EmptyOptional(),
1018 LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
1019 readableData,
1020 offset);
1021
1022 // Execution
1023 // Input workload execution
1024 // Input workload execution entity
1025 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
1026
1027 // Entity - Type relationship
1028 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1029 EmptyOptional(),
1030 EmptyOptional(),
1031 LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
1032 readableData,
1033 offset);
1034
1035 // Type label relationship
1036 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1037 EmptyOptional(),
1038 EmptyOptional(),
1039 LabelsAndEventClasses::TYPE_GUID,
1040 readableData,
1041 offset);
1042
1043 // Inference - Workload execution relationship
1044 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1045 EmptyOptional(),
1046 EmptyOptional(),
1047 EmptyOptional(),
1048 readableData,
1049 offset);
1050
1051 // Workload - Workload execution relationship
1052 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1053 EmptyOptional(),
1054 EmptyOptional(),
1055 EmptyOptional(),
1056 readableData,
1057 offset);
1058
1059 // Start Input workload execution life
1060 // Event packet - timeline, threadId, eventGuid
1061 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1062
1063 // Input workload execution - event relationship
1064 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1065 EmptyOptional(),
1066 EmptyOptional(),
1067 EmptyOptional(),
1068 readableData,
1069 offset);
1070
1071 // Event - event class relationship
1072 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1073 EmptyOptional(),
1074 EmptyOptional(),
1075 LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
1076 readableData,
1077 offset);
1078
1079 // End of Input workload execution life
1080 // Event packet - timeline, threadId, eventGuid
1081 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1082
1083 // Input workload execution - event relationship
1084 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1085 EmptyOptional(),
1086 EmptyOptional(),
1087 EmptyOptional(),
1088 readableData,
1089 offset);
1090
1091 // Event - event class relationship
1092 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1093 EmptyOptional(),
1094 EmptyOptional(),
1095 LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
1096 readableData,
1097 offset);
1098
1099 // Conv2d workload execution
1100 // Conv2d workload execution entity
1101 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
1102
1103 // Entity - Type relationship
1104 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1105 EmptyOptional(),
1106 EmptyOptional(),
1107 LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
1108 readableData,
1109 offset);
1110
1111 // Type label relationship
1112 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1113 EmptyOptional(),
1114 EmptyOptional(),
1115 LabelsAndEventClasses::TYPE_GUID,
1116 readableData,
1117 offset);
1118
1119 // Inference - Workload execution relationship
1120 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1121 EmptyOptional(),
1122 EmptyOptional(),
1123 EmptyOptional(),
1124 readableData,
1125 offset);
1126
1127 // Workload - Workload execution relationship
1128 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1129 EmptyOptional(),
1130 EmptyOptional(),
1131 EmptyOptional(),
1132 readableData,
1133 offset);
1134
1135 // Start Conv2d workload execution life
1136 // Event packet - timeline, threadId, eventGuid
1137 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1138
1139 // Conv2d workload execution - event relationship
1140 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1141 EmptyOptional(),
1142 EmptyOptional(),
1143 EmptyOptional(),
1144 readableData,
1145 offset);
1146
1147 // Event - event class relationship
1148 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1149 EmptyOptional(),
1150 EmptyOptional(),
1151 LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
1152 readableData,
1153 offset);
1154
1155 // End of Conv2d workload execution life
1156 // Event packet - timeline, threadId, eventGuid
1157 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1158
1159 // Conv2d workload execution - event relationship
1160 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1161 EmptyOptional(),
1162 EmptyOptional(),
1163 EmptyOptional(),
1164 readableData,
1165 offset);
1166
1167 // Event - event class relationship
1168 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1169 EmptyOptional(),
1170 EmptyOptional(),
1171 LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
1172 readableData,
1173 offset);
1174
1175 // Activation workload execution
1176 // Activation workload execution entity
1177 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
1178
1179 // Entity - Type relationship
1180 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1181 EmptyOptional(),
1182 EmptyOptional(),
1183 LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
1184 readableData,
1185 offset);
1186
1187 // Type label relationship
1188 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1189 EmptyOptional(),
1190 EmptyOptional(),
1191 LabelsAndEventClasses::TYPE_GUID,
1192 readableData,
1193 offset);
1194
1195 // Inference - Workload execution relationship
1196 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1197 EmptyOptional(),
1198 EmptyOptional(),
1199 EmptyOptional(),
1200 readableData,
1201 offset);
1202
1203 // Workload - Workload execution relationship
1204 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1205 EmptyOptional(),
1206 EmptyOptional(),
1207 EmptyOptional(),
1208 readableData,
1209 offset);
1210
1211 // Start Activation workload execution life
1212 // Event packet - timeline, threadId, eventGuid
1213 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1214
1215 // Activation workload execution - event relationship
1216 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1217 EmptyOptional(),
1218 EmptyOptional(),
1219 EmptyOptional(),
1220 readableData,
1221 offset);
1222
1223 // Event - event class relationship
1224 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1225 EmptyOptional(),
1226 EmptyOptional(),
1227 LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
1228 readableData,
1229 offset);
1230
1231 // End of Activation workload execution life
1232 // Event packet - timeline, threadId, eventGuid
1233 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1234
1235 // Activation workload execution - event relationship
1236 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1237 EmptyOptional(),
1238 EmptyOptional(),
1239 EmptyOptional(),
1240 readableData,
1241 offset);
1242
1243 // Event - event class relationship
1244 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1245 EmptyOptional(),
1246 EmptyOptional(),
1247 LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
1248 readableData,
1249 offset);
1250
1251 // Output workload execution
1252 // Output workload execution entity
1253 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
1254
1255 // Entity - Type relationship
1256 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1257 EmptyOptional(),
1258 EmptyOptional(),
1259 LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
1260 readableData,
1261 offset);
1262
1263 // Type label relationship
1264 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1265 EmptyOptional(),
1266 EmptyOptional(),
1267 LabelsAndEventClasses::TYPE_GUID,
1268 readableData,
1269 offset);
1270
1271 // Inference - Workload execution relationship
1272 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1273 EmptyOptional(),
1274 EmptyOptional(),
1275 EmptyOptional(),
1276 readableData,
1277 offset);
1278
1279 // Workload - Workload execution relationship
1280 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1281 EmptyOptional(),
1282 EmptyOptional(),
1283 EmptyOptional(),
1284 readableData,
1285 offset);
1286
1287 // Start Output workload execution life
1288 // Event packet - timeline, threadId, eventGuid
1289 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1290
1291 // Output workload execution - event relationship
1292 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1293 EmptyOptional(),
1294 EmptyOptional(),
1295 EmptyOptional(),
1296 readableData,
1297 offset);
1298
1299 // Event - event class relationship
1300 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1301 EmptyOptional(),
1302 EmptyOptional(),
1303 LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
1304 readableData,
1305 offset);
1306
1307 // End of Normalize workload execution life
1308 // Event packet - timeline, threadId, eventGuid
1309 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1310
1311 // Output workload execution - event relationship
1312 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1313 EmptyOptional(),
1314 EmptyOptional(),
1315 EmptyOptional(),
1316 readableData,
1317 offset);
1318
1319 // Event - event class relationship
1320 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1321 EmptyOptional(),
1322 EmptyOptional(),
1323 LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
1324 readableData,
1325 offset);
1326
1327 // End of Inference life
1328 // Event packet - timeline, threadId, eventGuid
1329 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1330
1331 // Inference - event relationship
1332 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1333 EmptyOptional(),
1334 EmptyOptional(),
1335 EmptyOptional(),
1336 readableData,
1337 offset);
1338
1339 // Event - event class relationship
1340 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1341 EmptyOptional(),
1342 EmptyOptional(),
1343 LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
1344 readableData,
1345 offset);
1346
1347 bufferManager.MarkRead(inferenceReadableBuffer);
Narumol Prangnawaratdf31cfe2019-11-22 11:26:06 +00001348}