aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/api.py
diff options
context:
space:
mode:
authorLouis Verhaard <louis.verhaard@arm.com>2020-11-18 13:35:06 +0100
committerLouis Verhaard <louis.verhaard@arm.com>2020-11-23 13:39:56 +0100
commit5207830e53d454793cebfffa96d366ded79d71da (patch)
treeb99da4124607c6d20ceef9605eccf89e150ba666 /ethosu/vela/api.py
parentaeae56770f3c19182d32cc63fd32396e061a7648 (diff)
downloadethos-u-vela-5207830e53d454793cebfffa96d366ded79d71da.tar.gz
MLBEDSW-3425: Added external API for driver actions
Added external API to add driver actions to a command stream. Change-Id: Ie4779c1c745defc5769fa694358470cd6aea191c Signed-off-by: Louis Verhaard <louis.verhaard@arm.com>
Diffstat (limited to 'ethosu/vela/api.py')
-rw-r--r--ethosu/vela/api.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/ethosu/vela/api.py b/ethosu/vela/api.py
index f64a38fb..22f81d09 100644
--- a/ethosu/vela/api.py
+++ b/ethosu/vela/api.py
@@ -453,3 +453,19 @@ def npu_generate_register_command_stream(npu_op_list: List[NpuOperation], accele
from . import register_command_stream_generator
return register_command_stream_generator.generate_register_command_stream(npu_op_list, accelerator)
+
+
+def npu_create_driver_payload(register_command_stream: List[int], accelerator: NpuAccelerator) -> bytes:
+ """
+ Public facing API for generating driver payload, containing a driver header
+ and the given Ethos-U register command stream.
+ Returns the payload, in little endian format, which must be placed in memory on a 16-byte aligned
+ address.
+
+ :param register_command_stream: List[int] register commands, as a list of 32-bit integers
+ :param accelerator: NpuAccelerator enum to pick the correct accelerator
+ :return driver payload, as a byte array
+ """
+ from . import driver_actions
+
+ return driver_actions.npu_create_driver_payload(register_command_stream, accelerator)