sw:vec_iree: Add memory usage log on simple_vec_mul sample Print memory usage in test_mlexecute ``` 14:21:43.3816 [INFO] uart1: [output] KATA> test_mlexecute 14:21:43.4099 [WARNING] cpu2: The debug mode now has no effect - connect a debugger, and switch to stepping mode. 14:21:43.5901 [INFO] cpu2: simprint: "[[ iree_hal_allocator_t memory statistics ]]", 0 (0x0) 14:21:43.5908 [INFO] cpu2: simprint: "~ HOST_LOCAL: 0B peak / 0B allocated / 0B freed / 0B live", 0 (0x0) 14:21:43.5909 [INFO] cpu2: simprint: "DEVICE_LOCAL: 4096B peak / 4096B allocated / 4096B freed / 0B live", 0 (0x0) 14:21:43.5926 [INFO] cpu2: simprint: "INFO |simple_vec_mul finished successfully", 0 (0x0) 14:21:43.5936 [INFO] cpu2: simprint: "main returned: ", 0 (0x0) ``` Due to b/195166567, only the first execution has the memory log printed (IREE internal print mechanism uses fprintf). Change-Id: I0d5f0abec085fcdf6604276c4c3692d6fa97084d
diff --git a/samples/simple_vec_mul/simple_vec_mul.c b/samples/simple_vec_mul/simple_vec_mul.c index 4bd6dc3..c32d3cf 100644 --- a/samples/simple_vec_mul/simple_vec_mul.c +++ b/samples/simple_vec_mul/simple_vec_mul.c
@@ -146,8 +146,10 @@ iree_vm_list_release(outputs); iree_aligned_free(arg0_buffer); iree_aligned_free(arg1_buffer); - iree_hal_device_release(device); iree_vm_context_release(context); + IREE_IGNORE_ERROR(iree_hal_allocator_statistics_fprint( + stdout, iree_hal_device_allocator(device))); + iree_hal_device_release(device); iree_vm_instance_release(instance); return result; }