blob: e5248b1b937781c3a35b70feae4625843d72c8ae [file] [log] [blame]
Kristofer Jonssona08e9d42021-04-28 12:32:28 +02001@startuml
2
3skinparam backgroundColor #EEEBDC
4
5box "Application" #00C1DE
6participant "main()" as app
7end box
8
9box "Tensorflow" #FF6B00
10participant "TFLu" as tflu
11participant "Ethos-U custom op" as custom
12end box
13
14box "Ethos-U driver" #95D600
15participant "Driver" as driver
16end box
17
18box "Hardware" #FFC700
19participant "Cortex-M" as cortexm
20participant "Ethos-U" as ethosu
21end box
22
23app -> tflu++: Invoke()
24 tflu -> custom++: Eval()
25 custom -> driver++: ethosu_reserve_driver()
26 loop Find and reserve driver
27 driver -> app++: ethosu_mutex_lock()
28 return
29
30 driver -> driver: ethosu_find_and_reserve_driver()
31
32 driver -> app++: ethosu_mutex_unlock()
33 return
34
35 alt Found free driver
36 note over driver
37 Return free driver
38 end note
39 else No driver available
40 driver -> app++: ethosu_semaphore_take()
41 note over app
42 Block on semaphore
43 end note
44 return
45 end
46 end loop
47 return
48
49 custom -> driver++: ethosu_invoke()
50 driver -\\ ethosu: Configure NPU and trigger inference
51
52 driver -> driver++: wait_for_irq()
53 note over driver
54 Driver sleeping waiting for IRQ
55 end note
56
57 ethosu -\\ cortexm: IRQ
58 cortexm -\\ driver: ethosu_irq_handler()
59
60 note over driver
61 Driver woken up by IRQ handler
62 end note
63 return
64 return
65
66 custom -> driver++: ethosu_release_driver()
67 driver -> app++: ethosu_mutex_lock()
68 return
69
70 driver -> app++: ethosu_semaphore_give()
71 note over app
72 Wake up threads blocking on the semaphore
73 end note
74 return
75
76 driver -> app++: ethosu_mutex_unlock()
77 return
78 return
79 return
80return
81
82@enduml