From 8efb48a6847c5cd166c561127ae6611150963ce3 Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Fri, 19 May 2023 11:14:28 +0100 Subject: Update Doxygen docu for 23.05 Signed-off-by: Nikhil Raj Change-Id: I0a992286f14fa68fcc6e5eba31ac39fed003cbbe --- 23.05/_async_execution_callback_8hpp_source.xhtml | 229 ++++++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 23.05/_async_execution_callback_8hpp_source.xhtml (limited to '23.05/_async_execution_callback_8hpp_source.xhtml') diff --git a/23.05/_async_execution_callback_8hpp_source.xhtml b/23.05/_async_execution_callback_8hpp_source.xhtml new file mode 100644 index 0000000000..ec20947925 --- /dev/null +++ b/23.05/_async_execution_callback_8hpp_source.xhtml @@ -0,0 +1,229 @@ + + + + + + + + + + + + + +ArmNN: src/armnn/AsyncExecutionCallback.hpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  23.05 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
AsyncExecutionCallback.hpp
+
+
+Go to the documentation of this file.
1 //
+
2 // Copyright © 2021-2023 Arm Ltd and Contributors. All rights reserved.
+
3 // SPDX-License-Identifier: MIT
+
4 //
+
5 
+
6 #pragma once
+
7 
+ + +
10 #include <armnn/Types.hpp>
+
11 
+
12 #include <condition_variable>
+
13 #include <mutex>
+
14 #include <thread>
+
15 #include <queue>
+
16 #include <unordered_map>
+
17 
+
18 namespace armnn
+
19 {
+
20 
+
21 namespace experimental
+
22 {
+
23 
+
24 using InferenceId = uint64_t;
+ +
26 {
+
27 private:
+
28  static InferenceId nextID;
+
29 
+
30 public:
+
31  AsyncExecutionCallback(std::queue<InferenceId>& notificationQueue
+
32 #if !defined(ARMNN_DISABLE_THREADS)
+
33  , std::mutex& mutex
+
34  , std::condition_variable& condition
+
35 #endif
+
36  )
+
37  : m_NotificationQueue(notificationQueue)
+
38 #if !defined(ARMNN_DISABLE_THREADS)
+
39  , m_Mutex(mutex)
+
40  , m_Condition(condition)
+
41 #endif
+
42  , m_InferenceId(++nextID)
+
43  {}
+
44 
+ +
46  {}
+
47 
+
48  void Notify(armnn::Status status, InferenceTimingPair timeTaken);
+
49 
+ +
51  {
+
52  return m_InferenceId;
+
53  }
+
54 
+
55  armnn::Status GetStatus() const;
+ + +
58 
+
59 private:
+
60  std::queue<InferenceId>& m_NotificationQueue;
+
61 #if !defined(ARMNN_DISABLE_THREADS)
+
62  std::mutex& m_Mutex;
+
63  std::condition_variable& m_Condition;
+
64 #endif
+
65 
+
66  HighResolutionClock m_StartTime;
+
67  HighResolutionClock m_EndTime;
+
68  armnn::Status m_Status = Status::Failure;
+
69  InferenceId m_InferenceId;
+
70 };
+
71 
+
72 // Manager to create and monitor AsyncExecutionCallbacks
+
73 // GetNewCallback will create a callback for use in Threadpool::Schedule
+
74 // GetNotifiedCallback will return the first callback to be notified (finished execution)
+ +
76 {
+
77 public:
+
78  std::shared_ptr<AsyncExecutionCallback> GetNewCallback();
+
79  std::shared_ptr<AsyncExecutionCallback> GetNotifiedCallback();
+
80 
+
81 private:
+
82 #if !defined(ARMNN_DISABLE_THREADS)
+
83  std::mutex m_Mutex;
+
84  std::condition_variable m_Condition;
+
85 #endif
+
86  std::unordered_map<InferenceId, std::shared_ptr<AsyncExecutionCallback>> m_Callbacks;
+
87  std::queue<InferenceId> m_NotificationQueue;
+
88 };
+
89 
+
90 } // namespace experimental
+
91 
+
92 } // namespace armnn
+
+
+ + +
std::chrono::high_resolution_clock::time_point HighResolutionClock
Define a timer and associated inference ID for recording execution times.
Definition: Types.hpp:393
+ + + + +
Copyright (c) 2021 ARM Limited and Contributors.
+ + +
std::shared_ptr< AsyncExecutionCallback > GetNewCallback()
+
Status
Definition: Types.hpp:42
+
void Notify(armnn::Status status, InferenceTimingPair timeTaken)
+ +
std::shared_ptr< AsyncExecutionCallback > GetNotifiedCallback()
+
std::pair< HighResolutionClock, HighResolutionClock > InferenceTimingPair
Definition: Types.hpp:394
+ + + + +
AsyncExecutionCallback(std::queue< InferenceId > &notificationQueue, std::mutex &mutex, std::condition_variable &condition)
+ + + + -- cgit v1.2.1