@@ -113,7 +113,7 @@ class EthosUBackend final : public ::executorch::runtime::BackendInterface {
113113 BackendInitContext& context,
114114 FreeableBuffer* processed,
115115 ArrayRef<CompileSpec> compile_specs) const override {
116- ET_LOG (Info, " EthosUBackend::init %p" , processed->data ());
116+ ET_LOG (Info, " data: %p" , processed->data ());
117117
118118 const char * data = static_cast <const char *>(processed->data ());
119119 size_t size = processed->size ();
@@ -173,7 +173,7 @@ class EthosUBackend final : public ::executorch::runtime::BackendInterface {
173173 static_cast <const char *>(execution_handle->processed ->data ());
174174 EXECUTORCH_PROF_END (event_tracer, event_tracer_local_scope);
175175
176- ET_LOG (Debug, " EthosUBackend::execute %p" , data);
176+ ET_LOG (Debug, " data: %p" , data);
177177
178178 EXECUTORCH_PROF_START (
179179 event_tracer,
@@ -182,7 +182,7 @@ class EthosUBackend final : public ::executorch::runtime::BackendInterface {
182182 // Read key sections from the vela_bin_stream
183183 if (vela_bin_read (data, &handles, execution_handle->processed ->size ()) ==
184184 false ) {
185- ET_LOG (Error, " EthosUBackend:: vela_read: error, invalid binary layout" );
185+ ET_LOG (Error, " vela_read: error, invalid binary layout" );
186186 return Error::InvalidProgram;
187187 }
188188 EXECUTORCH_PROF_END (event_tracer, event_tracer_local_scope);
@@ -193,9 +193,16 @@ class EthosUBackend final : public ::executorch::runtime::BackendInterface {
193193 // the end of the execution of the Ethos-U custom delegate
194194 char * ethosu_scratch =
195195 static_cast <char *>(temp_allocator->allocate (handles.scratch_data_size ));
196+ if (ethosu_scratch == nullptr ) {
197+ ET_LOG (
198+ Error,
199+ " Failed to allocate scratch buffer of %zu bytes from temp_allocator" ,
200+ handles.scratch_data_size );
201+ return Error::MemoryAllocationFailed;
202+ }
196203 ET_LOG (
197204 Debug,
198- " EthosUBackend::execute: Running program data:\n cmd %p %zu\n weight %p %zu\n scratch %p %zu\n fast scratch %p %zu\n " ,
205+ " Running program data:\n cmd %p %zu\n weight %p %zu\n scratch %p %zu\n fast scratch %p %zu\n " ,
199206 handles.cmd_data ,
200207 handles.cmd_data_size ,
201208 handles.weight_data ,
@@ -301,7 +308,7 @@ class EthosUBackend final : public ::executorch::runtime::BackendInterface {
301308 std::unique_ptr<ethosu_driver, decltype (ðosu_release_driver)>(
302309 ethosu_reserve_driver (), ethosu_release_driver);
303310 if (driver == NULL ) {
304- ET_LOG (Error, " EthosUBackend::execute: ethosu_reserve_driver failed" );
311+ ET_LOG (Error, " ethosu_reserve_driver failed" );
305312 return Error::InvalidState;
306313 }
307314
@@ -333,10 +340,7 @@ class EthosUBackend final : public ::executorch::runtime::BackendInterface {
333340 EXECUTORCH_PROF_END (event_tracer, event_tracer_local_scope);
334341
335342 if (result != 0 ) {
336- ET_LOG (
337- Error,
338- " EthosUBackend::execute: Ethos-U invocation failed error (%d)" ,
339- result);
343+ ET_LOG (Error, " Ethos-U invocation failed error (%d)" , result);
340344 return Error::InvalidProgram;
341345 }
342346 int tensor_dim = 0 , io_dim = 0 ;
0 commit comments