aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristofer Jonsson <kristofer.jonsson@arm.com>2021-06-02 17:15:57 +0200
committerKristofer Jonsson <kristofer.jonsson@arm.com>2021-06-10 11:35:45 +0200
commit0c79f896caf1a0ac16dd92810c4b15bfff00bdb3 (patch)
treed831c0a297894065865ecd680a4ccaeb67859d39
parent2c01713dbeba8446b135ef19fc443b6abe098210 (diff)
downloadethos-u-linux-driver-stack-0c79f896caf1a0ac16dd92810c4b15bfff00bdb3.tar.gz
Adding documentation
Adding documentation, component- and sequence diagrams how the driver library and kernel driver work. Change-Id: I4e71b5e1f5d926386efe8f103a0f4fbc8636a494
-rw-r--r--README.md110
-rw-r--r--docs/driver_library_component.puml18
-rw-r--r--docs/driver_library_component.svg31
-rw-r--r--docs/driver_library_sequence.puml79
-rw-r--r--docs/driver_library_sequence.svg92
-rw-r--r--docs/kernel_buffer.puml52
-rw-r--r--docs/kernel_buffer.svg65
-rw-r--r--docs/kernel_inference.puml79
-rw-r--r--docs/kernel_inference.svg92
-rw-r--r--docs/kernel_network.puml41
-rw-r--r--docs/kernel_network.svg54
11 files changed, 712 insertions, 1 deletions
diff --git a/README.md b/README.md
index da279b3..c46e1fe 100644
--- a/README.md
+++ b/README.md
@@ -66,6 +66,114 @@ The kernel driver uses the mailbox APIs as a doorbell mechanism.
};
```
+# Documentation
+
+## Driver library
+
+The purpose of the driver library is to provide user friendly C++ APIs for
+dispatching inferences to the Ethos-U kernel driver.
+
+As the component diagram below illustrates the network is separated from the
+inference, allowing multiple inferences to share the same network. The buffer
+class is used to store any data.
+
+![Driver library](docs/driver_library_component.svg "Driver library component diagram")
+
+The [inference runner](utils/inference_runner/inference_runner.cpp) demonstrates
+how to dispatch inferences to the Ethos-U kernel driver. All the steps described
+in the sequence diagram below are executed by the `inference_runner`
+application.
+
+The `Device` class opens a file descriptor to the device node `/dev/ethosu<nr>`.
+This file descriptor is used to issue IOCTL request to kernel space to create
+buffers and networks.
+
+The `Network` class uses the `Device` object to create a new network object. The
+network model is stored in a `Buffer` that the network parses to discover the
+dimensions of the network model.
+
+The `Inference` class uses the `Network` object to create an inference. The
+array of IFM `Buffers` need to be populated with data before the inference
+object is created.
+
+The inference object must poll the file descriptor waiting for the inference to
+complete.
+
+![Driver library](docs/driver_library_sequence.svg "Driver library sequence diagram")
+
+## Ethos-U core interface
+
+The task of the Ethos-U kernel driver is to present a Userspace API (UAPI) to
+user space, and to communicate with the Cortex-M in the Ethos-U subsystem.
+
+The communication with the Ethos-U subsystem is based on message passing in
+shared memory, and the Linux kernel mailbox APIs for triggering IRQs on the
+remote CPU.
+
+The address of the message queues is hard coded in the Cortex-M application, and
+configured in the DTB for the kernel driver.
+
+When the kernel driver allocates dynamic memory for the Ethos-U subsystem it
+must be able to map a physical address to a bus address. The DTB contains a
+`dma-ranges` which define how to remap physical addresses to the Cortex-M
+address space.
+
+Triggering IRQs on a remote CPU requires external hardware support, for example
+the Arm MHU.
+
+### Device and buffer
+
+The device driver creates a device node at `/dev/ethosu<nr>` that a user space
+application can open and issues IOCTL requests to. This is how buffers and
+networks are created.
+
+Creating a new buffer returns another file descriptor that can be memory mapped
+for reading and/or writing.
+
+![Create buffer](docs/kernel_buffer.svg "Create buffer")
+
+### Network
+
+Creating a network assumes that the device node has already been opened, and
+that a buffer has been allocated and populated with the network model.
+
+A new network is created by issuing an IOCTL command on the device node file
+descriptor. A file descriptor to a buffer - containing the network model - is
+passed in the IOCTL data. The network class increases the reference count on the
+buffer, preventing the buffer from being freed before the network object has
+been destructed.
+
+![Create network](docs/kernel_network.svg "Create network")
+
+### Inference
+
+Creating an inference assumes that a network has already been created, IFM
+buffers have been allocated and populated with data, and OFM buffers have been
+allocated.
+
+A new inference is created by issuing an IOCTL command to the network file
+descriptor. An array of IFM and OFM buffers are passed in the IOCTL data, which
+reference counts will be increased.
+
+Immediately after the inference object has been created an *inference request*
+message is sent to the Cortex-M application. The inference request message is
+written to a ring buffer in shared memory, cache maintenance is executed if
+necessary, and an IRQ is raised using the Linux mailbox APIs.
+
+On success, a valid file handle is returned to user space. The file handle is
+used to wait for the inference to complete.
+
+Once the inference has been calculated on the Ethos-U subsystem, the message
+process writes an *inference response* message into the response queue in shared
+memory, executes cache maintenance if needed, and raises an IRQ.
+
+On the Linux side the IRQ is handled and cleared. The IRQ bottom handler is a
+separate kernel thread responsible for reading the message queue. When the
+inference response message is received it updates the status of the inference
+and unblocks any waiting user space processes.
+
+![Run inference](docs/kernel_inference.svg "Run inference")
+
# Licenses
The kernel drivers are provided under a GPL v2 license. All other software
@@ -95,7 +203,7 @@ Date: Mon Feb 29 12:12:12 2016 +0000
Title of the commit
Short description of the change.
-
+
Signed-off-by: John Doe john.doe@example.org
Signed-off-by: Foo Bar foo.bar@example.org
```
diff --git a/docs/driver_library_component.puml b/docs/driver_library_component.puml
new file mode 100644
index 0000000..1b640e2
--- /dev/null
+++ b/docs/driver_library_component.puml
@@ -0,0 +1,18 @@
+@startuml
+
+skinparam backgroundColor #FEFEFE
+
+[Inference] as inf
+[Network] as net
+[Buffer] as buf
+[Device] as dev
+
+inf -> net
+inf -> buf: IFM and OFM
+
+net --> dev
+net --> buf: Network model
+
+buf -> dev
+
+@enduml \ No newline at end of file
diff --git a/docs/driver_library_component.svg b/docs/driver_library_component.svg
new file mode 100644
index 0000000..bcb43f9
--- /dev/null
+++ b/docs/driver_library_component.svg
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="168px" preserveAspectRatio="none" style="width:322px;height:168px;background:#FEFEFE;" version="1.1" viewBox="0 0 322 168" width="322px" zoomAndPan="magnify"><defs><filter height="300%" id="f1cgoct9zpmo59" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><!--entity inf--><rect fill="#FEFECE" filter="url(#f1cgoct9zpmo59)" height="36.2969" style="stroke: #A80036; stroke-width: 1.5;" width="85" x="6" y="8"/><rect fill="#FEFECE" height="5" style="stroke: #A80036; stroke-width: 1.5;" width="10" x="1" y="13"/><rect fill="#FEFECE" height="5" style="stroke: #A80036; stroke-width: 1.5;" width="10" x="1" y="34.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="16" y="30.9951">Inference</text><!--entity net--><rect fill="#FEFECE" filter="url(#f1cgoct9zpmo59)" height="36.2969" style="stroke: #A80036; stroke-width: 1.5;" width="77" x="129" y="8"/><rect fill="#FEFECE" height="5" style="stroke: #A80036; stroke-width: 1.5;" width="10" x="124" y="13"/><rect fill="#FEFECE" height="5" style="stroke: #A80036; stroke-width: 1.5;" width="10" x="124" y="34.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="139" y="30.9951">Network</text><!--entity buf--><rect fill="#FEFECE" filter="url(#f1cgoct9zpmo59)" height="36.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="137" y="121"/><rect fill="#FEFECE" height="5" style="stroke: #A80036; stroke-width: 1.5;" width="10" x="132" y="126"/><rect fill="#FEFECE" height="5" style="stroke: #A80036; stroke-width: 1.5;" width="10" x="132" y="147.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="147" y="143.9951">Buffer</text><!--entity dev--><rect fill="#FEFECE" filter="url(#f1cgoct9zpmo59)" height="36.2969" style="stroke: #A80036; stroke-width: 1.5;" width="67" x="244" y="121"/><rect fill="#FEFECE" height="5" style="stroke: #A80036; stroke-width: 1.5;" width="10" x="239" y="126"/><rect fill="#FEFECE" height="5" style="stroke: #A80036; stroke-width: 1.5;" width="10" x="239" y="147.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="254" y="143.9951">Device</text><!--link inf to net--><path d="M91.2656,26 C102.014,26 112.7624,26 123.5108,26 " fill="none" id="inf-net" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="128.7872,26,119.7872,22,123.7872,26,119.7872,30,128.7872,26" style="stroke: #A80036; stroke-width: 1.0;"/><!--link inf to buf--><path d="M51.77,44.1326 C55.1308,58.3191 61.6089,77.7906 73.5,91 C89.0965,108.3256 112.4057,120.2854 131.9103,127.9336 " fill="none" id="inf-buf" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="136.7801,129.7858,129.7901,122.8475,132.1067,128.0083,126.946,130.3249,136.7801,129.7858" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="81" x="74.5" y="87.0669">IFM and OFM</text><!--link net to dev--><path d="M206.4926,35.4978 C227.4666,42.6282 251.9451,54.5931 266.5,74 C275.351,85.8015 278.0778,102.1963 278.6036,115.5676 " fill="none" id="net-dev" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="278.7058,120.7148,282.5263,111.6371,278.6065,115.7158,274.5279,111.796,278.7058,120.7148" style="stroke: #A80036; stroke-width: 1.0;"/><!--link net to buf--><path d="M166.0926,44.2219 C165.4689,53.1847 164.8074,64.1523 164.5,74 C164.0682,87.8318 164.7366,103.3096 165.5511,115.691 " fill="none" id="net-buf" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="165.9063,120.794,169.2715,111.5379,165.559,115.8061,161.2909,112.0936,165.9063,120.794" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="96" x="165.5" y="87.0669">Network model</text><!--link buf to dev--><path d="M198.0078,139 C211.6511,139 225.2944,139 238.9377,139 " fill="none" id="buf-dev" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="243.9642,139,234.9642,135,238.9642,139,234.9642,143,243.9642,139" style="stroke: #A80036; stroke-width: 1.0;"/><!--
+@startuml
+
+skinparam backgroundColor #FEFEFE
+
+[Inference] as inf
+[Network] as net
+[Buffer] as buf
+[Device] as dev
+
+inf -> net
+inf -> buf: IFM and OFM
+
+net - -> dev
+net - -> buf: Network model
+
+buf -> dev
+
+@enduml
+
+PlantUML version 1.2017.15(Mon Jul 03 18:45:34 CEST 2017)
+(GPL source distribution)
+Java Runtime: OpenJDK Runtime Environment
+JVM: OpenJDK 64-Bit Server VM
+Java Version: 11.0.11+9-Ubuntu-0ubuntu2.18.04
+Operating System: Linux
+OS Version: 5.4.0-73-generic
+Default Encoding: UTF-8
+Language: en
+Country: US
+--></g></svg> \ No newline at end of file
diff --git a/docs/driver_library_sequence.puml b/docs/driver_library_sequence.puml
new file mode 100644
index 0000000..adac2f9
--- /dev/null
+++ b/docs/driver_library_sequence.puml
@@ -0,0 +1,79 @@
+@startuml
+
+skinparam backgroundColor #FEFEFE
+
+box "Application" #0091BD
+participant "main()" as main
+end box
+
+box "Driver library" #00C1DE
+participant "Device" as ddev
+participant "Buffer" as dbuf
+participant "Network" as dnet
+participant "Inference" as dinf
+end box
+
+box "Kernel driver" #7D868C
+participant "Device" as kdev
+participant "Buffer" as kbuf
+participant "Network" as knet
+participant "Inference" as kinf
+end box
+
+note over ddev
+ Create device
+end note
+activate main
+main -> ddev++: Device()
+ ddev -> kdev++: open(<device node>)
+ return file descriptor
+return
+
+note over dnet
+ Allocate and fill network buffer
+end note
+
+main -> dbuf++: Buffer(device)
+ dbuf -> kbuf++: ioctl(BUFFER_CREATE)
+ return file descriptor
+return
+
+note over dnet
+ Create network, parse network model
+end note
+
+main -> dnet++: Network(device, buffer)
+ dnet -> knet++: ioctl(NETWORK_CREATE)
+ return file descriptor
+
+ dnet -> dnet: Parse network model
+return
+
+loop Allocate and fill IFM buffers
+ main -> dbuf++: Buffer(device)
+ dbuf -> kbuf++: ioctl(BUFFER_CREATE)
+ return file descriptor
+ return
+end loop
+
+loop Allocate OFM buffers
+ main -> dbuf++: Buffer(device)
+ dbuf -> kbuf++: ioctl(BUFFER_CREATE)
+ return file descriptor
+ return
+end loop
+
+note over dinf
+ Create and run inference
+end note
+main -> dinf++: Inference(network, ifm, ofm)
+ dinf -> kinf++: ioctl(INFERENCE_CREATE)
+ return file descriptor
+return
+
+main -> dinf++: wait(file descriptor)
+ dinf -> kinf++: poll(file descriptor)
+ return
+return
+
+@enduml
diff --git a/docs/driver_library_sequence.svg b/docs/driver_library_sequence.svg
new file mode 100644
index 0000000..1103a05
--- /dev/null
+++ b/docs/driver_library_sequence.svg
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="1083px" preserveAspectRatio="none" style="width:831px;height:1083px;background:#FEFEFE;" version="1.1" viewBox="0 0 831 1083" width="831px" zoomAndPan="magnify"><defs><filter height="300%" id="f528w0w85mfwd" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><rect fill="#0091BD" height="1068.3125" style="stroke: #A80036; stroke-width: 1.0;" width="89" x="9" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="83" x="12" y="16.0669">Application</text><rect fill="#00C1DE" height="1068.3125" style="stroke: #A80036; stroke-width: 1.0;" width="389" x="109" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="96" x="255.5" y="16.0669">Driver library</text><rect fill="#7D868C" height="1068.3125" style="stroke: #A80036; stroke-width: 1.0;" width="320" x="500" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="95" x="612.5" y="16.0669">Kernel driver</text><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="956.5859" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="48.5" y="68.4297"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="72.3984" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="140.5" y="128.5625"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="72.3984" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="212.5" y="269.0938"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="72.3984" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="212.5" y="577.2891"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="72.3984" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="212.5" y="709.8203"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="114.5313" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="289.5" y="409.625"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="72.3984" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="447.5" y="857.3516"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="57.2656" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="447.5" y="958.75"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="531.5" y="157.6953"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="603.5" y="298.2266"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="603.5" y="606.4219"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="603.5" y="738.9531"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="680.5" y="438.7578"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="769.5" y="886.4844"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="14.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="769.5" y="987.8828"/><rect fill="#FEFEFE" filter="url(#f528w0w85mfwd)" height="118.5313" style="stroke: #000000; stroke-width: 2.0;" width="635" x="13" y="539.1563"/><rect fill="#FEFEFE" filter="url(#f528w0w85mfwd)" height="118.5313" style="stroke: #000000; stroke-width: 2.0;" width="635" x="13" y="671.6875"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="53" x2="53" y1="58.4297" y2="1034.0156"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="145" x2="145" y1="58.4297" y2="1034.0156"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="217" x2="217" y1="58.4297" y2="1034.0156"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="294" x2="294" y1="58.4297" y2="1034.0156"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="452" x2="452" y1="58.4297" y2="1034.0156"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="536" x2="536" y1="58.4297" y2="1034.0156"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="608" x2="608" y1="58.4297" y2="1034.0156"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="685" x2="685" y1="58.4297" y2="1034.0156"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="774" x2="774" y1="58.4297" y2="1034.0156"/><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="57" x="23" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="43" x="30" y="43.1279">main()</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="57" x="23" y="1033.0156"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="43" x="30" y="1053.0107">main()</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="113" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="120" y="43.1279">Device</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="113" y="1033.0156"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="120" y="1053.0107">Device</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="188" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="195" y="43.1279">Buffer</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="188" y="1033.0156"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="195" y="1053.0107">Buffer</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="257" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="264" y="43.1279">Network</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="257" y="1033.0156"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="264" y="1053.0107">Network</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="411" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="418" y="43.1279">Inference</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="411" y="1033.0156"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="418" y="1053.0107">Inference</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="504" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="511" y="43.1279">Device</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="504" y="1033.0156"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="511" y="1053.0107">Device</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="579" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="586" y="43.1279">Buffer</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="579" y="1033.0156"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="586" y="1053.0107">Buffer</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="648" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="655" y="43.1279">Network</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="648" y="1033.0156"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="655" y="1053.0107">Network</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="733" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="740" y="43.1279">Inference</text><rect fill="#FEFECE" filter="url(#f528w0w85mfwd)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="733" y="1033.0156"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="740" y="1053.0107">Inference</text><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="956.5859" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="48.5" y="68.4297"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="72.3984" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="140.5" y="128.5625"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="72.3984" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="212.5" y="269.0938"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="72.3984" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="212.5" y="577.2891"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="72.3984" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="212.5" y="709.8203"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="114.5313" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="289.5" y="409.625"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="72.3984" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="447.5" y="857.3516"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="57.2656" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="447.5" y="958.75"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="531.5" y="157.6953"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="603.5" y="298.2266"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="603.5" y="606.4219"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="603.5" y="738.9531"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="680.5" y="438.7578"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="769.5" y="886.4844"/><rect fill="#FFFFFF" filter="url(#f528w0w85mfwd)" height="14.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="769.5" y="987.8828"/><polygon fill="#FBFB77" filter="url(#f528w0w85mfwd)" points="89,73.4297,89,98.4297,198,98.4297,198,83.4297,188,73.4297,89,73.4297" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="188" x2="188" y1="73.4297" y2="83.4297"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="198" x2="188" y1="83.4297" y2="83.4297"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="88" x="95" y="90.4966">Create device</text><polygon fill="#A80036" points="128.5,124.5625,138.5,128.5625,128.5,132.5625,132.5,128.5625" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="58.5" x2="134.5" y1="128.5625" y2="128.5625"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="53" x="65.5" y="123.6294">Device()</text><polygon fill="#A80036" points="519.5,153.6953,529.5,157.6953,519.5,161.6953,523.5,157.6953" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="150.5" x2="525.5" y1="157.6953" y2="157.6953"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="141" x="157.5" y="152.7622">open(&lt;device node&gt;)</text><polygon fill="#A80036" points="161.5,182.8281,151.5,186.8281,161.5,190.8281,157.5,186.8281" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="155.5" x2="535.5" y1="186.8281" y2="186.8281"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="167.5" y="181.895">file descriptor</text><polygon fill="#A80036" points="69.5,196.9609,59.5,200.9609,69.5,204.9609,65.5,200.9609" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="63.5" x2="144.5" y1="200.9609" y2="200.9609"/><polygon fill="#FBFB77" filter="url(#f528w0w85mfwd)" points="186,213.9609,186,238.9609,398,238.9609,398,223.9609,388,213.9609,186,213.9609" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="388" x2="388" y1="213.9609" y2="223.9609"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="398" x2="388" y1="223.9609" y2="223.9609"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="191" x="192" y="231.0278">Allocate and fill network buffer</text><polygon fill="#A80036" points="200.5,265.0938,210.5,269.0938,200.5,273.0938,204.5,269.0938" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="58.5" x2="206.5" y1="269.0938" y2="269.0938"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="89" x="65.5" y="264.1606">Buffer(device)</text><polygon fill="#A80036" points="591.5,294.2266,601.5,298.2266,591.5,302.2266,595.5,298.2266" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="222.5" x2="597.5" y1="298.2266" y2="298.2266"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="141" x="229.5" y="293.2935">ioctl(BUFFER_CREATE)</text><polygon fill="#A80036" points="233.5,323.3594,223.5,327.3594,233.5,331.3594,229.5,327.3594" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="227.5" x2="607.5" y1="327.3594" y2="327.3594"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="239.5" y="322.4263">file descriptor</text><polygon fill="#A80036" points="69.5,337.4922,59.5,341.4922,69.5,345.4922,65.5,341.4922" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="63.5" x2="216.5" y1="341.4922" y2="341.4922"/><polygon fill="#FBFB77" filter="url(#f528w0w85mfwd)" points="162,354.4922,162,379.4922,422,379.4922,422,364.4922,412,354.4922,162,354.4922" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="412" x2="412" y1="354.4922" y2="364.4922"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="422" x2="412" y1="364.4922" y2="364.4922"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="239" x="168" y="371.5591">Create network, parse network model</text><polygon fill="#A80036" points="277.5,405.625,287.5,409.625,277.5,413.625,281.5,409.625" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="58.5" x2="283.5" y1="409.625" y2="409.625"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="148" x="65.5" y="404.6919">Network(device, buffer)</text><polygon fill="#A80036" points="668.5,434.7578,678.5,438.7578,668.5,442.7578,672.5,438.7578" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="299.5" x2="674.5" y1="438.7578" y2="438.7578"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="154" x="306.5" y="433.8247">ioctl(NETWORK_CREATE)</text><polygon fill="#A80036" points="310.5,463.8906,300.5,467.8906,310.5,471.8906,306.5,467.8906" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="304.5" x2="684.5" y1="467.8906" y2="467.8906"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="316.5" y="462.9575">file descriptor</text><line style="stroke: #A80036; stroke-width: 1.0;" x1="299.5" x2="341.5" y1="497.1563" y2="497.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="341.5" x2="341.5" y1="497.1563" y2="510.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="300.5" x2="341.5" y1="510.1563" y2="510.1563"/><polygon fill="#A80036" points="310.5,506.1563,300.5,510.1563,310.5,514.1563,306.5,510.1563" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="134" x="306.5" y="492.0903">Parse network model</text><polygon fill="#A80036" points="69.5,520.1563,59.5,524.1563,69.5,528.1563,65.5,524.1563" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="63.5" x2="293.5" y1="524.1563" y2="524.1563"/><rect fill="none" height="118.5313" style="stroke: #000000; stroke-width: 2.0;" width="635" x="13" y="539.1563"/><polygon fill="#EEEEEE" points="13,539.1563,90,539.1563,90,546.1563,80,556.1563,13,556.1563,13,539.1563" style="stroke: #000000; stroke-width: 2.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="32" x="28" y="552.2231">loop</text><text fill="#000000" font-family="sans-serif" font-size="11" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="188" x="105" y="551.3667">[Allocate and fill IFM buffers]</text><polygon fill="#A80036" points="200.5,573.2891,210.5,577.2891,200.5,581.2891,204.5,577.2891" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="58.5" x2="206.5" y1="577.2891" y2="577.2891"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="89" x="65.5" y="572.356">Buffer(device)</text><polygon fill="#A80036" points="591.5,602.4219,601.5,606.4219,591.5,610.4219,595.5,606.4219" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="222.5" x2="597.5" y1="606.4219" y2="606.4219"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="141" x="229.5" y="601.4888">ioctl(BUFFER_CREATE)</text><polygon fill="#A80036" points="233.5,631.5547,223.5,635.5547,233.5,639.5547,229.5,635.5547" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="227.5" x2="607.5" y1="635.5547" y2="635.5547"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="239.5" y="630.6216">file descriptor</text><polygon fill="#A80036" points="69.5,645.6875,59.5,649.6875,69.5,653.6875,65.5,649.6875" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="63.5" x2="216.5" y1="649.6875" y2="649.6875"/><rect fill="none" height="118.5313" style="stroke: #000000; stroke-width: 2.0;" width="635" x="13" y="671.6875"/><polygon fill="#EEEEEE" points="13,671.6875,90,671.6875,90,678.6875,80,688.6875,13,688.6875,13,671.6875" style="stroke: #000000; stroke-width: 2.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="32" x="28" y="684.7544">loop</text><text fill="#000000" font-family="sans-serif" font-size="11" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="145" x="105" y="683.8979">[Allocate OFM buffers]</text><polygon fill="#A80036" points="200.5,705.8203,210.5,709.8203,200.5,713.8203,204.5,709.8203" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="58.5" x2="206.5" y1="709.8203" y2="709.8203"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="89" x="65.5" y="704.8872">Buffer(device)</text><polygon fill="#A80036" points="591.5,734.9531,601.5,738.9531,591.5,742.9531,595.5,738.9531" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="222.5" x2="597.5" y1="738.9531" y2="738.9531"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="141" x="229.5" y="734.02">ioctl(BUFFER_CREATE)</text><polygon fill="#A80036" points="233.5,764.0859,223.5,768.0859,233.5,772.0859,229.5,768.0859" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="227.5" x2="607.5" y1="768.0859" y2="768.0859"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="239.5" y="763.1528">file descriptor</text><polygon fill="#A80036" points="69.5,778.2188,59.5,782.2188,69.5,786.2188,65.5,782.2188" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="63.5" x2="216.5" y1="782.2188" y2="782.2188"/><polygon fill="#FBFB77" filter="url(#f528w0w85mfwd)" points="360,802.2188,360,827.2188,540,827.2188,540,812.2188,530,802.2188,360,802.2188" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="530" x2="530" y1="802.2188" y2="812.2188"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="540" x2="530" y1="812.2188" y2="812.2188"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="159" x="366" y="819.2856">Create and run inference</text><polygon fill="#A80036" points="435.5,853.3516,445.5,857.3516,435.5,861.3516,439.5,857.3516" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="58.5" x2="441.5" y1="857.3516" y2="857.3516"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="180" x="65.5" y="852.4185">Inference(network, ifm, ofm)</text><polygon fill="#A80036" points="757.5,882.4844,767.5,886.4844,757.5,890.4844,761.5,886.4844" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="457.5" x2="763.5" y1="886.4844" y2="886.4844"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="163" x="464.5" y="881.5513">ioctl(INFERENCE_CREATE)</text><polygon fill="#A80036" points="468.5,911.6172,458.5,915.6172,468.5,919.6172,464.5,915.6172" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="462.5" x2="773.5" y1="915.6172" y2="915.6172"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="474.5" y="910.6841">file descriptor</text><polygon fill="#A80036" points="69.5,925.75,59.5,929.75,69.5,933.75,65.5,929.75" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="63.5" x2="451.5" y1="929.75" y2="929.75"/><polygon fill="#A80036" points="435.5,954.75,445.5,958.75,435.5,962.75,439.5,958.75" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="58.5" x2="441.5" y1="958.75" y2="958.75"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="121" x="65.5" y="953.8169">wait(file descriptor)</text><polygon fill="#A80036" points="757.5,983.8828,767.5,987.8828,757.5,991.8828,761.5,987.8828" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="457.5" x2="763.5" y1="987.8828" y2="987.8828"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="118" x="464.5" y="982.9497">poll(file descriptor)</text><polygon fill="#A80036" points="468.5,998.0156,458.5,1002.0156,468.5,1006.0156,464.5,1002.0156" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="462.5" x2="773.5" y1="1002.0156" y2="1002.0156"/><polygon fill="#A80036" points="69.5,1012.0156,59.5,1016.0156,69.5,1020.0156,65.5,1016.0156" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="63.5" x2="451.5" y1="1016.0156" y2="1016.0156"/><!--
+@startuml
+
+skinparam backgroundColor #FEFEFE
+
+box "Application" #0091BD
+participant "main()" as main
+end box
+
+box "Driver library" #00C1DE
+participant "Device" as ddev
+participant "Buffer" as dbuf
+participant "Network" as dnet
+participant "Inference" as dinf
+end box
+
+box "Kernel driver" #7D868C
+participant "Device" as kdev
+participant "Buffer" as kbuf
+participant "Network" as knet
+participant "Inference" as kinf
+end box
+
+note over ddev
+ Create device
+end note
+activate main
+main -> ddev++: Device()
+ ddev -> kdev++: open(<device node>)
+ return file descriptor
+return
+
+note over dnet
+ Allocate and fill network buffer
+end note
+
+main -> dbuf++: Buffer(device)
+ dbuf -> kbuf++: ioctl(BUFFER_CREATE)
+ return file descriptor
+return
+
+note over dnet
+ Create network, parse network model
+end note
+
+main -> dnet++: Network(device, buffer)
+ dnet -> knet++: ioctl(NETWORK_CREATE)
+ return file descriptor
+
+ dnet -> dnet: Parse network model
+return
+
+loop Allocate and fill IFM buffers
+ main -> dbuf++: Buffer(device)
+ dbuf -> kbuf++: ioctl(BUFFER_CREATE)
+ return file descriptor
+ return
+end loop
+
+loop Allocate OFM buffers
+ main -> dbuf++: Buffer(device)
+ dbuf -> kbuf++: ioctl(BUFFER_CREATE)
+ return file descriptor
+ return
+end loop
+
+note over dinf
+ Create and run inference
+end note
+main -> dinf++: Inference(network, ifm, ofm)
+ dinf -> kinf++: ioctl(INFERENCE_CREATE)
+ return file descriptor
+return
+
+main -> dinf++: wait(file descriptor)
+ dinf -> kinf++: poll(file descriptor)
+ return
+return
+
+@enduml
+
+PlantUML version 1.2017.15(Mon Jul 03 18:45:34 CEST 2017)
+(GPL source distribution)
+Java Runtime: OpenJDK Runtime Environment
+JVM: OpenJDK 64-Bit Server VM
+Java Version: 11.0.11+9-Ubuntu-0ubuntu2.18.04
+Operating System: Linux
+OS Version: 5.4.0-73-generic
+Default Encoding: UTF-8
+Language: en
+Country: US
+--></g></svg> \ No newline at end of file
diff --git a/docs/kernel_buffer.puml b/docs/kernel_buffer.puml
new file mode 100644
index 0000000..dc2c744
--- /dev/null
+++ b/docs/kernel_buffer.puml
@@ -0,0 +1,52 @@
+@startuml
+
+skinparam backgroundColor #FEFEFE
+
+box "Application" #0091BD
+participant "main()" as main
+end box
+
+box "Driver library" #00C1DE
+participant "Device" as ddev
+participant "Buffer" as dbuf
+participant "Network" as dnet
+participant "Inference" as dinf
+end box
+
+box "Kernel driver" #7D868C
+participant "Device" as kdev
+participant "Buffer" as kbuf
+participant "Network" as knet
+participant "Inference" as kinf
+end box
+
+activate main
+
+main -> ddev++: Device()
+ note over kdev
+ Open device node
+ end note
+
+ ddev -> kdev++: open(<device node>)
+ return file descriptor
+return
+
+main -> dbuf++: Buffer(device)
+ dbuf -> kdev++: ioctl(BUFFER_CREATE)
+ note over kbuf
+ Create buffer and return file descriptor
+ end note
+
+ kdev -> kbuf++: create()
+ return file descriptor
+ return file descriptor
+
+ note over kbuf
+ Memory map buffer
+ end note
+
+ dbuf -> kbuf++: mmap(file descriptor)
+ return
+return
+
+@enduml
diff --git a/docs/kernel_buffer.svg b/docs/kernel_buffer.svg
new file mode 100644
index 0000000..a3b2a48
--- /dev/null
+++ b/docs/kernel_buffer.svg
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="549px" preserveAspectRatio="none" style="width:805px;height:549px;background:#FEFEFE;" version="1.1" viewBox="0 0 805 549" width="805px" zoomAndPan="magnify"><defs><filter height="300%" id="f1kw7imlhutayc" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><rect fill="#0091BD" height="534.3203" style="stroke: #A80036; stroke-width: 1.0;" width="89" x="4" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="83" x="7" y="16.0669">Application</text><rect fill="#00C1DE" height="534.3203" style="stroke: #A80036; stroke-width: 1.0;" width="320" x="104" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="96" x="216" y="16.0669">Driver library</text><rect fill="#7D868C" height="534.3203" style="stroke: #A80036; stroke-width: 1.0;" width="368" x="426" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="95" x="562.5" y="16.0669">Kernel driver</text><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="422.5938" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="43.5" y="68.4297"/><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="111.5313" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="135.5" y="89.4297"/><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="252.0625" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="207.5" y="229.9609"/><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="457.5" y="157.6953"/><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="126.5313" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="457.5" y="259.0938"/><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="577.5" y="327.3594"/><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="14.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="577.5" y="453.8906"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="48" x2="48" y1="58.4297" y2="500.0234"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="140" x2="140" y1="58.4297" y2="500.0234"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="212" x2="212" y1="58.4297" y2="500.0234"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="289" x2="289" y1="58.4297" y2="500.0234"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="378" x2="378" y1="58.4297" y2="500.0234"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="462" x2="462" y1="58.4297" y2="500.0234"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="582" x2="582" y1="58.4297" y2="500.0234"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="659" x2="659" y1="58.4297" y2="500.0234"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="748" x2="748" y1="58.4297" y2="500.0234"/><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="57" x="18" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="43" x="25" y="43.1279">main()</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="57" x="18" y="499.0234"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="43" x="25" y="519.0186">main()</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="108" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="115" y="43.1279">Device</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="108" y="499.0234"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="115" y="519.0186">Device</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="183" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="190" y="43.1279">Buffer</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="183" y="499.0234"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="190" y="519.0186">Buffer</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="252" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="259" y="43.1279">Network</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="252" y="499.0234"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="259" y="519.0186">Network</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="337" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="344" y="43.1279">Inference</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="337" y="499.0234"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="344" y="519.0186">Inference</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="430" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="437" y="43.1279">Device</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="430" y="499.0234"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="437" y="519.0186">Device</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="553" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="560" y="43.1279">Buffer</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="553" y="499.0234"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="560" y="519.0186">Buffer</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="622" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="629" y="43.1279">Network</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="622" y="499.0234"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="629" y="519.0186">Network</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="707" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="714" y="43.1279">Inference</text><rect fill="#FEFECE" filter="url(#f1kw7imlhutayc)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="707" y="499.0234"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="714" y="519.0186">Inference</text><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="422.5938" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="43.5" y="68.4297"/><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="111.5313" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="135.5" y="89.4297"/><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="252.0625" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="207.5" y="229.9609"/><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="457.5" y="157.6953"/><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="126.5313" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="457.5" y="259.0938"/><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="577.5" y="327.3594"/><rect fill="#FFFFFF" filter="url(#f1kw7imlhutayc)" height="14.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="577.5" y="453.8906"/><polygon fill="#A80036" points="123.5,85.4297,133.5,89.4297,123.5,93.4297,127.5,89.4297" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="53.5" x2="129.5" y1="89.4297" y2="89.4297"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="53" x="60.5" y="84.4966">Device()</text><polygon fill="#FBFB77" filter="url(#f1kw7imlhutayc)" points="392,102.5625,392,127.5625,528,127.5625,528,112.5625,518,102.5625,392,102.5625" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="518" x2="518" y1="102.5625" y2="112.5625"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="528" x2="518" y1="112.5625" y2="112.5625"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="115" x="398" y="119.6294">Open device node</text><polygon fill="#A80036" points="445.5,153.6953,455.5,157.6953,445.5,161.6953,449.5,157.6953" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="145.5" x2="451.5" y1="157.6953" y2="157.6953"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="141" x="152.5" y="152.7622">open(&lt;device node&gt;)</text><polygon fill="#A80036" points="156.5,182.8281,146.5,186.8281,156.5,190.8281,152.5,186.8281" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="150.5" x2="461.5" y1="186.8281" y2="186.8281"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="162.5" y="181.895">file descriptor</text><polygon fill="#A80036" points="64.5,196.9609,54.5,200.9609,64.5,204.9609,60.5,200.9609" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="58.5" x2="139.5" y1="200.9609" y2="200.9609"/><polygon fill="#A80036" points="195.5,225.9609,205.5,229.9609,195.5,233.9609,199.5,229.9609" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="53.5" x2="201.5" y1="229.9609" y2="229.9609"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="89" x="60.5" y="225.0278">Buffer(device)</text><polygon fill="#A80036" points="445.5,255.0938,455.5,259.0938,445.5,263.0938,449.5,259.0938" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="217.5" x2="451.5" y1="259.0938" y2="259.0938"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="141" x="224.5" y="254.1606">ioctl(BUFFER_CREATE)</text><polygon fill="#FBFB77" filter="url(#f1kw7imlhutayc)" points="447,272.2266,447,297.2266,713,297.2266,713,282.2266,703,272.2266,447,272.2266" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="703" x2="703" y1="272.2266" y2="282.2266"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="713" x2="703" y1="282.2266" y2="282.2266"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="245" x="453" y="289.2935">Create buffer and return file descriptor</text><polygon fill="#A80036" points="565.5,323.3594,575.5,327.3594,565.5,331.3594,569.5,327.3594" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="467.5" x2="571.5" y1="327.3594" y2="327.3594"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="51" x="474.5" y="322.4263">create()</text><polygon fill="#A80036" points="478.5,352.4922,468.5,356.4922,478.5,360.4922,474.5,356.4922" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="472.5" x2="581.5" y1="356.4922" y2="356.4922"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="484.5" y="351.5591">file descriptor</text><polygon fill="#A80036" points="228.5,381.625,218.5,385.625,228.5,389.625,224.5,385.625" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="222.5" x2="461.5" y1="385.625" y2="385.625"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="234.5" y="380.6919">file descriptor</text><polygon fill="#FBFB77" filter="url(#f1kw7imlhutayc)" points="507,398.7578,507,423.7578,654,423.7578,654,408.7578,644,398.7578,507,398.7578" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="644" x2="644" y1="398.7578" y2="408.7578"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="654" x2="644" y1="408.7578" y2="408.7578"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="126" x="513" y="415.8247">Memory map buffer</text><polygon fill="#A80036" points="565.5,449.8906,575.5,453.8906,565.5,457.8906,569.5,453.8906" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="217.5" x2="571.5" y1="453.8906" y2="453.8906"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="138" x="224.5" y="448.9575">mmap(file descriptor)</text><polygon fill="#A80036" points="228.5,464.0234,218.5,468.0234,228.5,472.0234,224.5,468.0234" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="222.5" x2="581.5" y1="468.0234" y2="468.0234"/><polygon fill="#A80036" points="64.5,478.0234,54.5,482.0234,64.5,486.0234,60.5,482.0234" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="58.5" x2="211.5" y1="482.0234" y2="482.0234"/><!--
+@startuml
+
+skinparam backgroundColor #FEFEFE
+
+box "Application" #0091BD
+participant "main()" as main
+end box
+
+box "Driver library" #00C1DE
+participant "Device" as ddev
+participant "Buffer" as dbuf
+participant "Network" as dnet
+participant "Inference" as dinf
+end box
+
+box "Kernel driver" #7D868C
+participant "Device" as kdev
+participant "Buffer" as kbuf
+participant "Network" as knet
+participant "Inference" as kinf
+end box
+
+activate main
+
+main -> ddev++: Device()
+ note over kdev
+ Open device node
+ end note
+
+ ddev -> kdev++: open(<device node>)
+ return file descriptor
+return
+
+main -> dbuf++: Buffer(device)
+ dbuf -> kdev++: ioctl(BUFFER_CREATE)
+ note over kbuf
+ Create buffer and return file descriptor
+ end note
+
+ kdev -> kbuf++: create()
+ return file descriptor
+ return file descriptor
+
+ note over kbuf
+ Memory map buffer
+ end note
+
+ dbuf -> kbuf++: mmap(file descriptor)
+ return
+return
+
+@enduml
+
+PlantUML version 1.2017.15(Mon Jul 03 18:45:34 CEST 2017)
+(GPL source distribution)
+Java Runtime: OpenJDK Runtime Environment
+JVM: OpenJDK 64-Bit Server VM
+Java Version: 11.0.11+9-Ubuntu-0ubuntu2.18.04
+Operating System: Linux
+OS Version: 5.4.0-73-generic
+Default Encoding: UTF-8
+Language: en
+Country: US
+--></g></svg> \ No newline at end of file
diff --git a/docs/kernel_inference.puml b/docs/kernel_inference.puml
new file mode 100644
index 0000000..b521bdc
--- /dev/null
+++ b/docs/kernel_inference.puml
@@ -0,0 +1,79 @@
+@startuml
+
+skinparam backgroundColor #FEFEFE
+
+box "Application" #0091BD
+participant "main()" as main
+end box
+
+box "Driver library" #00C1DE
+participant "Device" as ddev
+participant "Buffer" as dbuf
+participant "Network" as dnet
+participant "Inference" as dinf
+end box
+
+box "Kernel driver" #7D868C
+participant "Device" as kdev
+participant "Buffer" as kbuf
+participant "Network" as knet
+participant "Inference" as kinf
+participant "Mailbox" as kmbox
+end box
+
+box "Cortex-M application" #E5ECEB
+participant "Message process" as cmsg
+end box
+
+activate main
+
+note over main
+ Create device
+ Create network
+ Allocate and fill IFM buffers
+ Allocate OFM buffers
+end note
+
+main -> dinf++: Inference(network, ifm, ofm)
+ dinf -> knet++: ioctl(INFERENCE_CREATE, network, ifm, ofm)
+ note over kinf
+ Create inference
+ end note
+
+ knet -> kinf++: create(network, ifm, ofm)
+ kinf -> kmbox++: inference()
+ note over kmbox
+ Write inference request to queue in shared memory
+ Send IRQ
+ end note
+
+ kmbox -> cmsg: INFERENCE_REQUEST
+ return
+ return file descriptor
+ return file descriptor
+return
+
+main -> dinf++: wait()
+ dinf -> kinf++: poll()
+
+ cmsg -> kdev++: INFERENCE_RESPONSE
+ note over kdev
+ Inference response is handled by the IRQ bottom handler thread
+ Message is read from queue in shared memory
+ end note
+
+ kdev -> kmbox++: read()
+ return
+
+ note over kinf
+ Inference response handler unlocks the polling thread
+ end note
+
+ kdev -> kinf++: inference_response()
+ return
+ deactivate cmsg
+
+ return
+return
+
+@enduml
diff --git a/docs/kernel_inference.svg b/docs/kernel_inference.svg
new file mode 100644
index 0000000..53ed8b0
--- /dev/null
+++ b/docs/kernel_inference.svg
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="832px" preserveAspectRatio="none" style="width:1288px;height:832px;background:#FEFEFE;" version="1.1" viewBox="0 0 1288 832" width="1288px" zoomAndPan="magnify"><defs><filter height="300%" id="fhqhey4ocrvwe" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><rect fill="#0091BD" height="817.6484" style="stroke: #A80036; stroke-width: 1.0;" width="89" x="60" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="83" x="63" y="16.0669">Application</text><rect fill="#00C1DE" height="817.6484" style="stroke: #A80036; stroke-width: 1.0;" width="320" x="151" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="96" x="263" y="16.0669">Driver library</text><rect fill="#7D868C" height="817.6484" style="stroke: #A80036; stroke-width: 1.0;" width="591" x="473" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="95" x="721" y="16.0669">Kernel driver</text><rect fill="#E5ECEB" height="817.6484" style="stroke: #A80036; stroke-width: 1.0;" width="159" x="1118" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="153" x="1121" y="16.0669">Cortex-M application</text><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="705.9219" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="99.5" y="68.4297"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="296.3281" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="420.5" y="173.9609"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="266.0625" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="420.5" y="499.2891"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="216.7969" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="504.5" y="557.5547"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="253.0625" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="731.5" y="203.0938"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="155.6641" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="922.5" y="271.3594"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="222.9297" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="922.5" y="528.4219"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="14.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="927.5" y="723.2188"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="97.5313" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="1020.5" y="300.4922"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="14.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="1020.5" y="640.9531"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="104" x2="104" y1="58.4297" y2="783.3516"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="187" x2="187" y1="58.4297" y2="783.3516"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="259" x2="259" y1="58.4297" y2="783.3516"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="336" x2="336" y1="58.4297" y2="783.3516"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="425" x2="425" y1="58.4297" y2="783.3516"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="509" x2="509" y1="58.4297" y2="783.3516"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="581" x2="581" y1="58.4297" y2="783.3516"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="736" x2="736" y1="58.4297" y2="783.3516"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="927" x2="927" y1="58.4297" y2="783.3516"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="1025" x2="1025" y1="58.4297" y2="783.3516"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="1197" x2="1197" y1="58.4297" y2="783.3516"/><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="57" x="74" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="43" x="81" y="43.1279">main()</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="57" x="74" y="782.3516"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="43" x="81" y="802.3467">main()</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="155" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="162" y="43.1279">Device</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="155" y="782.3516"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="162" y="802.3467">Device</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="230" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="237" y="43.1279">Buffer</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="230" y="782.3516"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="237" y="802.3467">Buffer</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="299" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="306" y="43.1279">Network</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="299" y="782.3516"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="306" y="802.3467">Network</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="384" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="391" y="43.1279">Inference</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="384" y="782.3516"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="391" y="802.3467">Inference</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="477" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="484" y="43.1279">Device</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="477" y="782.3516"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="484" y="802.3467">Device</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="552" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="559" y="43.1279">Buffer</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="552" y="782.3516"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="559" y="802.3467">Buffer</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="699" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="706" y="43.1279">Network</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="699" y="782.3516"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="706" y="802.3467">Network</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="886" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="893" y="43.1279">Inference</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="886" y="782.3516"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="893" y="802.3467">Inference</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="65" x="991" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="51" x="998" y="43.1279">Mailbox</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="65" x="991" y="782.3516"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="51" x="998" y="802.3467">Mailbox</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="137" x="1127" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="123" x="1134" y="43.1279">Message process</text><rect fill="#FEFECE" filter="url(#fhqhey4ocrvwe)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="137" x="1127" y="782.3516"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="123" x="1134" y="802.3467">Message process</text><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="705.9219" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="99.5" y="68.4297"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="296.3281" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="420.5" y="173.9609"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="266.0625" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="420.5" y="499.2891"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="216.7969" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="504.5" y="557.5547"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="253.0625" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="731.5" y="203.0938"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="155.6641" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="922.5" y="271.3594"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="222.9297" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="922.5" y="528.4219"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="14.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="927.5" y="723.2188"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="97.5313" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="1020.5" y="300.4922"/><rect fill="#FFFFFF" filter="url(#fhqhey4ocrvwe)" height="14.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="1020.5" y="640.9531"/><polygon fill="#FBFB77" filter="url(#fhqhey4ocrvwe)" points="8,73.4297,8,143.4297,198,143.4297,198,83.4297,188,73.4297,8,73.4297" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="188" x2="188" y1="73.4297" y2="83.4297"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="198" x2="188" y1="83.4297" y2="83.4297"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="88" x="14" y="90.4966">Create device</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="97" x="14" y="105.6294">Create network</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="169" x="14" y="120.7622">Allocate and fill IFM buffers</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="131" x="14" y="135.895">Allocate OFM buffers</text><polygon fill="#A80036" points="408.5,169.9609,418.5,173.9609,408.5,177.9609,412.5,173.9609" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="109.5" x2="414.5" y1="173.9609" y2="173.9609"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="180" x="116.5" y="169.0278">Inference(network, ifm, ofm)</text><polygon fill="#A80036" points="719.5,199.0938,729.5,203.0938,719.5,207.0938,723.5,203.0938" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="430.5" x2="725.5" y1="203.0938" y2="203.0938"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="282" x="437.5" y="198.1606">ioctl(INFERENCE_CREATE, network, ifm, ofm)</text><polygon fill="#FBFB77" filter="url(#fhqhey4ocrvwe)" points="862,216.2266,862,241.2266,989,241.2266,989,226.2266,979,216.2266,862,216.2266" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="979" x2="979" y1="216.2266" y2="226.2266"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="989" x2="979" y1="226.2266" y2="226.2266"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="106" x="868" y="233.2935">Create inference</text><polygon fill="#A80036" points="910.5,267.3594,920.5,271.3594,910.5,275.3594,914.5,271.3594" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="741.5" x2="916.5" y1="271.3594" y2="271.3594"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="162" x="748.5" y="266.4263">create(network, ifm, ofm)</text><polygon fill="#A80036" points="1008.5,296.4922,1018.5,300.4922,1008.5,304.4922,1012.5,300.4922" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="932.5" x2="1014.5" y1="300.4922" y2="300.4922"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="69" x="939.5" y="295.5591">inference()</text><polygon fill="#FBFB77" filter="url(#fhqhey4ocrvwe)" points="848,313.625,848,353.625,1199,353.625,1199,323.625,1189,313.625,848,313.625" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="1189" x2="1189" y1="313.625" y2="323.625"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="1199" x2="1189" y1="323.625" y2="323.625"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="330" x="854" y="330.6919">Write inference request to queue in shared memory</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="58" x="854" y="345.8247">Send IRQ</text><polygon fill="#A80036" points="1185.5,379.8906,1195.5,383.8906,1185.5,387.8906,1189.5,383.8906" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="1030.5" x2="1191.5" y1="383.8906" y2="383.8906"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="138" x="1037.5" y="378.9575">INFERENCE_REQUEST</text><polygon fill="#A80036" points="943.5,394.0234,933.5,398.0234,943.5,402.0234,939.5,398.0234" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="937.5" x2="1024.5" y1="398.0234" y2="398.0234"/><polygon fill="#A80036" points="752.5,423.0234,742.5,427.0234,752.5,431.0234,748.5,427.0234" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="746.5" x2="926.5" y1="427.0234" y2="427.0234"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="758.5" y="422.0903">file descriptor</text><polygon fill="#A80036" points="441.5,452.1563,431.5,456.1563,441.5,460.1563,437.5,456.1563" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="435.5" x2="735.5" y1="456.1563" y2="456.1563"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="447.5" y="451.2231">file descriptor</text><polygon fill="#A80036" points="120.5,466.2891,110.5,470.2891,120.5,474.2891,116.5,470.2891" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="114.5" x2="424.5" y1="470.2891" y2="470.2891"/><polygon fill="#A80036" points="408.5,495.2891,418.5,499.2891,408.5,503.2891,412.5,499.2891" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="109.5" x2="414.5" y1="499.2891" y2="499.2891"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="35" x="116.5" y="494.356">wait()</text><polygon fill="#A80036" points="910.5,524.4219,920.5,528.4219,910.5,532.4219,914.5,528.4219" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="430.5" x2="916.5" y1="528.4219" y2="528.4219"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="32" x="437.5" y="523.4888">poll()</text><polygon fill="#A80036" points="525.5,553.5547,515.5,557.5547,525.5,561.5547,521.5,557.5547" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="519.5" x2="1196.5" y1="557.5547" y2="557.5547"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="148" x="531.5" y="552.6216">INFERENCE_RESPONSE</text><polygon fill="#FBFB77" filter="url(#fhqhey4ocrvwe)" points="292,570.6875,292,610.6875,722,610.6875,722,580.6875,712,570.6875,292,570.6875" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="712" x2="712" y1="570.6875" y2="580.6875"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="722" x2="712" y1="580.6875" y2="580.6875"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="409" x="298" y="587.7544">Inference response is handled by the IRQ bottom handler thread</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="303" x="298" y="602.8872">Message is read from queue in shared memory</text><polygon fill="#A80036" points="1008.5,636.9531,1018.5,640.9531,1008.5,644.9531,1012.5,640.9531" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="514.5" x2="1014.5" y1="640.9531" y2="640.9531"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="39" x="521.5" y="636.02">read()</text><polygon fill="#A80036" points="525.5,651.0859,515.5,655.0859,525.5,659.0859,521.5,655.0859" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="519.5" x2="1024.5" y1="655.0859" y2="655.0859"/><polygon fill="#FBFB77" filter="url(#fhqhey4ocrvwe)" points="744,668.0859,744,693.0859,1107,693.0859,1107,678.0859,1097,668.0859,744,668.0859" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="1097" x2="1097" y1="668.0859" y2="678.0859"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="1107" x2="1097" y1="678.0859" y2="678.0859"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="342" x="750" y="685.1528">Inference response handler unlocks the polling thread</text><polygon fill="#A80036" points="915.5,719.2188,925.5,723.2188,915.5,727.2188,919.5,723.2188" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="514.5" x2="921.5" y1="723.2188" y2="723.2188"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="135" x="521.5" y="718.2856">inference_response()</text><polygon fill="#A80036" points="525.5,733.3516,515.5,737.3516,525.5,741.3516,521.5,737.3516" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="519.5" x2="921.5" y1="737.3516" y2="737.3516"/><polygon fill="#A80036" points="441.5,747.3516,431.5,751.3516,441.5,755.3516,437.5,751.3516" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="435.5" x2="926.5" y1="751.3516" y2="751.3516"/><polygon fill="#A80036" points="120.5,761.3516,110.5,765.3516,120.5,769.3516,116.5,765.3516" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="114.5" x2="424.5" y1="765.3516" y2="765.3516"/><!--
+@startuml
+
+skinparam backgroundColor #FEFEFE
+
+box "Application" #0091BD
+participant "main()" as main
+end box
+
+box "Driver library" #00C1DE
+participant "Device" as ddev
+participant "Buffer" as dbuf
+participant "Network" as dnet
+participant "Inference" as dinf
+end box
+
+box "Kernel driver" #7D868C
+participant "Device" as kdev
+participant "Buffer" as kbuf
+participant "Network" as knet
+participant "Inference" as kinf
+participant "Mailbox" as kmbox
+end box
+
+box "Cortex-M application" #E5ECEB
+participant "Message process" as cmsg
+end box
+
+activate main
+
+note over main
+ Create device
+ Create network
+ Allocate and fill IFM buffers
+ Allocate OFM buffers
+end note
+
+main -> dinf++: Inference(network, ifm, ofm)
+ dinf -> knet++: ioctl(INFERENCE_CREATE, network, ifm, ofm)
+ note over kinf
+ Create inference
+ end note
+
+ knet -> kinf++: create(network, ifm, ofm)
+ kinf -> kmbox++: inference()
+ note over kmbox
+ Write inference request to queue in shared memory
+ Send IRQ
+ end note
+
+ kmbox -> cmsg: INFERENCE_REQUEST
+ return
+ return file descriptor
+ return file descriptor
+return
+
+main -> dinf++: wait()
+ dinf -> kinf++: poll()
+
+ cmsg -> kdev++: INFERENCE_RESPONSE
+ note over kdev
+ Inference response is handled by the IRQ bottom handler thread
+ Message is read from queue in shared memory
+ end note
+
+ kdev -> kmbox++: read()
+ return
+
+ note over kinf
+ Inference response handler unlocks the polling thread
+ end note
+
+ kdev -> kinf++: inference_response()
+ return
+ deactivate cmsg
+
+ return
+return
+
+@enduml
+
+PlantUML version 1.2017.15(Mon Jul 03 18:45:34 CEST 2017)
+(GPL source distribution)
+Java Runtime: OpenJDK Runtime Environment
+JVM: OpenJDK 64-Bit Server VM
+Java Version: 11.0.11+9-Ubuntu-0ubuntu2.18.04
+Operating System: Linux
+OS Version: 5.4.0-73-generic
+Default Encoding: UTF-8
+Language: en
+Country: US
+--></g></svg> \ No newline at end of file
diff --git a/docs/kernel_network.puml b/docs/kernel_network.puml
new file mode 100644
index 0000000..39c7f55
--- /dev/null
+++ b/docs/kernel_network.puml
@@ -0,0 +1,41 @@
+@startuml
+
+skinparam backgroundColor #FEFEFE
+
+box "Application" #0091BD
+participant "main()" as main
+end box
+
+box "Driver library" #00C1DE
+participant "Device" as ddev
+participant "Buffer" as dbuf
+participant "Network" as dnet
+participant "Inference" as dinf
+end box
+
+box "Kernel driver" #7D868C
+participant "Device" as kdev
+participant "Buffer" as kbuf
+participant "Network" as knet
+participant "Inference" as kinf
+end box
+
+activate main
+
+note over main
+ Create device
+ Allocate and fill network buffer
+end note
+
+main -> dnet++: Network(device, buffer)
+ dnet -> kdev++: ioctl(NETWORK_CREATE, buffer)
+ note over knet
+ Create network and return file descriptor
+ end note
+
+ kdev -> knet++: create(buffer)
+ return file descriptor
+ return file descriptor
+return
+
+@enduml
diff --git a/docs/kernel_network.svg b/docs/kernel_network.svg
new file mode 100644
index 0000000..8b3b4a3
--- /dev/null
+++ b/docs/kernel_network.svg
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="380px" preserveAspectRatio="none" style="width:874px;height:380px;background:#FEFEFE;" version="1.1" viewBox="0 0 874 380" width="874px" zoomAndPan="magnify"><defs><filter height="300%" id="fflf1tczznf06" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><rect fill="#0091BD" height="365.7891" style="stroke: #A80036; stroke-width: 1.0;" width="89" x="71" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="83" x="74" y="16.0669">Application</text><rect fill="#00C1DE" height="365.7891" style="stroke: #A80036; stroke-width: 1.0;" width="320" x="162" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="96" x="274" y="16.0669">Driver library</text><rect fill="#7D868C" height="365.7891" style="stroke: #A80036; stroke-width: 1.0;" width="320" x="539" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="95" x="651.5" y="16.0669">Kernel driver</text><rect fill="#FFFFFF" filter="url(#fflf1tczznf06)" height="254.0625" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="110.5" y="68.4297"/><rect fill="#FFFFFF" filter="url(#fflf1tczznf06)" height="169.7969" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="342.5" y="143.6953"/><rect fill="#FFFFFF" filter="url(#fflf1tczznf06)" height="126.5313" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="570.5" y="172.8281"/><rect fill="#FFFFFF" filter="url(#fflf1tczznf06)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="719.5" y="241.0938"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="115" x2="115" y1="58.4297" y2="331.4922"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="198" x2="198" y1="58.4297" y2="331.4922"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="270" x2="270" y1="58.4297" y2="331.4922"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="347" x2="347" y1="58.4297" y2="331.4922"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="436" x2="436" y1="58.4297" y2="331.4922"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="575" x2="575" y1="58.4297" y2="331.4922"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="647" x2="647" y1="58.4297" y2="331.4922"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="724" x2="724" y1="58.4297" y2="331.4922"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="813" x2="813" y1="58.4297" y2="331.4922"/><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="57" x="85" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="43" x="92" y="43.1279">main()</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="57" x="85" y="330.4922"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="43" x="92" y="350.4873">main()</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="166" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="173" y="43.1279">Device</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="166" y="330.4922"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="173" y="350.4873">Device</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="241" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="248" y="43.1279">Buffer</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="241" y="330.4922"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="248" y="350.4873">Buffer</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="310" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="317" y="43.1279">Network</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="310" y="330.4922"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="317" y="350.4873">Network</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="395" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="402" y="43.1279">Inference</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="395" y="330.4922"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="402" y="350.4873">Inference</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="543" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="550" y="43.1279">Device</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="61" x="543" y="330.4922"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="47" x="550" y="350.4873">Device</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="618" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="625" y="43.1279">Buffer</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="55" x="618" y="330.4922"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="41" x="625" y="350.4873">Buffer</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="687" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="694" y="43.1279">Network</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="71" x="687" y="330.4922"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="57" x="694" y="350.4873">Network</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="772" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="779" y="43.1279">Inference</text><rect fill="#FEFECE" filter="url(#fflf1tczznf06)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="79" x="772" y="330.4922"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="65" x="779" y="350.4873">Inference</text><rect fill="#FFFFFF" filter="url(#fflf1tczznf06)" height="254.0625" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="110.5" y="68.4297"/><rect fill="#FFFFFF" filter="url(#fflf1tczznf06)" height="169.7969" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="342.5" y="143.6953"/><rect fill="#FFFFFF" filter="url(#fflf1tczznf06)" height="126.5313" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="570.5" y="172.8281"/><rect fill="#FFFFFF" filter="url(#fflf1tczznf06)" height="29.1328" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="719.5" y="241.0938"/><polygon fill="#FBFB77" filter="url(#fflf1tczznf06)" points="8,73.4297,8,113.4297,220,113.4297,220,83.4297,210,73.4297,8,73.4297" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="210" x2="210" y1="73.4297" y2="83.4297"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="220" x2="210" y1="83.4297" y2="83.4297"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="88" x="14" y="90.4966">Create device</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="191" x="14" y="105.6294">Allocate and fill network buffer</text><polygon fill="#A80036" points="330.5,139.6953,340.5,143.6953,330.5,147.6953,334.5,143.6953" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="120.5" x2="336.5" y1="143.6953" y2="143.6953"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="148" x="127.5" y="138.7622">Network(device, buffer)</text><polygon fill="#A80036" points="558.5,168.8281,568.5,172.8281,558.5,176.8281,562.5,172.8281" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="352.5" x2="564.5" y1="172.8281" y2="172.8281"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="199" x="359.5" y="167.895">ioctl(NETWORK_CREATE, buffer)</text><polygon fill="#FBFB77" filter="url(#fflf1tczznf06)" points="583,185.9609,583,210.9609,862,210.9609,862,195.9609,852,185.9609,583,185.9609" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="852" x2="852" y1="185.9609" y2="195.9609"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="862" x2="852" y1="195.9609" y2="195.9609"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="258" x="589" y="203.0278">Create network and return file descriptor</text><polygon fill="#A80036" points="707.5,237.0938,717.5,241.0938,707.5,245.0938,711.5,241.0938" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="580.5" x2="713.5" y1="241.0938" y2="241.0938"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="88" x="587.5" y="236.1606">create(buffer)</text><polygon fill="#A80036" points="591.5,266.2266,581.5,270.2266,591.5,274.2266,587.5,270.2266" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="585.5" x2="723.5" y1="270.2266" y2="270.2266"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="597.5" y="265.2935">file descriptor</text><polygon fill="#A80036" points="363.5,295.3594,353.5,299.3594,363.5,303.3594,359.5,299.3594" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="357.5" x2="574.5" y1="299.3594" y2="299.3594"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="369.5" y="294.4263">file descriptor</text><polygon fill="#A80036" points="131.5,309.4922,121.5,313.4922,131.5,317.4922,127.5,313.4922" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="125.5" x2="346.5" y1="313.4922" y2="313.4922"/><!--
+@startuml
+
+skinparam backgroundColor #FEFEFE
+
+box "Application" #0091BD
+participant "main()" as main
+end box
+
+box "Driver library" #00C1DE
+participant "Device" as ddev
+participant "Buffer" as dbuf
+participant "Network" as dnet
+participant "Inference" as dinf
+end box
+
+box "Kernel driver" #7D868C
+participant "Device" as kdev
+participant "Buffer" as kbuf
+participant "Network" as knet
+participant "Inference" as kinf
+end box
+
+activate main
+
+note over main
+ Create device
+ Allocate and fill network buffer
+end note
+
+main -> dnet++: Network(device, buffer)
+ dnet -> kdev++: ioctl(NETWORK_CREATE, buffer)
+ note over knet
+ Create network and return file descriptor
+ end note
+
+ kdev -> knet++: create(buffer)
+ return file descriptor
+ return file descriptor
+return
+
+@enduml
+
+PlantUML version 1.2017.15(Mon Jul 03 18:45:34 CEST 2017)
+(GPL source distribution)
+Java Runtime: OpenJDK Runtime Environment
+JVM: OpenJDK 64-Bit Server VM
+Java Version: 11.0.11+9-Ubuntu-0ubuntu2.18.04
+Operating System: Linux
+OS Version: 5.4.0-73-generic
+Default Encoding: UTF-8
+Language: en
+Country: US
+--></g></svg> \ No newline at end of file