2828// needs to be large enough to take an entire model. On the FVP,
2929// network_model_sec is linked to the DDR, which is large (256MB on
3030// Corstone-300).
31- const size_t input_allocation_pool_size = 60 * 1024 * 1024 ;
31+ const size_t input_allocation_pool_size = 100 * 1024 * 1024 ;
3232unsigned char __attribute__ ((
3333 section (" network_model_sec" ),
3434 aligned(16 ))) input_allocation_pool[input_allocation_pool_size];
@@ -63,7 +63,7 @@ using executorch::runtime::Span;
6363using executorch::runtime::Tag;
6464using executorch::runtime::TensorInfo;
6565
66- #define METHOD_ALLOCATOR_POOL_SIZE (60 * 1024 * 1024 )
66+ #define METHOD_ALLOCATOR_POOL_SIZE (70 * 1024 * 1024 )
6767unsigned char __attribute__ ((
6868 section (" network_model_sec" ),
6969 aligned(16 ))) method_allocation_pool[METHOD_ALLOCATOR_POOL_SIZE];
@@ -326,8 +326,6 @@ int main(int argc, const char* argv[]) {
326326 std::vector<Span<uint8_t >> planned_spans; // Passed to the allocator
327327 size_t num_memory_planned_buffers = method_meta->num_memory_planned_buffers ();
328328
329- size_t planned_buffer_membase = method_allocator.used_size ();
330-
331329 for (size_t id = 0 ; id < num_memory_planned_buffers; ++id) {
332330 size_t buffer_size =
333331 static_cast <size_t >(method_meta->memory_planned_buffer_size (id).get ());
@@ -339,8 +337,6 @@ int main(int argc, const char* argv[]) {
339337 planned_buffers.push_back (buffer);
340338 planned_spans.push_back ({planned_buffers.back (), buffer_size});
341339 }
342- size_t planned_buffer_memsize =
343- method_allocator.used_size () - planned_buffer_membase;
344340
345341 HierarchicalAllocator planned_memory (
346342 {planned_spans.data (), planned_spans.size ()});
@@ -351,7 +347,6 @@ int main(int argc, const char* argv[]) {
351347 MemoryManager memory_manager (
352348 &method_allocator, &planned_memory, &temp_allocator);
353349
354- size_t method_loaded_membase = method_allocator.used_size ();
355350 Result<Method> method = program->load_method (method_name, &memory_manager);
356351 if (!method.ok ()) {
357352 ET_LOG (
@@ -360,12 +355,10 @@ int main(int argc, const char* argv[]) {
360355 method_name,
361356 method.error ());
362357 }
363- size_t method_loaded_memsize =
364- method_allocator.used_size () - method_loaded_membase;
365358 ET_LOG (Info, " Method loaded." );
366359
367360 ET_LOG (Info, " Preparing inputs..." );
368- size_t input_membase = method_allocator. used_size ();
361+
369362 auto inputs =
370363 ::prepare_input_tensors (*method, method_allocator, input_buffers);
371364
@@ -376,15 +369,12 @@ int main(int argc, const char* argv[]) {
376369 method_name,
377370 inputs.error ());
378371 }
379- size_t input_memsize = method_allocator.used_size () - input_membase;
380372 ET_LOG (Info, " Input prepared." );
381373
382374 ET_LOG (Info, " Starting the model execution..." );
383- size_t executor_membase = method_allocator.used_size ();
384375 StartMeasurements ();
385376 Error status = method->execute ();
386377 StopMeasurements ();
387- size_t executor_memsize = method_allocator.used_size () - executor_membase;
388378
389379 if (status != Error::Ok) {
390380 ET_LOG (
@@ -435,25 +425,6 @@ int main(int argc, const char* argv[]) {
435425 }
436426out:
437427 ET_LOG (Info, " Program complete, exiting." );
438- if (method_allocator.size () != 0 ) {
439- size_t method_allocator_used = method_allocator.used_size ();
440- ET_LOG (
441- Info,
442- " Method allocator area ( method_allocator_planned: %zu method_allocator_loaded: %zu method_allocator_input: %zu method_allocator_executor: %zu ) total: %zu" ,
443- planned_buffer_memsize,
444- method_loaded_memsize,
445- input_memsize,
446- executor_memsize,
447- method_allocator_used);
448- ET_LOG (
449- Info,
450- " Method allocator area method_allocator_used: %d / method_allocator_size: %d method_allocator_free: %d ( used: %d %% ) " ,
451- method_allocator_used,
452- method_allocator.size (),
453- method_allocator.free_size (),
454- 100 * method_allocator_used / method_allocator.size ());
455- }
456-
457428#ifdef SEMIHOSTING
458429 _exit (0 );
459430#endif
0 commit comments