diff options
author | Louis Verhaard <louis.verhaard@arm.com> | 2021-03-30 09:02:30 +0200 |
---|---|---|
committer | Louis Verhaard <louis.verhaard@arm.com> | 2021-03-31 10:06:17 +0200 |
commit | 893780c576be1717504666b024e40005829c3e3e (patch) | |
tree | 4f722f95c17df6ab2abba786edf61e177826a88b /ethosu | |
parent | 226ecaf4561f421206d1593eac0fa57dd56db82e (diff) | |
download | ethos-u-vela-893780c576be1717504666b024e40005829c3e3e.tar.gz |
MLBEDSW-3502: Bug fix addresses >= 32 bit
Bug fix in generation of register command offsets that do not fit in 32 bit.
Signed-off-by: Louis Verhaard <louis.verhaard@arm.com>
Change-Id: Iabb99cf6536c0f77b934691f8744df61f1eab3ed
Diffstat (limited to 'ethosu')
-rw-r--r-- | ethosu/vela/register_command_stream_generator.py | 3 | ||||
-rw-r--r-- | ethosu/vela/test/extapi/test_extapi_generate_commands.py | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/ethosu/vela/register_command_stream_generator.py b/ethosu/vela/register_command_stream_generator.py index 733be590..fb705b96 100644 --- a/ethosu/vela/register_command_stream_generator.py +++ b/ethosu/vela/register_command_stream_generator.py @@ -176,7 +176,8 @@ class CommandStreamEmitter: self.offset += CommandStreamEmitter.WORD_SIZE def cmd1_with_offset(self, cmd: cmd1, offset, param=0x0): - offset = int(offset) & 0xFFFFFFFFF + offset = int(offset) & 0xFFFFFFFF + param = int(param) & 0xFFFF command = cmd.value | CmdMode.Payload32.value | (param << 16) if not self.get_reg_machine(cmd).set_register(cmd, (command, offset)): diff --git a/ethosu/vela/test/extapi/test_extapi_generate_commands.py b/ethosu/vela/test/extapi/test_extapi_generate_commands.py index db0485c5..3c9a43db 100644 --- a/ethosu/vela/test/extapi/test_extapi_generate_commands.py +++ b/ethosu/vela/test/extapi/test_extapi_generate_commands.py @@ -61,7 +61,7 @@ def check_cmd0(cmd_stream, cmd, param): def check_cmd1(cmd_stream, cmd, offset, param=0x0): """Checks that the command stream contains the given command + parameter""" - offset = int(offset) & 0xFFFFFFFFF + offset = int(offset) & 0xFFFFFFFF command = cmd.value | CmdMode.Payload32.value | (param << 16) for i in range(len(cmd_stream) - 1): if cmd_stream[i] == command and cmd_stream[i + 1] == offset: @@ -380,9 +380,11 @@ def test_check_mem_limits(): with pytest.raises(VelaError): npu_generate_register_command_stream([conv_op], NpuAccelerator.Ethos_U65_256) # bias with high end address, but still within range + addr = (1 << 48) - 1024 conv_op = create_fully_connected_op() - conv_op.biases = [NpuAddressRange(region=0, address=(1 << 48) - 1024, length=1000)] - npu_generate_register_command_stream([conv_op], NpuAccelerator.Ethos_U65_512) + conv_op.biases = [NpuAddressRange(region=0, address=addr, length=1000)] + cmds = npu_generate_register_command_stream([conv_op], NpuAccelerator.Ethos_U65_512) + check_cmd1(cmds, cmd1.NPU_SET_SCALE_BASE, addr & ((1 << 32) - 1), (addr >> 32) & ((1 << 16) - 1)) conv_op = create_fully_connected_op() # weights with negative address conv_op.weights = [NpuAddressRange(region=0, address=-16, length=1000)] |