diff --git a/backends/arm/runtime/EthosUBackend.cpp b/backends/arm/runtime/EthosUBackend.cpp index d29c32b02f3..a31c97d817b 100644 --- a/backends/arm/runtime/EthosUBackend.cpp +++ b/backends/arm/runtime/EthosUBackend.cpp @@ -191,8 +191,9 @@ class EthosUBackend final : public ::executorch::runtime::BackendInterface { // Use a temporary allocator for the intermediate tensors of the // computation. The allocator is released in runtime/executor/method.cpp at // the end of the execution of the Ethos-U custom delegate - char* ethosu_scratch = - static_cast(temp_allocator->allocate(handles.scratch_data_size)); + // Ethos-U driver requires 16 bit alignment. + char* ethosu_scratch = static_cast( + temp_allocator->allocate(handles.scratch_data_size, 16UL)); if (ethosu_scratch == nullptr) { ET_LOG( Error, diff --git a/examples/arm/executor_runner/arm_executor_runner.cpp b/examples/arm/executor_runner/arm_executor_runner.cpp index 44241421016..0e0e66dd07b 100644 --- a/examples/arm/executor_runner/arm_executor_runner.cpp +++ b/examples/arm/executor_runner/arm_executor_runner.cpp @@ -521,8 +521,9 @@ void runner_init( ET_LOG(Info, "Setting up planned buffer %zu, size %zu.", id, buffer_size); /* Move to it's own allocator when MemoryPlanner is in place. */ - uint8_t* buffer = - reinterpret_cast(ctx.method_allocator->allocate(buffer_size)); + /* Ethos-U driver requires 16 bit alignment. */ + uint8_t* buffer = reinterpret_cast( + ctx.method_allocator->allocate(buffer_size, 16UL)); ET_CHECK_MSG( buffer != nullptr, "Could not allocate memory for memory planned buffer size %zu",