diff options
author | William Isaksson <william.isaksson@arm.com> | 2023-08-07 10:32:07 +0000 |
---|---|---|
committer | William Isaksson <william.isaksson@arm.com> | 2023-11-21 10:43:30 +0100 |
commit | 6165283b314363677cc1c34388b92c414972273c (patch) | |
tree | 938e3d839df5bdff61a0fef0d8070adf21919f78 | |
parent | 8cb3c360902a3e9fd583e474a4393646362dcf42 (diff) | |
download | ethos-u-vela-6165283b314363677cc1c34388b92c414972273c.tar.gz |
MLBEDSW-7871: Document new error types in API
- Documents Legality requirements of CMD1 payloads
- Fixes a miss in the command stream checks.
Signed-off-by: William Isaksson <william.isaksson@arm.com>
Change-Id: I9b33dedfa66650fa3100f61fd158a385818b4d52
-rw-r--r-- | API.md | 34 | ||||
-rw-r--r-- | ethosu/vela/register_command_stream_generator.py | 1 |
2 files changed, 35 insertions, 0 deletions
@@ -83,6 +83,38 @@ In addition to transforming NPU operations to register commands, Vela also: * adds kernel/DMA wait commands if necessary * selects the most efficient "block dependency" that controls the NPU pipeline. +#### Payload legality + +If the following legality requirements are violated, either a ByteAlignmentError +or a ByteSizeError will be raised: + +#### DMA OP + +**Ethos-U55**: +- DST (destination) and SRC (source) offset must be 16 byte aligned. +- The (SRC) length must be a multiple of 16 bytes. + +**Ethos-U65**: +- Only (NPU) internal DST and SRC offset must be 16 byte aligned. +- For an internal DST the length must be a multiple of 16. + +#### Feature Maps + +- Tile addresses must be aligned to 16 bytes for NpuLayout NHCWB16, or +aligned to the element size for NpuLayout NHWC. +- For NpuLayout NHCWB16, height and depth strides must be a positive multiple of +16 bytes. For NpuLayout NHWC height and width strides must be a +positive multiple of the element size. + +#### Scale/Bias + +- Scale and Bias length must be a multiple of 16 bytes. + +#### Weights + +- Weight offset must be 16 byte aligned. +- Weight length must be a multiple of 16 bytes. + ### Creating a Driver Payload for the Ethos-U driver If an Ethos-U driver is used to trigger the execution of the register command @@ -103,3 +135,5 @@ which is maintained separately from Vela's overall version. For examples of how to use these APIs, please see the unit tests that are bundled with Vela's source code, in module `ethosu.vela.test.extapi`. + + diff --git a/ethosu/vela/register_command_stream_generator.py b/ethosu/vela/register_command_stream_generator.py index 42ae99d..9d9a1e6 100644 --- a/ethosu/vela/register_command_stream_generator.py +++ b/ethosu/vela/register_command_stream_generator.py @@ -531,6 +531,7 @@ def generate_weights(emit: CommandStreamEmitter, weights: List[NpuAddressRange], emit.cmd1_with_offset(length, weights[core].length) elif core < arch.ncores: check_alignment(weights[0].address, 16) + check_length(weights[0].length, 16) emit.cmd1_with_address(addr, weights[0].address) emit.cmd1_with_offset(length, 0) |