blob: bc8b7a7b4d303063c91bc2a5a2ada347a47ef4b9 [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;
362 armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
363
364 // build up the structure of the network
365 INetworkPtr net(INetwork::Create());
366
367 // Convolution details
368 TensorInfo inputInfo({ 1, 2, 5, 1 }, DataType::Float32);
369 TensorInfo weightInfo({ 3, 2, 3, 1}, DataType::Float32);
370 TensorInfo biasInfo({ 3 }, DataType::Float32);
371 TensorInfo outputInfo({ 1, 3, 7, 1}, DataType::Float32);
372 std::vector<float> weightsData{
373 1.0f, 0.0f, 0.0f,
374 0.0f, 2.0f, -1.5f,
375
376 0.0f, 0.0f, 0.0f,
377 0.2f, 0.2f, 0.2f,
378
379 0.5f, 0.0f, 0.5f,
380 0.0f, -1.0f, 0.0f
381 };
382 ConstTensor weights(weightInfo, weightsData);
383
384 Optional<ConstTensor> optionalBiases;
385 std::vector<float> biasesData{ 1.0f, 0.0f, 0.0f };
386 ConstTensor biases(biasInfo, biasesData);
387 optionalBiases = Optional<ConstTensor>(biases);
388
389 // Input layer
390 IConnectableLayer* input = net->AddInputLayer(0, "input");
391
392 // Convolution2d layer
393 Convolution2dDescriptor conv2dDesc;
394 conv2dDesc.m_StrideX = 1;
395 conv2dDesc.m_StrideY = 1;
396 conv2dDesc.m_PadLeft = 0;
397 conv2dDesc.m_PadRight = 0;
398 conv2dDesc.m_PadTop = 2;
399 conv2dDesc.m_PadBottom = 2;
400 conv2dDesc.m_BiasEnabled = true;
401 IConnectableLayer* conv2d = net->AddConvolution2dLayer(conv2dDesc, weights, optionalBiases);
402
403 // Activation layer
404 armnn::ActivationDescriptor activationDesc;
405 armnn::IConnectableLayer* const activation = net->AddActivationLayer(activationDesc, "activation");
406
407 // Output layer
408 IConnectableLayer* output = net->AddOutputLayer(0, "output");
409
410 input->GetOutputSlot(0).Connect(conv2d->GetInputSlot(0));
411 conv2d->GetOutputSlot(0).Connect(activation->GetInputSlot(0));
412 activation->GetOutputSlot(0).Connect(output->GetInputSlot(0));
413
414 input->GetOutputSlot(0).SetTensorInfo(inputInfo);
415 conv2d->GetOutputSlot(0).SetTensorInfo(outputInfo);
416 activation->GetOutputSlot(0).SetTensorInfo(outputInfo);
417
418 // optimize the network
419 std::vector<armnn::BackendId> backends = { backendId };
420 IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec());
421
422 ProfilingGuid optNetGuid = optNet->GetGuid();
423
424 // Load it into the runtime. It should success.
425 armnn::NetworkId netId;
426 BOOST_TEST(runtime->LoadNetwork(netId, std::move(optNet)) == Status::Success);
427
428 profiling::ProfilingServiceRuntimeHelper profilingServiceHelper;
429 profiling::BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager();
430 auto readableBuffer = bufferManager.GetReadableBuffer();
431
432 // Profiling is enable, the post-optimisation structure should be created
433 BOOST_CHECK(readableBuffer != nullptr);
434
435 unsigned int size = readableBuffer->GetSize();
436 BOOST_CHECK(size == 1980);
437
438 const unsigned char* readableData = readableBuffer->GetReadableData();
439 BOOST_CHECK(readableData != nullptr);
440
441 unsigned int offset = 0;
442
443 // Post-optimisation network
444 // Network entity
445 VerifyTimelineEntityBinaryPacket(optNetGuid, readableData, offset);
446
447 // Entity - Type relationship
448 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
449 EmptyOptional(),
450 optNetGuid,
451 EmptyOptional(),
452 readableData,
453 offset);
454
455 // Type label relationship
456 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
457 EmptyOptional(),
458 EmptyOptional(),
459 LabelsAndEventClasses::TYPE_GUID,
460 readableData,
461 offset);
462
463 // Input layer
464 // Input layer entity
465 VerifyTimelineEntityBinaryPacket(input->GetGuid(), readableData, offset);
466
467 // Name Entity
468 VerifyTimelineLabelBinaryPacket(EmptyOptional(), "input", readableData, offset);
469
470 // Entity - Name relationship
471 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
472 EmptyOptional(),
473 input->GetGuid(),
474 EmptyOptional(),
475 readableData,
476 offset);
477
478 // Name label relationship
479 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
480 EmptyOptional(),
481 EmptyOptional(),
482 LabelsAndEventClasses::NAME_GUID,
483 readableData,
484 offset);
485
486 // Entity - Type relationship
487 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
488 EmptyOptional(),
489 input->GetGuid(),
490 EmptyOptional(),
491 readableData,
492 offset);
493
494 // Type label relationship
495 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
496 EmptyOptional(),
497 EmptyOptional(),
498 LabelsAndEventClasses::TYPE_GUID,
499 readableData,
500 offset);
501
502 // Network - Input layer relationship
503 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
504 EmptyOptional(),
505 optNetGuid,
506 input->GetGuid(),
507 readableData,
508 offset);
509
510 // Conv2d layer
511 // Conv2d layer entity
512 VerifyTimelineEntityBinaryPacket(conv2d->GetGuid(), readableData, offset);
513
514 // Name entity
515 VerifyTimelineLabelBinaryPacket(EmptyOptional(), "<Unnamed>", readableData, offset);
516
517 // Entity - Name relationship
518 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
519 EmptyOptional(),
520 conv2d->GetGuid(),
521 EmptyOptional(),
522 readableData,
523 offset);
524
525 // Name label relationship
526 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
527 EmptyOptional(),
528 EmptyOptional(),
529 LabelsAndEventClasses::NAME_GUID,
530 readableData,
531 offset);
532
533 // Entity - Type relationship
534 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
535 EmptyOptional(),
536 conv2d->GetGuid(),
537 EmptyOptional(),
538 readableData,
539 offset);
540
541 // Type label relationship
542 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
543 EmptyOptional(),
544 EmptyOptional(),
545 LabelsAndEventClasses::TYPE_GUID,
546 readableData,
547 offset);
548
549 // Network - Conv2d layer relationship
550 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
551 EmptyOptional(),
552 optNetGuid,
553 conv2d->GetGuid(),
554 readableData,
555 offset);
556
557 // Input layer - Conv2d layer relationship
558 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
559 EmptyOptional(),
560 input->GetGuid(),
561 conv2d->GetGuid(),
562 readableData,
563 offset);
564
565 // Entity - Type relationship
566 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
567 EmptyOptional(),
568 EmptyOptional(),
569 LabelsAndEventClasses::CONNECTION_GUID,
570 readableData,
571 offset);
572
573 // Type label relationship
574 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
575 EmptyOptional(),
576 EmptyOptional(),
577 LabelsAndEventClasses::TYPE_GUID,
578 readableData,
579 offset);
580
581 // Conv2d workload
582 // Conv2d workload entity
583 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
584
585 // Entity - Type relationship
586 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
587 EmptyOptional(),
588 EmptyOptional(),
589 EmptyOptional(),
590 readableData,
591 offset);
592
593 // Type label relationship
594 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
595 EmptyOptional(),
596 EmptyOptional(),
597 LabelsAndEventClasses::TYPE_GUID,
598 readableData,
599 offset);
600
601 // BackendId entity
602 VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
603
604 // Entity - BackendId relationship
605 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
606 EmptyOptional(),
607 EmptyOptional(),
608 EmptyOptional(),
609 readableData,
610 offset);
611
612 // BackendId label relationship
613 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
614 EmptyOptional(),
615 EmptyOptional(),
616 LabelsAndEventClasses::BACKENDID_GUID,
617 readableData,
618 offset);
619
620 // Conv2d layer - Conv2d workload relationship
621 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
622 EmptyOptional(),
623 conv2d->GetGuid(),
624 EmptyOptional(),
625 readableData,
626 offset);
627
628 // Activation layer
629 // Activation layer entity
630 VerifyTimelineEntityBinaryPacket(activation->GetGuid(), readableData, offset);
631
632 // Name entity
633 VerifyTimelineLabelBinaryPacket(EmptyOptional(), "activation", readableData, offset);
634
635 // Entity - Name relationship
636 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
637 EmptyOptional(),
638 activation->GetGuid(),
639 EmptyOptional(),
640 readableData,
641 offset);
642
643 // Name label relationship
644 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
645 EmptyOptional(),
646 EmptyOptional(),
647 LabelsAndEventClasses::NAME_GUID,
648 readableData,
649 offset);
650
651 // Entity - Type relationship
652 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
653 EmptyOptional(),
654 activation->GetGuid(),
655 EmptyOptional(),
656 readableData,
657 offset);
658
659 // Type label relationship
660 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
661 EmptyOptional(),
662 EmptyOptional(),
663 LabelsAndEventClasses::TYPE_GUID,
664 readableData,
665 offset);
666
667 // Network - Activation layer relationship
668 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
669 EmptyOptional(),
670 optNetGuid,
671 activation->GetGuid(),
672 readableData,
673 offset);
674
675 // Conv2d layer - Activation layer relationship
676 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
677 EmptyOptional(),
678 conv2d->GetGuid(),
679 activation->GetGuid(),
680 readableData,
681 offset);
682
683 // Entity - Type relationship
684 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
685 EmptyOptional(),
686 EmptyOptional(),
687 LabelsAndEventClasses::CONNECTION_GUID,
688 readableData,
689 offset);
690
691 // Type label relationship
692 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
693 EmptyOptional(),
694 EmptyOptional(),
695 LabelsAndEventClasses::TYPE_GUID,
696 readableData,
697 offset);
698
699 // Activation workload
700 // Activation workload entity
701 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
702
703 // Entity - Type relationship
704 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
705 EmptyOptional(),
706 EmptyOptional(),
707 EmptyOptional(),
708 readableData,
709 offset);
710
711 // Type label relationship
712 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
713 EmptyOptional(),
714 EmptyOptional(),
715 LabelsAndEventClasses::TYPE_GUID,
716 readableData,
717 offset);
718
719 // BackendId entity
720 VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
721
722 // Entity - BackendId relationship
723 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
724 EmptyOptional(),
725 EmptyOptional(),
726 EmptyOptional(),
727 readableData,
728 offset);
729
730 // BackendId label relationship
731 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
732 EmptyOptional(),
733 EmptyOptional(),
734 LabelsAndEventClasses::BACKENDID_GUID,
735 readableData,
736 offset);
737
738 // Activation layer - Activation workload relationship
739 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
740 EmptyOptional(),
741 activation->GetGuid(),
742 EmptyOptional(),
743 readableData,
744 offset);
745
746 // Output layer
747 // Output layer entity
748 VerifyTimelineEntityBinaryPacket(output->GetGuid(), readableData, offset);
749
750 // Name entity
751 VerifyTimelineLabelBinaryPacket(EmptyOptional(), "output", readableData, offset);
752
753 // Entity - Name relationship
754 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
755 EmptyOptional(),
756 output->GetGuid(),
757 EmptyOptional(),
758 readableData,
759 offset);
760
761 // Name label relationship
762 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
763 EmptyOptional(),
764 EmptyOptional(),
765 LabelsAndEventClasses::NAME_GUID,
766 readableData,
767 offset);
768
769 // Entity - Type relationship
770 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
771 EmptyOptional(),
772 output->GetGuid(),
773 EmptyOptional(),
774 readableData,
775 offset);
776
777 // Type label relationship
778 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
779 EmptyOptional(),
780 EmptyOptional(),
781 LabelsAndEventClasses::TYPE_GUID,
782 readableData,
783 offset);
784
785 // Network - Output layer relationship
786 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
787 EmptyOptional(),
788 optNetGuid,
789 output->GetGuid(),
790 readableData,
791 offset);
792
793 // Activation layer - Output layer relationship
794 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
795 EmptyOptional(),
796 activation->GetGuid(),
797 output->GetGuid(),
798 readableData,
799 offset);
800
801 // Entity - Type relationship
802 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
803 EmptyOptional(),
804 EmptyOptional(),
805 LabelsAndEventClasses::CONNECTION_GUID,
806 readableData,
807 offset);
808
809 // Type label relationship
810 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
811 EmptyOptional(),
812 EmptyOptional(),
813 LabelsAndEventClasses::TYPE_GUID,
814 readableData,
815 offset);
816
817 bufferManager.MarkRead(readableBuffer);
Narumol Prangnawarataa68e012019-11-29 17:17:43 +0000818
819 // Creates structures for input & output.
820 std::vector<float> inputData(inputInfo.GetNumElements());
821 std::vector<float> outputData(outputInfo.GetNumElements());
822
823 InputTensors inputTensors
824 {
825 {0, ConstTensor(runtime->GetInputTensorInfo(netId, 0), inputData.data())}
826 };
827 OutputTensors outputTensors
828 {
829 {0, Tensor(runtime->GetOutputTensorInfo(netId, 0), outputData.data())}
830 };
831
832 // Does the inference.
833 runtime->EnqueueWorkload(netId, inputTensors, outputTensors);
834
David Monahan6198fe02019-12-02 08:35:43 +0000835 // Get readable buffer for inference timeline
836 auto inferenceReadableBuffer = bufferManager.GetReadableBuffer();
837 BOOST_CHECK(inferenceReadableBuffer != nullptr);
838
Narumol Prangnawarataa68e012019-11-29 17:17:43 +0000839 // Get readable buffer for output workload
840 auto outputReadableBuffer = bufferManager.GetReadableBuffer();
841 BOOST_CHECK(outputReadableBuffer != nullptr);
842
843 // Get readable buffer for input workload
844 auto inputReadableBuffer = bufferManager.GetReadableBuffer();
845 BOOST_CHECK(inputReadableBuffer != nullptr);
846
847 // Validate input workload data
848 size = inputReadableBuffer->GetSize();
849 BOOST_CHECK(size == 252);
850
851 readableData = inputReadableBuffer->GetReadableData();
852 BOOST_CHECK(readableData != nullptr);
853
854 offset = 0;
855
856 // Input workload
857 // Input workload entity
858 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
859
860 // Entity - Type relationship
861 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
862 EmptyOptional(),
863 EmptyOptional(),
864 EmptyOptional(),
865 readableData,
866 offset);
867
868 // Type label relationship
869 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
870 EmptyOptional(),
871 EmptyOptional(),
872 LabelsAndEventClasses::TYPE_GUID,
873 readableData,
874 offset);
875
876 // BackendId entity
877 VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
878
879 // Entity - BackendId relationship
880 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
881 EmptyOptional(),
882 EmptyOptional(),
883 EmptyOptional(),
884 readableData,
885 offset);
886
887 // BackendId label relationship
888 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
889 EmptyOptional(),
890 EmptyOptional(),
891 LabelsAndEventClasses::BACKENDID_GUID,
892 readableData,
893 offset);
894
895 // Input layer - Input workload relationship
896 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
897 EmptyOptional(),
898 input->GetGuid(),
899 EmptyOptional(),
900 readableData,
901 offset);
902
903 bufferManager.MarkRead(inputReadableBuffer);
904
905 // Validate output workload data
906 size = outputReadableBuffer->GetSize();
907 BOOST_CHECK(size == 252);
908
909 readableData = outputReadableBuffer->GetReadableData();
910 BOOST_CHECK(readableData != nullptr);
911
912 offset = 0;
913
914 // Output workload
915 // Output workload entity
916 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
917
918 // Entity - Type relationship
919 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
920 EmptyOptional(),
921 EmptyOptional(),
922 EmptyOptional(),
923 readableData,
924 offset);
925
926 // Type label relationship
927 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
928 EmptyOptional(),
929 EmptyOptional(),
930 LabelsAndEventClasses::TYPE_GUID,
931 readableData,
932 offset);
933
934 // BackendId entity
935 VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
936
937 // Entity - BackendId relationship
938 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
939 EmptyOptional(),
940 EmptyOptional(),
941 EmptyOptional(),
942 readableData,
943 offset);
944
945 // BackendId label relationship
946 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
947 EmptyOptional(),
948 EmptyOptional(),
949 LabelsAndEventClasses::BACKENDID_GUID,
950 readableData,
951 offset);
952
953 // Output layer - Output workload relationship
954 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
955 EmptyOptional(),
956 output->GetGuid(),
957 EmptyOptional(),
958 readableData,
959 offset);
960
961 bufferManager.MarkRead(outputReadableBuffer);
David Monahan6198fe02019-12-02 08:35:43 +0000962
963 // Validate inference data
964 size = inferenceReadableBuffer->GetSize();
965 BOOST_CHECK(size == 2020);
966
967 readableData = inferenceReadableBuffer->GetReadableData();
968 BOOST_CHECK(readableData != nullptr);
969
970 offset = 0;
971
972 // Inference timeline trace
973 // Inference entity
974 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
975
976 // Entity - Type relationship
977 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
978 EmptyOptional(),
979 EmptyOptional(),
980 LabelsAndEventClasses::INFERENCE_GUID,
981 readableData,
982 offset);
983
984 // Type label relationship
985 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
986 EmptyOptional(),
987 EmptyOptional(),
988 LabelsAndEventClasses::TYPE_GUID,
989 readableData,
990 offset);
991
992 // Network - Inference relationship
993 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
994 EmptyOptional(),
995 optNetGuid,
996 EmptyOptional(),
997 readableData,
998 offset);
999
1000 // Start Inference life
1001 // Event packet - timeline, threadId, eventGuid
1002 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1003
1004 // Inference - event relationship
1005 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1006 EmptyOptional(),
1007 EmptyOptional(),
1008 EmptyOptional(),
1009 readableData,
1010 offset);
1011
1012 // Event - event class relationship
1013 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1014 EmptyOptional(),
1015 EmptyOptional(),
1016 LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
1017 readableData,
1018 offset);
1019
1020 // Execution
1021 // Input workload execution
1022 // Input workload execution entity
1023 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
1024
1025 // Entity - Type relationship
1026 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1027 EmptyOptional(),
1028 EmptyOptional(),
1029 LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
1030 readableData,
1031 offset);
1032
1033 // Type label relationship
1034 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1035 EmptyOptional(),
1036 EmptyOptional(),
1037 LabelsAndEventClasses::TYPE_GUID,
1038 readableData,
1039 offset);
1040
1041 // Inference - Workload execution relationship
1042 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1043 EmptyOptional(),
1044 EmptyOptional(),
1045 EmptyOptional(),
1046 readableData,
1047 offset);
1048
1049 // Workload - Workload execution relationship
1050 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1051 EmptyOptional(),
1052 EmptyOptional(),
1053 EmptyOptional(),
1054 readableData,
1055 offset);
1056
1057 // Start Input workload execution life
1058 // Event packet - timeline, threadId, eventGuid
1059 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1060
1061 // Input workload execution - event relationship
1062 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1063 EmptyOptional(),
1064 EmptyOptional(),
1065 EmptyOptional(),
1066 readableData,
1067 offset);
1068
1069 // Event - event class relationship
1070 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1071 EmptyOptional(),
1072 EmptyOptional(),
1073 LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
1074 readableData,
1075 offset);
1076
1077 // End of Input workload execution life
1078 // Event packet - timeline, threadId, eventGuid
1079 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1080
1081 // Input workload execution - event relationship
1082 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1083 EmptyOptional(),
1084 EmptyOptional(),
1085 EmptyOptional(),
1086 readableData,
1087 offset);
1088
1089 // Event - event class relationship
1090 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1091 EmptyOptional(),
1092 EmptyOptional(),
1093 LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
1094 readableData,
1095 offset);
1096
1097 // Conv2d workload execution
1098 // Conv2d workload execution entity
1099 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
1100
1101 // Entity - Type relationship
1102 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1103 EmptyOptional(),
1104 EmptyOptional(),
1105 LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
1106 readableData,
1107 offset);
1108
1109 // Type label relationship
1110 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1111 EmptyOptional(),
1112 EmptyOptional(),
1113 LabelsAndEventClasses::TYPE_GUID,
1114 readableData,
1115 offset);
1116
1117 // Inference - Workload execution relationship
1118 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1119 EmptyOptional(),
1120 EmptyOptional(),
1121 EmptyOptional(),
1122 readableData,
1123 offset);
1124
1125 // Workload - Workload execution relationship
1126 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1127 EmptyOptional(),
1128 EmptyOptional(),
1129 EmptyOptional(),
1130 readableData,
1131 offset);
1132
1133 // Start Conv2d workload execution life
1134 // Event packet - timeline, threadId, eventGuid
1135 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1136
1137 // Conv2d workload execution - event relationship
1138 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1139 EmptyOptional(),
1140 EmptyOptional(),
1141 EmptyOptional(),
1142 readableData,
1143 offset);
1144
1145 // Event - event class relationship
1146 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1147 EmptyOptional(),
1148 EmptyOptional(),
1149 LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
1150 readableData,
1151 offset);
1152
1153 // End of Conv2d workload execution life
1154 // Event packet - timeline, threadId, eventGuid
1155 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1156
1157 // Conv2d workload execution - event relationship
1158 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1159 EmptyOptional(),
1160 EmptyOptional(),
1161 EmptyOptional(),
1162 readableData,
1163 offset);
1164
1165 // Event - event class relationship
1166 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1167 EmptyOptional(),
1168 EmptyOptional(),
1169 LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
1170 readableData,
1171 offset);
1172
1173 // Activation workload execution
1174 // Activation workload execution entity
1175 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
1176
1177 // Entity - Type relationship
1178 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1179 EmptyOptional(),
1180 EmptyOptional(),
1181 LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
1182 readableData,
1183 offset);
1184
1185 // Type label relationship
1186 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1187 EmptyOptional(),
1188 EmptyOptional(),
1189 LabelsAndEventClasses::TYPE_GUID,
1190 readableData,
1191 offset);
1192
1193 // Inference - Workload execution relationship
1194 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1195 EmptyOptional(),
1196 EmptyOptional(),
1197 EmptyOptional(),
1198 readableData,
1199 offset);
1200
1201 // Workload - Workload execution relationship
1202 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1203 EmptyOptional(),
1204 EmptyOptional(),
1205 EmptyOptional(),
1206 readableData,
1207 offset);
1208
1209 // Start Activation workload execution life
1210 // Event packet - timeline, threadId, eventGuid
1211 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1212
1213 // Activation workload execution - event relationship
1214 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1215 EmptyOptional(),
1216 EmptyOptional(),
1217 EmptyOptional(),
1218 readableData,
1219 offset);
1220
1221 // Event - event class relationship
1222 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1223 EmptyOptional(),
1224 EmptyOptional(),
1225 LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
1226 readableData,
1227 offset);
1228
1229 // End of Activation workload execution life
1230 // Event packet - timeline, threadId, eventGuid
1231 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1232
1233 // Activation workload execution - event relationship
1234 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1235 EmptyOptional(),
1236 EmptyOptional(),
1237 EmptyOptional(),
1238 readableData,
1239 offset);
1240
1241 // Event - event class relationship
1242 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1243 EmptyOptional(),
1244 EmptyOptional(),
1245 LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
1246 readableData,
1247 offset);
1248
1249 // Output workload execution
1250 // Output workload execution entity
1251 VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
1252
1253 // Entity - Type relationship
1254 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1255 EmptyOptional(),
1256 EmptyOptional(),
1257 LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
1258 readableData,
1259 offset);
1260
1261 // Type label relationship
1262 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
1263 EmptyOptional(),
1264 EmptyOptional(),
1265 LabelsAndEventClasses::TYPE_GUID,
1266 readableData,
1267 offset);
1268
1269 // Inference - Workload execution relationship
1270 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1271 EmptyOptional(),
1272 EmptyOptional(),
1273 EmptyOptional(),
1274 readableData,
1275 offset);
1276
1277 // Workload - Workload execution relationship
1278 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
1279 EmptyOptional(),
1280 EmptyOptional(),
1281 EmptyOptional(),
1282 readableData,
1283 offset);
1284
1285 // Start Output workload execution life
1286 // Event packet - timeline, threadId, eventGuid
1287 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1288
1289 // Output workload execution - event relationship
1290 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1291 EmptyOptional(),
1292 EmptyOptional(),
1293 EmptyOptional(),
1294 readableData,
1295 offset);
1296
1297 // Event - event class relationship
1298 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1299 EmptyOptional(),
1300 EmptyOptional(),
1301 LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
1302 readableData,
1303 offset);
1304
1305 // End of Normalize workload execution life
1306 // Event packet - timeline, threadId, eventGuid
1307 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1308
1309 // Output workload execution - event relationship
1310 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1311 EmptyOptional(),
1312 EmptyOptional(),
1313 EmptyOptional(),
1314 readableData,
1315 offset);
1316
1317 // Event - event class relationship
1318 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1319 EmptyOptional(),
1320 EmptyOptional(),
1321 LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
1322 readableData,
1323 offset);
1324
1325 // End of Inference life
1326 // Event packet - timeline, threadId, eventGuid
1327 VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
1328
1329 // Inference - event relationship
1330 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
1331 EmptyOptional(),
1332 EmptyOptional(),
1333 EmptyOptional(),
1334 readableData,
1335 offset);
1336
1337 // Event - event class relationship
1338 VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
1339 EmptyOptional(),
1340 EmptyOptional(),
1341 LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
1342 readableData,
1343 offset);
1344
1345 bufferManager.MarkRead(inferenceReadableBuffer);
Narumol Prangnawaratdf31cfe2019-11-22 11:26:06 +00001346}