From 5207830e53d454793cebfffa96d366ded79d71da Mon Sep 17 00:00:00 2001 From: Louis Verhaard Date: Wed, 18 Nov 2020 13:35:06 +0100 Subject: 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 --- ethosu/vela/api.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ethosu/vela/api.py') 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) -- cgit v1.2.1